diff options
-rw-r--r-- | src/modules/module-session-manager/client-endpoint/endpoint.c | 10 | ||||
-rw-r--r-- | src/modules/module-session-manager/client-session/session.c | 10 | ||||
-rw-r--r-- | src/pipewire/impl-client.c | 9 | ||||
-rw-r--r-- | src/pipewire/impl-core.c | 11 | ||||
-rw-r--r-- | src/pipewire/impl-device.c | 9 | ||||
-rw-r--r-- | src/pipewire/impl-factory.c | 19 | ||||
-rw-r--r-- | src/pipewire/impl-link.c | 16 | ||||
-rw-r--r-- | src/pipewire/impl-node.c | 9 | ||||
-rw-r--r-- | src/pipewire/impl-port.c | 11 |
9 files changed, 32 insertions, 72 deletions
diff --git a/src/modules/module-session-manager/client-endpoint/endpoint.c b/src/modules/module-session-manager/client-endpoint/endpoint.c index 8bb1a160..fe22fbd3 100644 --- a/src/modules/module-session-manager/client-endpoint/endpoint.c +++ b/src/modules/module-session-manager/client-endpoint/endpoint.c @@ -324,16 +324,10 @@ int endpoint_init(struct endpoint *this, this->client_ep = client_ep; this->props = properties; - properties = pw_properties_new(NULL, NULL); - if (!properties) - goto no_mem; - - pw_properties_update_keys(properties, &this->props->dict, keys); - this->global = pw_global_new (context, PW_TYPE_INTERFACE_Endpoint, PW_VERSION_ENDPOINT, - properties, endpoint_bind, this); + NULL, endpoint_bind, this); if (!this->global) goto no_mem; @@ -344,6 +338,8 @@ int endpoint_init(struct endpoint *this, this->info.id = pw_global_get_id(this->global); this->info.props = &this->props->dict; + pw_global_update_keys(this->global, &this->props->dict, keys); + pw_resource_set_bound_id(client_ep->resource, this->info.id); return pw_global_register(this->global); diff --git a/src/modules/module-session-manager/client-session/session.c b/src/modules/module-session-manager/client-session/session.c index 30ca2634..4792531f 100644 --- a/src/modules/module-session-manager/client-session/session.c +++ b/src/modules/module-session-manager/client-session/session.c @@ -286,16 +286,10 @@ int session_init(struct session *this, this->client_sess = client_sess; this->props = properties; - properties = pw_properties_new(NULL, NULL); - if (!properties) - goto no_mem; - - pw_properties_update_keys(properties, &this->props->dict, keys); - this->global = pw_global_new (context, PW_TYPE_INTERFACE_Session, PW_VERSION_SESSION, - properties, session_bind, this); + NULL, session_bind, this); if (!this->global) goto no_mem; @@ -306,6 +300,8 @@ int session_init(struct session *this, this->info.id = pw_global_get_id(this->global); this->info.props = &this->props->dict; + pw_global_update_keys(this->global, &this->props->dict, keys); + pw_resource_set_bound_id(client_sess->resource, this->info.id); return pw_global_register(this->global); diff --git a/src/pipewire/impl-client.c b/src/pipewire/impl-client.c index 8fae0c26..1ff3f7ca 100644 --- a/src/pipewire/impl-client.c +++ b/src/pipewire/impl-client.c @@ -437,13 +437,6 @@ int pw_impl_client_register(struct pw_impl_client *client, pw_log_debug(NAME" %p: register", client); - if (properties == NULL) - properties = pw_properties_new(NULL, NULL); - if (properties == NULL) - return -errno; - - pw_properties_update_keys(properties, &client->properties->dict, keys); - client->global = pw_global_new(context, PW_TYPE_INTERFACE_Client, PW_VERSION_CLIENT, @@ -460,6 +453,8 @@ int pw_impl_client_register(struct pw_impl_client *client, pw_properties_setf(client->properties, PW_KEY_OBJECT_ID, "%d", client->info.id); client->info.props = &client->properties->dict; + pw_global_update_keys(client->global, client->info.props, keys); + pw_impl_client_emit_initialized(client); pw_global_add_listener(client->global, &client->global_listener, &global_events, client); diff --git a/src/pipewire/impl-core.c b/src/pipewire/impl-core.c index 9d3a00e4..41dd7c82 100644 --- a/src/pipewire/impl-core.c +++ b/src/pipewire/impl-core.c @@ -564,13 +564,6 @@ int pw_impl_core_register(struct pw_impl_core *core, if (core->registered) goto error_existed; - if (properties == NULL) - properties = pw_properties_new(NULL, NULL); - if (properties == NULL) - return -errno; - - pw_properties_update_keys(properties, &core->properties->dict, keys); - core->global = pw_global_new(context, PW_TYPE_INTERFACE_Core, PW_VERSION_CORE, @@ -587,16 +580,18 @@ int pw_impl_core_register(struct pw_impl_core *core, pw_properties_setf(core->properties, PW_KEY_OBJECT_ID, "%d", core->info.id); core->info.props = &core->properties->dict; + pw_global_update_keys(core->global, core->info.props, keys); + pw_impl_core_emit_initialized(core); pw_global_add_listener(core->global, &core->global_listener, &global_events, core); pw_global_register(core->global); return 0; + error_existed: res = -EEXIST; goto error_exit; - error_exit: if (properties) pw_properties_free(properties); diff --git a/src/pipewire/impl-device.c b/src/pipewire/impl-device.c index f80e8269..3f7f1d95 100644 --- a/src/pipewire/impl-device.c +++ b/src/pipewire/impl-device.c @@ -479,13 +479,6 @@ int pw_impl_device_register(struct pw_impl_device *device, if (device->registered) goto error_existed; - if (properties == NULL) - properties = pw_properties_new(NULL, NULL); - if (properties == NULL) - return -errno; - - pw_properties_update_keys(properties, &device->properties->dict, keys); - device->global = pw_global_new(context, PW_TYPE_INTERFACE_Device, PW_VERSION_DEVICE, @@ -502,6 +495,8 @@ int pw_impl_device_register(struct pw_impl_device *device, pw_properties_setf(device->properties, PW_KEY_OBJECT_ID, "%d", device->info.id); device->info.props = &device->properties->dict; + pw_global_update_keys(device->global, device->info.props, keys); + pw_impl_device_emit_initialized(device); pw_global_add_listener(device->global, &device->global_listener, &global_events, device); diff --git a/src/pipewire/impl-factory.c b/src/pipewire/impl-factory.c index dd3a7795..b6f80e47 100644 --- a/src/pipewire/impl-factory.c +++ b/src/pipewire/impl-factory.c @@ -176,23 +176,15 @@ int pw_impl_factory_register(struct pw_impl_factory *factory, struct pw_context *context = factory->context; const char *keys[] = { PW_KEY_MODULE_ID, + PW_KEY_FACTORY_NAME, + PW_KEY_FACTORY_TYPE_NAME, + PW_KEY_FACTORY_TYPE_VERSION, NULL }; if (factory->registered) goto error_existed; - if (properties == NULL) - properties = pw_properties_new(NULL, NULL); - if (properties == NULL) - return -errno; - - pw_properties_update_keys(properties, &factory->properties->dict, keys); - - pw_properties_set(properties, PW_KEY_FACTORY_NAME, factory->info.name); - pw_properties_setf(properties, PW_KEY_FACTORY_TYPE_NAME, "%s", factory->info.type); - pw_properties_setf(properties, PW_KEY_FACTORY_TYPE_VERSION, "%d", factory->info.version); - factory->global = pw_global_new(context, PW_TYPE_INTERFACE_Factory, PW_VERSION_FACTORY, @@ -207,8 +199,13 @@ int pw_impl_factory_register(struct pw_impl_factory *factory, factory->info.id = factory->global->id; pw_properties_setf(factory->properties, PW_KEY_OBJECT_ID, "%d", factory->info.id); + pw_properties_set(factory->properties, PW_KEY_FACTORY_NAME, factory->info.name); + pw_properties_setf(factory->properties, PW_KEY_FACTORY_TYPE_NAME, "%s", factory->info.type); + pw_properties_setf(factory->properties, PW_KEY_FACTORY_TYPE_VERSION, "%d", factory->info.version); factory->info.props = &factory->properties->dict; + pw_global_update_keys(factory->global, factory->info.props, keys); + pw_impl_factory_emit_initialized(factory); pw_global_add_listener(factory->global, &factory->global_listener, &global_events, factory); diff --git a/src/pipewire/impl-link.c b/src/pipewire/impl-link.c index 9ea04382..1db6c0bf 100644 --- a/src/pipewire/impl-link.c +++ b/src/pipewire/impl-link.c @@ -1177,17 +1177,14 @@ int pw_impl_link_register(struct pw_impl_link *link, PW_KEY_MODULE_ID, PW_KEY_FACTORY_ID, PW_KEY_CLIENT_ID, + PW_KEY_LINK_OUTPUT_PORT, + PW_KEY_LINK_INPUT_PORT, NULL }; if (link->registered) goto error_existed; - if (properties == NULL) - properties = pw_properties_new(NULL, NULL); - if (properties == NULL) - return -errno; - output_node = link->output->node; input_node = link->input->node; @@ -1196,11 +1193,6 @@ int pw_impl_link_register(struct pw_impl_link *link, link->info.input_node_id = input_node->global->id; link->info.input_port_id = link->input->global->id; - pw_properties_update_keys(properties, &link->properties->dict, keys); - - pw_properties_setf(properties, PW_KEY_LINK_OUTPUT_PORT, "%d", link->info.output_port_id); - pw_properties_setf(properties, PW_KEY_LINK_INPUT_PORT, "%d", link->info.input_port_id); - link->global = pw_global_new(context, PW_TYPE_INTERFACE_Link, PW_VERSION_LINK, @@ -1215,8 +1207,12 @@ int pw_impl_link_register(struct pw_impl_link *link, link->info.id = link->global->id; pw_properties_setf(link->properties, PW_KEY_OBJECT_ID, "%d", link->info.id); + pw_properties_setf(link->properties, PW_KEY_LINK_OUTPUT_PORT, "%d", link->info.output_port_id); + pw_properties_setf(link->properties, PW_KEY_LINK_INPUT_PORT, "%d", link->info.input_port_id); link->info.props = &link->properties->dict; + pw_global_update_keys(link->global, link->info.props, keys); + pw_impl_link_emit_initialized(link); pw_global_add_listener(link->global, &link->global_listener, &global_events, link); diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index 16372102..bf52d636 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -634,13 +634,6 @@ int pw_impl_node_register(struct pw_impl_node *this, if (this->registered) goto error_existed; - if (properties == NULL) - properties = pw_properties_new(NULL, NULL); - if (properties == NULL) - return -errno; - - pw_properties_update_keys(properties, &this->properties->dict, keys); - this->global = pw_global_new(context, PW_TYPE_INTERFACE_Node, PW_VERSION_NODE, @@ -661,6 +654,8 @@ int pw_impl_node_register(struct pw_impl_node *this, pw_properties_setf(this->properties, PW_KEY_OBJECT_ID, "%d", this->info.id); this->info.props = &this->properties->dict; + pw_global_update_keys(this->global, &this->properties->dict, keys); + pw_impl_node_initialized(this); pw_global_add_listener(this->global, &this->global_listener, &global_events, this); diff --git a/src/pipewire/impl-port.c b/src/pipewire/impl-port.c index 1111302a..aad1a2ee 100644 --- a/src/pipewire/impl-port.c +++ b/src/pipewire/impl-port.c @@ -782,6 +782,7 @@ int pw_impl_port_register(struct pw_impl_port *port, const char *keys[] = { PW_KEY_OBJECT_PATH, PW_KEY_FORMAT_DSP, + PW_KEY_NODE_ID, PW_KEY_AUDIO_CHANNEL, PW_KEY_PORT_NAME, PW_KEY_PORT_DIRECTION, @@ -795,14 +796,6 @@ int pw_impl_port_register(struct pw_impl_port *port, if (node == NULL || node->global == NULL) return -EIO; - if (properties == NULL) - properties = pw_properties_new(NULL, NULL); - if (properties == NULL) - return -errno; - - pw_properties_setf(properties, PW_KEY_NODE_ID, "%d", node->global->id); - pw_properties_update_keys(properties, &port->properties->dict, keys); - port->global = pw_global_new(node->context, PW_TYPE_INTERFACE_Port, PW_VERSION_PORT, @@ -819,6 +812,8 @@ int pw_impl_port_register(struct pw_impl_port *port, pw_properties_setf(port->properties, PW_KEY_OBJECT_ID, "%d", port->info.id); port->info.props = &port->properties->dict; + pw_global_update_keys(port->global, &port->properties->dict, keys); + pw_impl_port_emit_initialized(port); return pw_global_register(port->global); |