]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Look for DACP-ID and Active-Remote in the GET /info request, where it sometimes appea...
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Mon, 25 Mar 2024 20:28:11 +0000 (20:28 +0000)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Mon, 25 Mar 2024 20:28:11 +0000 (20:28 +0000)
rtsp.c

diff --git a/rtsp.c b/rtsp.c
index 3d6c5f48b634f68c5545eb336b6a0326c1111af1..6fe5ff682de261df2ffe4cb2dc4a388aec686dbb 100644 (file)
--- a/rtsp.c
+++ b/rtsp.c
@@ -1688,6 +1688,47 @@ void handle_get_info(__attribute((unused)) rtsp_conn_info *conn, rtsp_message *r
               hdr);
       }
     }
+    
+    // In Stage 1, look for the DACP and Active-Remote
+    char *ar = msg_get_header(req, "Active-Remote");
+    if (ar) {
+      debug(3, "Connection %d: GET /info -- Active-Remote string seen: \"%s\".",
+            conn->connection_number, ar);
+      // get the active remote
+      if (conn->dacp_active_remote) // this is in case SETUP was previously called
+        free(conn->dacp_active_remote);
+      conn->dacp_active_remote = strdup(ar);
+#ifdef CONFIG_METADATA
+      send_metadata('ssnc', 'acre', ar, strlen(ar), req, 1);
+#endif
+    } else {
+      debug(3, "Connection %d: GET /info -- doesn't include  Active-Remote information.",
+            conn->connection_number);
+      if (conn->dacp_active_remote) { // this is in case GET /info was previously called
+        free(conn->dacp_active_remote);
+        conn->dacp_active_remote = NULL;
+      }
+    }
+
+    ar = msg_get_header(req, "DACP-ID");
+    if (ar) {
+      debug(3, "Connection %d: GET /info -- DACP-ID string seen: \"%s\".", conn->connection_number,
+            ar);
+      if (conn->dacp_id) // this is in case SETUP was previously called
+        free(conn->dacp_id);
+      conn->dacp_id = strdup(ar);
+#ifdef CONFIG_METADATA
+      send_metadata('ssnc', 'daid', ar, strlen(ar), req, 1);
+#endif
+    } else {
+      debug(3, "Connection %d: GET /info -- doesn't include DACP-ID string information.",
+            conn->connection_number);
+      if (conn->dacp_id) { // this is in case GET /info was previously called
+        free(conn->dacp_id);
+        conn->dacp_id = NULL;
+      }
+    }
+
     plist_t info_plist = NULL;
     plist_from_memory(req->content, req->contentlength, &info_plist);