modules: add options to discover local services as well

This makes it possible to discover a local RAOP, pulse or RTP services
and connect to them.

IPv6 addresses need the interface appended to local addresses to
make the connection work.
This commit is contained in:
Wim Taymans 2024-05-15 15:39:27 +02:00
parent d8a32e5272
commit d2ca50399a
3 changed files with 39 additions and 7 deletions

View file

@ -40,6 +40,8 @@
*
* ## Module Options
*
* - `pulse.discover-local` = allow discovery of local services as well.
* false by default.
* - `pulse.latency`: the latency to end-to-end latency in milliseconds to
* maintain (Default 200ms).
*
@ -80,6 +82,7 @@ struct impl {
struct pw_properties *properties;
bool discover_local;
AvahiPoll *avahi_poll;
AvahiClient *client;
AvahiServiceBrowser *sink_browser;
@ -375,7 +378,7 @@ static void browser_cb(AvahiServiceBrowser *b, AvahiIfIndex interface, AvahiProt
struct tunnel_info info;
struct tunnel *t;
if (flags & AVAHI_LOOKUP_RESULT_LOCAL)
if ((flags & AVAHI_LOOKUP_RESULT_LOCAL) && !impl->discover_local)
return;
info = TUNNEL_INFO(.name = name);
@ -519,6 +522,9 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
impl->context = context;
impl->properties = props;
impl->discover_local = pw_properties_get_bool(impl->properties,
"pulse.discover-local", false);
pw_impl_module_add_listener(module, &impl->module_listener, &module_events, impl);
pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props));