From: Mike Brady <4265913+mikebrady@users.noreply.github.com>
Date: Mon, 28 Nov 2022 15:09:43 +0000 (+0000)
Subject: Add "FirstFramePostion" property set when first frame of a play session is sent.
X-Git-Tag: 4.1.1~2^2~12
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37f060f48e90aa11d66f28dc1f06e91afa73ed3a;p=thirdparty%2Fshairport-sync.git
Add "FirstFramePostion" property set when first frame of a play session is sent.
---
diff --git a/dbus-service.c b/dbus-service.c
index e957dfa5..4cfc8254 100644
--- a/dbus-service.c
+++ b/dbus-service.c
@@ -106,6 +106,15 @@ void dbus_metadata_watcher(struct metadata_bundle *argc, __attribute__((unused))
}
}
+ if (argc->first_frame_position_string) {
+ // debug(1, "Check first frame position string");
+ th = shairport_sync_get_first_frame_position(shairportSyncSkeleton);
+ if ((th == NULL) || (strcasecmp(th, argc->first_frame_position_string) != 0)) {
+ // debug(1, "First frame position string should be changed");
+ shairport_sync_set_first_frame_position(shairportSyncSkeleton, argc->first_frame_position_string);
+ }
+ }
+
if (argc->stream_type) {
// debug(1, "Check stream type");
th = shairport_sync_remote_control_get_stream_type(shairportSyncRemoteControlSkeleton);
diff --git a/metadata_hub.c b/metadata_hub.c
index 1d9a9a28..e39752fe 100644
--- a/metadata_hub.c
+++ b/metadata_hub.c
@@ -589,7 +589,16 @@ void metadata_hub_process_metadata(uint32_t type, uint32_t code, char *data, uin
if (string_update(&metadata_store.frame_position_string,
&metadata_store.frame_position_string_changed, cs)) {
changed = 1;
- debug(2, "MH Frame Position String set to: \"%s\"", metadata_store.progress_string);
+ debug(2, "MH Frame Position String set to: \"%s\"", metadata_store.frame_position_string);
+ }
+ free(cs);
+ break;
+ case 'phb0':
+ cs = strndup(data, length);
+ if (string_update(&metadata_store.first_frame_position_string,
+ &metadata_store.first_frame_position_string_changed, cs)) {
+ changed = 1;
+ debug(2, "MH First Frame Position String set to: \"%s\"", metadata_store.first_frame_position_string);
}
free(cs);
break;
diff --git a/metadata_hub.h b/metadata_hub.h
index 63efb1c0..8235c6e4 100644
--- a/metadata_hub.h
+++ b/metadata_hub.h
@@ -58,6 +58,9 @@ typedef struct metadata_bundle {
char *frame_position_string; // frame position string emitted by SPS on request
int frame_position_string_changed;
+ char *first_frame_position_string; // first frame position string emitted by SPS on request
+ int first_frame_position_string_changed;
+
int player_thread_active; // true if a play thread is running
int dacp_server_active; // true if there's a reachable DACP server (assumed to be the Airplay
// client) ; false otherwise
diff --git a/org.gnome.ShairportSync.xml b/org.gnome.ShairportSync.xml
index 75355a8b..722fda5b 100644
--- a/org.gnome.ShairportSync.xml
+++ b/org.gnome.ShairportSync.xml
@@ -27,6 +27,7 @@
+
diff --git a/player.c b/player.c
index 3c5b1d99..9d8159a5 100644
--- a/player.c
+++ b/player.c
@@ -3056,6 +3056,7 @@ void *player_thread_func(void *arg) {
memset(hb, 0, 128);
snprintf(hb, 127, "%" PRIu32 "/%" PRId64 "", inframe->given_timestamp,
should_be_time);
+ send_ssnc_metadata('phb0', hb, strlen(hb), 1);
send_ssnc_metadata('phbt', hb, strlen(hb), 1);
time_of_last_metadata_progress_update = local_time_now;
} else {
@@ -3131,6 +3132,7 @@ void *player_thread_func(void *arg) {
memset(hb, 0, 128);
snprintf(hb, 127, "%" PRIu32 "/%" PRId64 "", inframe->given_timestamp,
should_be_time);
+ send_ssnc_metadata('phb0', hb, strlen(hb), 1);
send_ssnc_metadata('phbt', hb, strlen(hb), 1);
time_of_last_metadata_progress_update = local_time_now;
} else {