mixer: also install mixer on new nodes

This commit is contained in:
Wim Taymans 2018-01-18 12:49:01 +01:00
parent d50037c2f7
commit a8fa4383a1

View file

@ -37,6 +37,7 @@ struct impl {
struct pw_core *core;
struct pw_type *t;
struct pw_module *module;
struct spa_hook core_listener;
struct spa_hook module_listener;
struct pw_properties *properties;
@ -185,6 +186,7 @@ static void module_destroy(void *data)
struct node_data *nd, *t;
spa_hook_remove(&impl->module_listener);
spa_hook_remove(&impl->core_listener);
spa_list_for_each_safe(nd, t, &impl->node_list, link)
pw_node_destroy(nd->node);
@ -200,6 +202,17 @@ static const struct pw_module_events module_events = {
.destroy = module_destroy,
};
static void
core_global_added(void *data, struct pw_global *global)
{
on_global(data, global);
}
static const struct pw_core_events core_events = {
PW_VERSION_CORE_EVENTS,
.global_added = core_global_added,
};
static int module_init(struct pw_module *module, struct pw_properties *properties)
{
struct pw_core *core = pw_module_get_core(module);
@ -222,6 +235,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie
pw_core_for_each_global(core, on_global, impl);
pw_core_add_listener(core, &impl->core_listener, &core_events, impl);
pw_module_add_listener(module, &impl->module_listener, &module_events, impl);
return 0;