diff options
author | Wim Taymans <wtaymans@redhat.com> | 2019-07-15 17:16:08 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2019-07-15 17:16:08 +0200 |
commit | 01d9f4eb3a9f902e0ee09983c0fd56fa741d9180 (patch) | |
tree | 4587e98cdd7daaf9c87e84930a8eb3c20f1c73f8 /src | |
parent | 0a6ee190182ef3fcc353334b62cee6fc56eac4af (diff) |
module-adapter: make it possible to pass the slave node pointer
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/module-adapter.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/src/modules/module-adapter.c b/src/modules/module-adapter.c index 18dcbee2..285d7f67 100644 --- a/src/modules/module-adapter.c +++ b/src/modules/module-adapter.c @@ -101,27 +101,37 @@ static void *create_object(void *_data, struct factory_data *d = _data; struct pw_client *client; struct pw_node *adapter, *slave; - const char *factory_name; + const char *str, *factory_name; int res; struct node_data *nd; if (properties == NULL) goto error_properties; - factory_name = pw_properties_get(properties, SPA_KEY_FACTORY_NAME); - if (factory_name == NULL) - 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; - slave = pw_spa_node_load(d->core, - NULL, - pw_factory_get_global(d->this), - factory_name, - "slave-node", - PW_SPA_NODE_FLAG_ACTIVATE | - PW_SPA_NODE_FLAG_NO_REGISTER, - pw_properties_copy(properties), 0); - if (slave == NULL) - goto error_no_mem; + pw_properties_setf(properties, "audio.adapt.slave", "pointer:%p", slave); + } + if (slave == NULL) { + factory_name = pw_properties_get(properties, SPA_KEY_FACTORY_NAME); + if (factory_name == NULL) + goto error_properties; + + slave = pw_spa_node_load(d->core, + NULL, + pw_factory_get_global(d->this), + factory_name, + "slave-node", + PW_SPA_NODE_FLAG_ACTIVATE | + PW_SPA_NODE_FLAG_NO_REGISTER, + pw_properties_copy(properties), 0); + if (slave == NULL) + goto error_no_mem; + } adapter = pw_adapter_new(pw_module_get_core(d->module), slave, |