[pulseaudio-discuss] [PATCH] RAOP: Show device codename in sink description

Tanu Kaskinen tanuk at iki.fi
Sat Oct 7 13:37:39 UTC 2017


On Thu, 2017-10-05 at 23:34 +0200, Colin Leroy wrote:
> From 4ee8ecffad804f48ba38984299fc0a3289d56941 Mon Sep 17 00:00:00 2001
> From: Colin Leroy <colin at colino.net>
> Date: Thu, 5 Oct 2017 21:21:48 +0200
> Subject: [PATCH] RAOP: Show device codename in sink description
> 
> This will make it easier for testers to report latency offset for their
> specific hardware.
> ---
>  src/modules/raop/module-raop-discover.c | 38 +++++++++++++++++++--------------
>  1 file changed, 22 insertions(+), 16 deletions(-)
> 
> diff --git a/src/modules/raop/module-raop-discover.c b/src/modules/raop/module-raop-discover.c
> index 8b7ba49b..0a258785 100644
> --- a/src/modules/raop/module-raop-discover.c
> +++ b/src/modules/raop/module-raop-discover.c
> @@ -253,13 +253,28 @@ static void resolver_cb(
>              sr = pa_xstrdup(value);
>          } else if (pa_streq(key, "am")) {
>              /* Device model */
> +            char *internal_name;
>              latency = guess_latency_from_device(value);
> +
> +            internal_name = pa_escape(value, "\"'");
> +
> +            if (nicename == NULL) {
> +                nicename = pa_xstrdup(internal_name);
> +            } else {
> +                t = nicename;
> +                nicename = pa_sprintf_malloc("%s (%s)", nicename, internal_name);
> +                pa_xfree(t);
> +            }
> +            pa_xfree(internal_name);
>          }
>  
>          avahi_free(key);
>          avahi_free(value);
>      }
>  
> +    if (nicename == NULL)
> +        nicename = pa_xstrdup("RAOP");
> +
>      if (device)
>          dname = pa_sprintf_malloc("raop_output.%s.%s", host_name, device);
>      else
> @@ -282,22 +297,13 @@ 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);
> -    }
> +    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);
>  
>      if (tp != NULL) {
>          t = args;

I don't think it's good to ram a lot of information into the device
description. Or do you like to see "PIONEER,1" appear in whatever GUI
you're using to configure your audio? Wouldn't it be better to have a
separate property for that? The information would be hidden in everyday
use, but "pactl list sinks" would show it. Having the server address in
the description seems like unnecessary noise too. That could be put in
a separate property as well.

-- 
Tanu

https://www.patreon.com/tanuk


More information about the pulseaudio-discuss mailing list