#include <avahi-common/malloc.h>
#include <pulse/xmalloc.h>
-#include <pulse/util.h>
-#include <pulsecore/sink.h>
-#include <pulsecore/source.h>
-#include <pulsecore/native-common.h>
#include <pulsecore/core-util.h>
#include <pulsecore/log.h>
-#include <pulsecore/core-subscribe.h>
#include <pulsecore/hashmap.h>
#include <pulsecore/modargs.h>
#include <pulsecore/namereg.h>
PA_MODULE_AUTHOR("Colin Guthrie");
PA_MODULE_DESCRIPTION("mDNS/DNS-SD Service Discovery of RAOP devices");
PA_MODULE_VERSION(PACKAGE_VERSION);
-PA_MODULE_LOAD_ONCE(TRUE);
+PA_MODULE_LOAD_ONCE(true);
#define SERVICE_TYPE_SINK "_raop._tcp"
++nicename;
if (strlen(nicename) > 0) {
pa_log_debug("Found RAOP: %s", nicename);
- }
+ nicename = pa_escape(nicename, "\"'");
+ } else
+ nicename = NULL;
}
for (l = txt; l; l = l->next) {
pa_assert_se(avahi_string_list_get_pair(l, &key, &value, NULL) == 0);
pa_log_debug("Found key: '%s' with value: '%s'", key, value);
- if (strcmp(key, "device") == 0) {
+ if (pa_streq(key, "device")) {
pa_xfree(device);
device = value;
value = NULL;
}
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,
- vname);*/
if (nicename) {
- args = pa_sprintf_malloc("server=%s "
+ args = pa_sprintf_malloc("server=[%s]:%u "
"sink_name=%s "
- "description=\"%s\"",
- avahi_address_snprint(at, sizeof(at), a),
+ "sink_properties='device.description=\"%s\"'",
+ avahi_address_snprint(at, sizeof(at), a), port,
vname,
nicename);
-
+ pa_xfree(nicename);
} else {
- args = pa_sprintf_malloc("server=%s "
+ args = pa_sprintf_malloc("server=[%s]:%u "
"sink_name=%s",
- avahi_address_snprint(at, sizeof(at), a),
+ avahi_address_snprint(at, sizeof(at), a), port,
vname);
}
struct tunnel *t2;
if ((t2 = pa_hashmap_get(u->tunnels, t))) {
- pa_module_unload_by_index(u->core, t2->module_index, TRUE);
+ pa_module_unload_request_by_index(u->core, t2->module_index, true);
pa_hashmap_remove(u->tunnels, t2);
tunnel_free(t2);
}
browser_cb, u))) {
pa_log("avahi_service_browser_new() failed: %s", avahi_strerror(avahi_client_errno(c)));
- pa_module_unload_request(u->module, TRUE);
+ pa_module_unload_request(u->module, true);
}
}
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, TRUE);
+ pa_module_unload_request(u->module, true);
}
}
struct tunnel *t;
while ((t = pa_hashmap_steal_first(u->tunnels))) {
- pa_module_unload_by_index(u->core, t->module_index, TRUE);
+ pa_module_unload_request_by_index(u->core, t->module_index, true);
tunnel_free(t);
}
- pa_hashmap_free(u->tunnels, NULL, NULL);
+ pa_hashmap_free(u->tunnels);
}
pa_xfree(u);