Add two new metadata items -- the player's service name, e.g. "Den Speakers" and the name of the current client, if any, e.g. "Joe's iPhone".
This commit is contained in:
@@ -68,6 +68,7 @@ void dbus_metadata_watcher(struct metadata_bundle *argc, __attribute__((unused))
|
||||
argc->airplay_volume);
|
||||
|
||||
shairport_sync_remote_control_set_client(shairportSyncRemoteControlSkeleton, argc->client_ip);
|
||||
shairport_sync_remote_control_set_client_name(shairportSyncRemoteControlSkeleton, argc->client_name);
|
||||
|
||||
// although it's a DACP server, the server is in fact, part of the the AirPlay "client" (their
|
||||
// term).
|
||||
@@ -1019,6 +1020,8 @@ static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name
|
||||
// NULL);
|
||||
#endif
|
||||
|
||||
shairport_sync_set_service_name(SHAIRPORT_SYNC(shairportSyncSkeleton), config.service_name);
|
||||
|
||||
#ifdef CONFIG_AIRPLAY_2
|
||||
shairport_sync_set_protocol(SHAIRPORT_SYNC(shairportSyncSkeleton), "AirPlay 2");
|
||||
#else
|
||||
|
||||
@@ -102,6 +102,7 @@ void run_metadata_watchers(void) {
|
||||
// turn off changed flags
|
||||
metadata_store.cover_art_pathname_changed = 0;
|
||||
metadata_store.client_ip_changed = 0;
|
||||
metadata_store.client_name_changed = 0;
|
||||
metadata_store.server_ip_changed = 0;
|
||||
metadata_store.progress_string_changed = 0;
|
||||
metadata_store.item_id_changed = 0;
|
||||
@@ -549,6 +550,14 @@ void metadata_hub_process_metadata(uint32_t type, uint32_t code, char *data, uin
|
||||
}
|
||||
free(cs);
|
||||
break;
|
||||
case 'snam':
|
||||
cs = strndup(data, length);
|
||||
if (string_update(&metadata_store.client_name, &metadata_store.client_name_changed, cs)) {
|
||||
changed = 1;
|
||||
debug(1, "MH Client Name set to: \"%s\"", metadata_store.client_name);
|
||||
}
|
||||
free(cs);
|
||||
break;
|
||||
case 'prgr':
|
||||
cs = strndup(data, length);
|
||||
if (string_update(&metadata_store.progress_string, &metadata_store.progress_string_changed,
|
||||
|
||||
@@ -43,6 +43,9 @@ typedef struct metadata_bundle {
|
||||
// server
|
||||
int client_ip_changed;
|
||||
|
||||
char *client_name; // the name of the client device, if available
|
||||
int client_name_changed;
|
||||
|
||||
char *server_ip; // IP number used by Shairport Sync
|
||||
int server_ip_changed;
|
||||
|
||||
|
||||
@@ -219,6 +219,9 @@ void mqtt_process_metadata(uint32_t type, uint32_t code, char *data, uint32_t le
|
||||
case 'svip':
|
||||
mqtt_publish("server_ip", data, length);
|
||||
break;
|
||||
case 'svna':
|
||||
mqtt_publish("service_name", data, length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<property name="Version" type="s" access="read" />
|
||||
<property name="VersionString" type="s" access="read" />
|
||||
<property name="Protocol" type="s" access="read" />
|
||||
<property name="ServiceName" type="s" access="read" />
|
||||
</interface>
|
||||
<interface name="org.gnome.ShairportSync.Diagnostics">
|
||||
<property name="Verbosity" type="i" access="readwrite" />
|
||||
@@ -49,6 +50,7 @@
|
||||
<property name='PlayerState' type='s' access='read'/>
|
||||
<property name='ProgressString' type='s' access='read'/>
|
||||
<property name='Client' type='s' access='read'/>
|
||||
<property name='ClientName' type='s' access='read'/>
|
||||
<property name='AirplayVolume' type='d' access='read'/>
|
||||
<method name="SetAirplayVolume">
|
||||
<arg name="volume" type="d" direction="in" />
|
||||
|
||||
@@ -2864,6 +2864,7 @@ void handle_setup_2(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp)
|
||||
"and open a TCP port.",
|
||||
conn->connection_number);
|
||||
conn->airplay_stream_category = unspecified_stream_category;
|
||||
|
||||
// figure out what category of stream it is, by looking at the plist
|
||||
plist_t timingProtocol = plist_dict_get_item(messagePlist, "timingProtocol");
|
||||
if (timingProtocol != NULL) {
|
||||
@@ -3669,6 +3670,8 @@ void handle_set_parameter_parameter(rtsp_conn_info *conn, rtsp_message *req,
|
||||
// play session is stopped.
|
||||
// `svip` -- the payload is the IP number of the server, i.e. the player itself.
|
||||
// Can be an IPv4 or an IPv6 number.
|
||||
// `svna` -- the payload is the service name of the player, i.e. the name by
|
||||
// which it is seen in the AirPlay menu.
|
||||
// `disc` -- the payload is the IP number of the client, i.e. the sender of audio.
|
||||
// Can be an IPv4 or an IPv6 number. This is an AirPlay-2-only message.
|
||||
// It is sent when a client has been disconnected.
|
||||
|
||||
@@ -2537,6 +2537,10 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_METADATA
|
||||
send_ssnc_metadata('svna', config.service_name, strlen(config.service_name), 1);
|
||||
#endif
|
||||
|
||||
activity_monitor_start(); // not yet for AP2
|
||||
pthread_create(&rtsp_listener_thread, NULL, &rtsp_listen_loop, NULL);
|
||||
atexit(exit_rtsp_listener);
|
||||
|
||||
Reference in New Issue
Block a user