mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
remote: move node export code to client-node module
Make the code to export objects more generic. Make it possible for modules to register a type to export. Make the client-node also able to export plain spa_nodes. Let the remote signal the global of the exported object if any. We can then remote the (unused) remote_id from the proxy.
This commit is contained in:
parent
7ec9de5ac6
commit
31dacd9d6f
20 changed files with 1236 additions and 1055 deletions
|
|
@ -25,6 +25,7 @@ endif
|
|||
|
||||
pipewire_module_client_node = shared_library('pipewire-module-client-node',
|
||||
[ 'module-client-node.c',
|
||||
'module-client-node/remote-node.c',
|
||||
'module-client-node/client-node.c',
|
||||
'module-client-node/client-stream.c',
|
||||
'module-client-node/protocol-native.c',
|
||||
|
|
|
|||
|
|
@ -40,6 +40,11 @@ static const struct spa_dict_item module_props[] = {
|
|||
{ PW_MODULE_PROP_VERSION, PACKAGE_VERSION },
|
||||
};
|
||||
|
||||
struct pw_proxy *pw_remote_node_export(struct pw_remote *remote,
|
||||
uint32_t type, struct pw_properties *props, void *object);
|
||||
struct pw_proxy *pw_remote_spa_node_export(struct pw_remote *remote,
|
||||
uint32_t type, struct pw_properties *props, void *object);
|
||||
|
||||
struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_core *core);
|
||||
|
||||
struct factory_data {
|
||||
|
|
@ -48,6 +53,9 @@ struct factory_data {
|
|||
|
||||
struct pw_module *module;
|
||||
struct spa_hook module_listener;
|
||||
|
||||
struct pw_export_type export_node;
|
||||
struct pw_export_type export_spanode;
|
||||
};
|
||||
|
||||
static void *create_object(void *_data,
|
||||
|
|
@ -103,6 +111,9 @@ static void module_destroy(void *data)
|
|||
if (d->properties)
|
||||
pw_properties_free(d->properties);
|
||||
|
||||
spa_list_remove(&d->export_node.link);
|
||||
spa_list_remove(&d->export_spanode.link);
|
||||
|
||||
pw_factory_destroy(d->this);
|
||||
}
|
||||
|
||||
|
|
@ -141,6 +152,14 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie
|
|||
|
||||
pw_factory_register(factory, NULL, pw_module_get_global(module), NULL);
|
||||
|
||||
data->export_node.type = PW_TYPE_INTERFACE_Node;
|
||||
data->export_node.func = pw_remote_node_export;
|
||||
pw_core_register_export_type(core, &data->export_node);
|
||||
|
||||
data->export_spanode.type = SPA_TYPE_INTERFACE_Node;
|
||||
data->export_spanode.func = pw_remote_spa_node_export;
|
||||
pw_core_register_export_type(core, &data->export_spanode);
|
||||
|
||||
pw_module_add_listener(module, &data->module_listener, &module_events, data);
|
||||
|
||||
pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props));
|
||||
|
|
|
|||
1093
src/modules/module-client-node/remote-node.c
Normal file
1093
src/modules/module-client-node/remote-node.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue