]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Add "FirstFramePostion" property set when first frame of a play session is sent.
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Mon, 28 Nov 2022 15:09:43 +0000 (15:09 +0000)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Mon, 28 Nov 2022 15:09:43 +0000 (15:09 +0000)
dbus-service.c
metadata_hub.c
metadata_hub.h
org.gnome.ShairportSync.xml
player.c

index e957dfa5c9374b1eab79f7451de743caf8f63249..4cfc8254a6008309402d6723b37e87be8ca36a6a 100644 (file)
@@ -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);
index 1d9a9a286a9dc0660dba7c3f55de1cc2fce7b846..e39752fea94dc6779e5339eb2a56cbf610cb9e09 100644 (file)
@@ -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;
index 63efb1c0d1961b0ca86f9627690d8844f54167b2..8235c6e4886b7ca3386261844ae6623fae663f30 100644 (file)
@@ -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
index 75355a8b5215f915f5ee80cb4bc5f0639d788afe..722fda5bb39ab3634fd7ac36e103458cd4ca31d8 100644 (file)
@@ -27,6 +27,7 @@
     <property name="ServiceName" type="s" access="read" />
     <property name="OutputFormat" type="s" access="read" />
     <property name="OutputRate" type="i" access="read" />
+    <property name="FirstFramePosition" type="s" access="read" />
     <property name="FramePosition" type="s" access="read" />
     <method name="SetFramePositionUpdateInterval">
       <arg name="seconds" type="d" direction="in" />
index 3c5b1d99df95164c0bedc7d390a31677c9a5ec60..9d8159a503298cf3497f3e1a8ff2d86bff7fe970 100644 (file)
--- 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 {