This will make it easier for testers to report latency offset for their
specific hardware.

Also, remove the IP:port part from the device description; it will go
in the pa_device_port description in the next commit.
-- 
Colin
From a93c8e7a66f10d586f44001ab8c321bb105312ab Mon Sep 17 00:00:00 2001
From: Colin Leroy <[email protected]>
Date: Sat, 7 Oct 2017 20:04:42 +0200
Subject: [PATCH 1/3] RAOP: Show device codename in sink properties

This will make it easier for testers to report latency offset for their
specific hardware.

Also, remove the IP:port part from the device description; it will go
in the pa_device_port description in the next commit.
---
 src/modules/raop/module-raop-discover.c | 39 +++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/src/modules/raop/module-raop-discover.c b/src/modules/raop/module-raop-discover.c
index 8b7ba49b..7fe17dfe 100644
--- a/src/modules/raop/module-raop-discover.c
+++ b/src/modules/raop/module-raop-discover.c
@@ -165,6 +165,7 @@ static void resolver_cb(
     char *device = NULL, *nicename, *dname, *vname, *args;
     char *tp = NULL, *et = NULL, *cn = NULL;
     char *ch = NULL, *ss = NULL, *sr = NULL;
+    char *dm = NULL;
     char *t = NULL;
     char at[AVAHI_ADDRESS_STR_MAX];
     AvahiStringList *l;
@@ -253,7 +254,8 @@ static void resolver_cb(
             sr = pa_xstrdup(value);
         } else if (pa_streq(key, "am")) {
             /* Device model */
-            latency = guess_latency_from_device(value);
+            pa_xfree(dm);
+            dm = pa_xstrdup(value);
         }
 
         avahi_free(key);
@@ -275,6 +277,7 @@ static void resolver_cb(
         pa_xfree(ch);
         pa_xfree(ss);
         pa_xfree(sr);
+        pa_xfree(dm);
         goto finish;
     }
 
@@ -282,22 +285,24 @@ static void resolver_cb(
     pa_xfree(dname);
 
     avahi_address_snprint(at, sizeof(at), a);
-    if (nicename) {
-        args = pa_sprintf_malloc("server=[%s]:%u "
-                                 "sink_name=%s "
-                                 "sink_properties='device.description=\"%s (%s:%u)\"'",
-                                 at, port,
-                                 vname,
-                                 nicename, at, port);
-        pa_xfree(nicename);
-    } else {
-        args = pa_sprintf_malloc("server=[%s]:%u "
-                                 "sink_name=%s"
-                                 "sink_properties='device.description=\"%s:%u\"'",
-                                 at, port,
-                                 vname,
-                                 at, port);
-    }
+
+    if (nicename == NULL)
+        nicename = pa_xstrdup("RAOP");
+
+    if (dm == NULL)
+        dm = pa_xstrdup(_("Unknown device model"));
+
+    latency = guess_latency_from_device(dm);
+
+    args = pa_sprintf_malloc("server=[%s]:%u "
+                             "sink_name=%s "
+                             "sink_properties='device.description=\"%s\" device.model=\"%s\"'",
+                             at, port,
+                             vname,
+                             nicename,
+                             dm);
+    pa_xfree(nicename);
+    pa_xfree(dm);
 
     if (tp != NULL) {
         t = args;
-- 
2.11.0

Attachment: pgpjSUcp8AeK_.pgp
Description: OpenPGP digital signature

_______________________________________________
pulseaudio-discuss mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to