module-adapter: make it possible to pass the slave node pointer

This commit is contained in:
Wim Taymans 2019-07-15 17:16:08 +02:00
parent 0a6ee19018
commit 01d9f4eb3a

View file

@ -101,13 +101,22 @@ static void *create_object(void *_data,
struct factory_data *d = _data; struct factory_data *d = _data;
struct pw_client *client; struct pw_client *client;
struct pw_node *adapter, *slave; struct pw_node *adapter, *slave;
const char *factory_name; const char *str, *factory_name;
int res; int res;
struct node_data *nd; struct node_data *nd;
if (properties == NULL) if (properties == NULL)
goto error_properties; goto error_properties;
slave = NULL;
str = pw_properties_get(properties, "adapt.slave.node");
if (str != NULL) {
if (sscanf(str, "pointer:%p", &slave) != 1)
goto error_properties;
pw_properties_setf(properties, "audio.adapt.slave", "pointer:%p", slave);
}
if (slave == NULL) {
factory_name = pw_properties_get(properties, SPA_KEY_FACTORY_NAME); factory_name = pw_properties_get(properties, SPA_KEY_FACTORY_NAME);
if (factory_name == NULL) if (factory_name == NULL)
goto error_properties; goto error_properties;
@ -122,6 +131,7 @@ static void *create_object(void *_data,
pw_properties_copy(properties), 0); pw_properties_copy(properties), 0);
if (slave == NULL) if (slave == NULL)
goto error_no_mem; goto error_no_mem;
}
adapter = pw_adapter_new(pw_module_get_core(d->module), adapter = pw_adapter_new(pw_module_get_core(d->module),
slave, slave,