<div dir="ltr"><div class="gmail_extra">Hello,</div><div class="gmail_extra"><br><div class="gmail_quote">2016-08-31 23:35 GMT+02:00 Tanu Kaskinen <span dir="ltr"><<a href="mailto:tanuk@iki.fi" target="_blank">tanuk@iki.fi</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, 2016-08-31 at 18:14 +0200, Sylvain Baubeau wrote:<br>
> systemd-hostnamed provides an icon for the machine it is running on.<br>
> If it is running, module-zeroconf-publish uses this icon for the<br>
> 'icon-name' attribute in the Avahi properties. module-zeroconf-discover<br>
> passes this icon to module-tunnel using the module parameter<br>
> {sink/source}_properties.<br>
><br>
> This allows to display a portable, desktop or phone instead of<br>
> the generic sound card icon.<br>
> ---<br>
>  src/Makefile.am                        |  4 +-<br>
>  src/modules/module-zeroconf-<wbr>discover.c |  9 ++++<br>
>  src/modules/module-zeroconf-<wbr>publish.c  | 79 ++++++++++++++++++++++++++++++<wbr>+++-<br>
>  3 files changed, 88 insertions(+), 4 deletions(-)<br>
><br>
> diff --git a/src/Makefile.am b/src/Makefile.am<br>
> index 7b19497..2d5bdd4 100644<br>
> --- a/src/Makefile.am<br>
> +++ b/src/Makefile.am<br>
> @@ -1899,8 +1899,8 @@ module_solaris_la_LIBADD = $(MODULE_LIBADD)<br>
><br>
>  module_zeroconf_publish_la_<wbr>SOURCES = modules/module-zeroconf-<wbr>publish.c<br>
>  module_zeroconf_publish_la_<wbr>LDFLAGS = $(MODULE_LDFLAGS)<br>
> -module_zeroconf_publish_la_<wbr>LIBADD = $(MODULE_LIBADD) $(AVAHI_LIBS) <a href="http://libavahi-wrap.la" rel="noreferrer" target="_blank">libavahi-wrap.la</a> <a href="http://libprotocol-native.la" rel="noreferrer" target="_blank">libprotocol-native.la</a><br>
> -module_zeroconf_publish_la_<wbr>CFLAGS = $(AM_CFLAGS) $(AVAHI_CFLAGS)<br>
> +module_zeroconf_publish_la_<wbr>LIBADD = $(MODULE_LIBADD) $(AVAHI_LIBS) $(DBUS_LIBS) <a href="http://libavahi-wrap.la" rel="noreferrer" target="_blank">libavahi-wrap.la</a> <a href="http://libprotocol-native.la" rel="noreferrer" target="_blank">libprotocol-native.la</a><br>
> +module_zeroconf_publish_la_<wbr>CFLAGS = $(AM_CFLAGS) $(AVAHI_CFLAGS) $(DBUS_CFLAGS)<br>
<br>
Sorry for not realizing this already with the first version, but the D-<br>
Bus functionality needs to be disabled if D-Bus support is not enabled.<br></blockquote><div><br></div><div>Done.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> +static char *get_icon_name(pa_module*m) {<br>
> +    const char *interface = HOSTNAME_DBUS_INTERFACE;<br>
> +    const char *property = HOSTNAME_DBUS_ICON_PROPERTY;<br>
> +    char *icon_name;<br>
> +    pa_dbus_connection *bus;<br>
> +    DBusError error;<br>
> +    DBusMessageIter args;<br>
> +    DBusMessage *msg = NULL;<br>
> +    DBusMessage *reply = NULL;<br>
> +    DBusConnection *conn = NULL;<br>
> +    DBusMessageIter sub;<br>
> +<br>
> +    if (!(bus = pa_dbus_bus_get(m->core, DBUS_BUS_SYSTEM, &error))) {<br>
> +        pa_log("Failed to get system bus connection: %s", error.message);<br>
> +        goto out;<br>
> +    }<br>
> +<br>
> +    conn = pa_dbus_connection_get(bus);<br>
> +<br>
> +    msg = dbus_message_new_method_call(<wbr>HOSTNAME_DBUS_INTERFACE,<br>
> +                                       HOSTNAME_DBUS_PATH,<br>
> +                                       "org.freedesktop.DBus.<wbr>Properties",<br>
> +                                       "Get");<br>
> +    dbus_message_append_args(msg, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &property, DBUS_TYPE_INVALID);<br>
> +<br>
> +    dbus_error_init(&error);<br>
> +    if ((reply = dbus_connection_send_with_<wbr>reply_and_block(conn, msg, -1, &error)) == NULL) {<br>
> +        pa_log("Failed to send: %s:%s\n", <a href="http://error.name" rel="noreferrer" target="_blank">error.name</a>, error.message);<br>
<br>
No need for \n.<br></blockquote><div><br></div><div>Done</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> +        dbus_error_free(&error);<br>
> +        goto out;<br>
> +    }<br>
> +<br>
> +    dbus_message_iter_init(reply, &args);<br>
> +    if (dbus_message_iter_get_arg_<wbr>type(&args) != DBUS_TYPE_VARIANT) {<br>
> +        pa_log("Incorrect reply type\n");<br>
<br>
No need for \n.<br></blockquote><div><br></div><div>Done</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> +        goto out;<br>
> +    }<br>
> +<br>
> +    dbus_message_iter_recurse(&<wbr>args, &sub);<br>
> +<br>
> +    if (dbus_message_iter_get_arg_<wbr>type(&sub) != DBUS_TYPE_STRING) {<br>
> +        pa_log("Incorrect value type\n");<br>
<br>
No need for \n.<br></blockquote><div><br></div><div>Done</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
-- <br>
Tanu<br>
______________________________<wbr>_________________<br>
pulseaudio-discuss mailing list<br>
<a href="mailto:pulseaudio-discuss@lists.freedesktop.org">pulseaudio-discuss@lists.<wbr>freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/pulseaudio-<wbr>discuss</a><br>
</font></span></blockquote></div><br></div></div>