mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
module-adapter: make it possible to pass the slave node pointer
This commit is contained in:
parent
0a6ee19018
commit
01d9f4eb3a
1 changed files with 24 additions and 14 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue