Add albumArtist and composer lists if available. Add a FramePosition property giving the RTP frame number and the time it is to be played. ASlso add a SetFramePositionUpdateInterval method to get it to be generated at intervals.
This commit is contained in:
+47
-3
@@ -97,6 +97,16 @@ void dbus_metadata_watcher(struct metadata_bundle *argc, __attribute__((unused))
|
||||
}
|
||||
}
|
||||
|
||||
if (argc->frame_position_string) {
|
||||
// debug(1, "Check frame position string");
|
||||
th = shairport_sync_get_frame_position(shairportSyncSkeleton);
|
||||
if ((th == NULL) || (strcasecmp(th, argc->frame_position_string) != 0)) {
|
||||
// debug(1, "Frame position string should be changed");
|
||||
shairport_sync_set_frame_position(shairportSyncSkeleton,
|
||||
argc->frame_position_string);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc->stream_type) {
|
||||
// debug(1, "Check stream type");
|
||||
th = shairport_sync_remote_control_get_stream_type(shairportSyncRemoteControlSkeleton);
|
||||
@@ -243,7 +253,7 @@ void dbus_metadata_watcher(struct metadata_bundle *argc, __attribute__((unused))
|
||||
g_variant_builder_add(dict_builder, "{sv}", "xesam:album", album_name);
|
||||
}
|
||||
|
||||
// Add the artist name if it exists
|
||||
// Add the artist name list if it exists
|
||||
if (argc->artist_name) {
|
||||
GVariantBuilder *artist_as = g_variant_builder_new(G_VARIANT_TYPE("as"));
|
||||
g_variant_builder_add(artist_as, "s", argc->artist_name);
|
||||
@@ -252,7 +262,25 @@ void dbus_metadata_watcher(struct metadata_bundle *argc, __attribute__((unused))
|
||||
g_variant_builder_add(dict_builder, "{sv}", "xesam:artist", artists);
|
||||
}
|
||||
|
||||
// Add the genre if it exists
|
||||
// Add the album artist list if it exists
|
||||
if (argc->album_artist_name) {
|
||||
GVariantBuilder *album_artist_as = g_variant_builder_new(G_VARIANT_TYPE("as"));
|
||||
g_variant_builder_add(album_artist_as, "s", argc->album_artist_name);
|
||||
GVariant *album_artists = g_variant_builder_end(album_artist_as);
|
||||
g_variant_builder_unref(album_artist_as);
|
||||
g_variant_builder_add(dict_builder, "{sv}", "xesam:albumArtist", album_artists);
|
||||
}
|
||||
|
||||
// Add the composer list if it exists
|
||||
if (argc->composer) {
|
||||
GVariantBuilder *composer_as = g_variant_builder_new(G_VARIANT_TYPE("as"));
|
||||
g_variant_builder_add(composer_as, "s", argc->composer);
|
||||
GVariant *composers = g_variant_builder_end(composer_as);
|
||||
g_variant_builder_unref(composer_as);
|
||||
g_variant_builder_add(dict_builder, "{sv}", "xesam:composer", composers);
|
||||
}
|
||||
|
||||
// Add the genre list if it exists
|
||||
if (argc->genre) {
|
||||
GVariantBuilder *genre_as = g_variant_builder_new(G_VARIANT_TYPE("as"));
|
||||
g_variant_builder_add(genre_as, "s", argc->genre);
|
||||
@@ -835,6 +863,18 @@ static gboolean on_handle_drop_session(ShairportSync *skeleton, GDBusMethodInvoc
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean on_handle_set_frame_position_update_interval(ShairportSync *skeleton,
|
||||
GDBusMethodInvocation *invocation,
|
||||
const gdouble seconds,
|
||||
__attribute__((unused)) gpointer user_data) {
|
||||
debug(1, ">> set frame position update interval to %.6f.", seconds);
|
||||
config.metadata_progress_interval = seconds;
|
||||
shairport_sync_complete_set_frame_position_update_interval(skeleton, invocation);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name,
|
||||
__attribute__((unused)) gpointer user_data) {
|
||||
|
||||
@@ -893,6 +933,10 @@ static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name
|
||||
g_signal_connect(shairportSyncSkeleton, "handle-drop-session", G_CALLBACK(on_handle_drop_session),
|
||||
NULL);
|
||||
|
||||
g_signal_connect(shairportSyncSkeleton, "handle-set-frame-position-update-interval",
|
||||
G_CALLBACK(on_handle_set_frame_position_update_interval),
|
||||
NULL);
|
||||
|
||||
g_signal_connect(shairportSyncDiagnosticsSkeleton, "notify::verbosity",
|
||||
G_CALLBACK(notify_verbosity_callback), NULL);
|
||||
|
||||
@@ -952,7 +996,7 @@ static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name
|
||||
config.loudness_reference_volume_db);
|
||||
shairport_sync_set_drift_tolerance(SHAIRPORT_SYNC(shairportSyncSkeleton), config.tolerance);
|
||||
shairport_sync_set_volume(SHAIRPORT_SYNC(shairportSyncSkeleton), config.airplay_volume);
|
||||
|
||||
|
||||
#ifdef CONFIG_APPLE_ALAC
|
||||
if (config.use_apple_decoder == 0) {
|
||||
shairport_sync_set_alacdecoder(SHAIRPORT_SYNC(shairportSyncSkeleton), "hammerton");
|
||||
|
||||
Reference in New Issue
Block a user