Add "FirstFramePostion" property set when first frame of a play session is sent.

This commit is contained in:
Mike Brady
2022-11-28 15:09:43 +00:00
parent 4044666897
commit 37f060f48e
5 changed files with 25 additions and 1 deletions
+9
View 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);
+10 -1
View 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;
+3
View 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
+1
View 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" />
+2
View File
@@ -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 {