X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmodules%2Fmodule-raop-discover.c;h=eaeb77fc30e28b88b39b44efdfa9bdc37933ee21;hb=62db10c952232af76a7158ff20761c30f68a5c13;hp=7f89bb5c3ecb765ec3b83a7a7ef24b2f69ae684a;hpb=0ff75aea053cb8a7af958aa72d99b27cc90becf6;p=profile%2Fivi%2Fpulseaudio-panda.git diff --git a/src/modules/module-raop-discover.c b/src/modules/module-raop-discover.c index 7f89bb5..eaeb77f 100644 --- a/src/modules/module-raop-discover.c +++ b/src/modules/module-raop-discover.c @@ -1,5 +1,3 @@ -/* $Id$ */ - /*** This file is part of PulseAudio. @@ -8,7 +6,7 @@ PulseAudio is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2 of the + published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. PulseAudio is distributed in the hope that it will be useful, but @@ -55,7 +53,7 @@ #include "module-raop-discover-symdef.h" PA_MODULE_AUTHOR("Colin Guthrie"); -PA_MODULE_DESCRIPTION("mDNS/DNS-SD Service Discovery of Airtunes"); +PA_MODULE_DESCRIPTION("mDNS/DNS-SD Service Discovery of RAOP devices"); PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_LOAD_ONCE(TRUE); @@ -154,11 +152,18 @@ static void resolver_cb( if (event != AVAHI_RESOLVER_FOUND) pa_log("Resolving of '%s' failed: %s", name, avahi_strerror(avahi_client_errno(u->client))); else { - char *device = NULL, *dname, *args; + char *device = NULL, *nicename, *dname, *vname, *args; char at[AVAHI_ADDRESS_STR_MAX]; AvahiStringList *l; pa_module *m; + if ((nicename = strstr(name, "@"))) { + ++nicename; + if (strlen(nicename) > 0) { + pa_log_debug("Found RAOP: %s", nicename); + } + } + for (l = txt; l; l = l->next) { char *key, *value; pa_assert_se(avahi_string_list_get_pair(l, &key, &value, NULL) == 0); @@ -174,27 +179,38 @@ static void resolver_cb( } if (device) - dname = pa_sprintf_malloc("airtunes.%s.%s", host_name, device); + dname = pa_sprintf_malloc("raop.%s.%s", host_name, device); else - dname = pa_sprintf_malloc("airtunes.%s", host_name); + dname = pa_sprintf_malloc("raop.%s", host_name); - if (!pa_namereg_is_valid_name(dname)) { - pa_log("Cannot construct valid device name from credentials of service '%s'.", dname); + if (!(vname = pa_namereg_make_valid_name(dname))) { + pa_log("Cannot construct valid device name from '%s'.", dname); avahi_free(device); pa_xfree(dname); goto finish; } + pa_xfree(dname); /* TODO: allow this syntax of server name in things.... args = pa_sprintf_malloc("server=[%s]:%u " "sink_name=%s", avahi_address_snprint(at, sizeof(at), a), port, - dname);*/ - args = pa_sprintf_malloc("server=%s " - "sink_name=%s", - avahi_address_snprint(at, sizeof(at), a), - dname); + vname);*/ + if (nicename) { + args = pa_sprintf_malloc("server=%s " + "sink_name=%s " + "description=\"%s\"", + avahi_address_snprint(at, sizeof(at), a), + vname, + nicename); + + } else { + args = pa_sprintf_malloc("server=%s " + "sink_name=%s", + avahi_address_snprint(at, sizeof(at), a), + vname); + } pa_log_debug("Loading module-raop-sink with arguments '%s'", args); @@ -204,7 +220,7 @@ static void resolver_cb( tnl = NULL; } - pa_xfree(dname); + pa_xfree(vname); pa_xfree(args); avahi_free(device); } @@ -242,14 +258,14 @@ static void browser_cb( pa_log("avahi_service_resolver_new() failed: %s", avahi_strerror(avahi_client_errno(u->client))); /* We ignore the returned resolver object here, since the we don't - * need to attach any special data to it, and we can still destory + * need to attach any special data to it, and we can still destroy * it from the callback */ } else if (event == AVAHI_BROWSER_REMOVE) { struct tunnel *t2; if ((t2 = pa_hashmap_get(u->tunnels, t))) { - pa_module_unload_by_index(u->core, t2->module_index); + pa_module_unload_by_index(u->core, t2->module_index, TRUE); pa_hashmap_remove(u->tunnels, t2); tunnel_free(t2); } @@ -282,7 +298,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda browser_cb, u))) { pa_log("avahi_service_browser_new() failed: %s", avahi_strerror(avahi_client_errno(c))); - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); } } @@ -296,7 +312,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda if (!(u->client = avahi_client_new(u->avahi_poll, AVAHI_CLIENT_NO_FAIL, client_callback, u, &error))) { pa_log("avahi_client_new() failed: %s", avahi_strerror(error)); - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); } } @@ -370,7 +386,7 @@ void pa__done(pa_module*m) { struct tunnel *t; while ((t = pa_hashmap_steal_first(u->tunnels))) { - pa_module_unload_by_index(u->core, t->module_index); + pa_module_unload_by_index(u->core, t->module_index, TRUE); tunnel_free(t); }