mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
improve properties on objects
This commit is contained in:
parent
9c4e5f4e27
commit
6e0c279bc1
7 changed files with 56 additions and 10 deletions
|
|
@ -85,6 +85,7 @@ static void *create_object(void *_data,
|
|||
struct pw_device *device;
|
||||
const char *factory_name;
|
||||
struct device_data *nd;
|
||||
struct pw_client *client;
|
||||
int res;
|
||||
|
||||
if (properties == NULL)
|
||||
|
|
@ -94,6 +95,16 @@ static void *create_object(void *_data,
|
|||
if (factory_name == NULL)
|
||||
goto error_properties;
|
||||
|
||||
pw_properties_setf(properties, PW_KEY_FACTORY_ID, "%d",
|
||||
pw_global_get_id(pw_factory_get_global(data->this)));
|
||||
|
||||
client = resource ? pw_resource_get_client(resource) : NULL;
|
||||
|
||||
if (client) {
|
||||
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d",
|
||||
pw_global_get_id(pw_client_get_global(client)));
|
||||
}
|
||||
|
||||
device = pw_spa_device_load(core,
|
||||
factory_name,
|
||||
0,
|
||||
|
|
@ -110,12 +121,12 @@ static void *create_object(void *_data,
|
|||
|
||||
pw_device_add_listener(device, &nd->device_listener, &device_events, nd);
|
||||
|
||||
if (resource)
|
||||
if (client) {
|
||||
pw_global_bind(pw_device_get_global(device),
|
||||
pw_resource_get_client(resource),
|
||||
PW_PERM_RWX,
|
||||
version, new_id);
|
||||
|
||||
client,
|
||||
PW_PERM_RWX, version,
|
||||
new_id);
|
||||
}
|
||||
return device;
|
||||
|
||||
error_properties:
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ static void *create_object(void *_data,
|
|||
const char *factory_name;
|
||||
struct node_data *nd;
|
||||
int res;
|
||||
struct pw_client *client;
|
||||
|
||||
if (properties == NULL)
|
||||
goto error_properties;
|
||||
|
|
@ -112,9 +113,16 @@ static void *create_object(void *_data,
|
|||
if (factory_name == NULL)
|
||||
goto error_properties;
|
||||
|
||||
client = resource ? pw_resource_get_client(resource) : NULL;
|
||||
|
||||
pw_properties_setf(properties, PW_KEY_FACTORY_ID, "%d",
|
||||
pw_global_get_id(pw_factory_get_global(data->this)));
|
||||
|
||||
if (client) {
|
||||
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d",
|
||||
pw_global_get_id(pw_client_get_global(client)));
|
||||
}
|
||||
|
||||
node = pw_spa_node_load(core,
|
||||
factory_name,
|
||||
PW_SPA_NODE_FLAG_ACTIVATE,
|
||||
|
|
@ -130,9 +138,8 @@ static void *create_object(void *_data,
|
|||
|
||||
pw_node_add_listener(node, &nd->node_listener, &node_events, nd);
|
||||
|
||||
if (resource) {
|
||||
if (client) {
|
||||
struct pw_resource *bound_resource;
|
||||
struct pw_client *client = pw_resource_get_client(resource);
|
||||
|
||||
res = pw_global_bind(pw_node_get_global(node),
|
||||
client,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue