From 443a49947efac1b9c0939d17837a6f52c29fa9da Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 11 Dec 2019 11:57:56 +0100 Subject: [PATCH] pw_module -> pw_impl_module --- src/daemon/command.c | 4 +- src/examples/export-spa-device.c | 2 +- src/examples/export-spa.c | 2 +- src/examples/local-v4l2.c | 4 +- src/modules/module-access.c | 12 ++--- src/modules/module-adapter.c | 18 +++---- src/modules/module-client-device.c | 18 +++---- src/modules/module-client-node.c | 18 +++---- src/modules/module-link-factory.c | 18 +++---- src/modules/module-metadata.c | 18 +++---- src/modules/module-protocol-native.c | 14 +++--- src/modules/module-rtkit.c | 12 ++--- src/modules/module-session-manager.c | 10 ++-- .../module-session-manager/client-endpoint.c | 14 +++--- .../module-session-manager/client-endpoint.h | 2 +- .../module-session-manager/client-session.c | 14 +++--- src/modules/spa/module-device-factory.c | 18 +++---- src/modules/spa/module-device.c | 12 ++--- src/modules/spa/module-node-factory.c | 18 +++---- src/modules/spa/module-node.c | 12 ++--- src/pipewire/context.c | 18 +++---- src/pipewire/impl-module.c | 48 +++++++++---------- src/pipewire/impl-module.h | 42 ++++++++-------- src/pipewire/private.h | 12 ++--- src/tools/pipewire-cli.c | 8 ++-- 25 files changed, 184 insertions(+), 184 deletions(-) diff --git a/src/daemon/command.c b/src/daemon/command.c index c555a14d4..eaa0002b4 100644 --- a/src/daemon/command.c +++ b/src/daemon/command.c @@ -177,9 +177,9 @@ no_mem: static int execute_command_module_load(struct pw_command *command, struct pw_context *context, char **err) { - struct pw_module *module; + struct pw_impl_module *module; - module = pw_module_load(context, command->args[1], command->args[2], NULL); + module = pw_impl_module_load(context, command->args[1], command->args[2], NULL); if (module == NULL) { asprintf(err, "could not load module \"%s\": %m", command->args[1]); return -errno; diff --git a/src/examples/export-spa-device.c b/src/examples/export-spa-device.c index cfabfccac..0b7d61bfb 100644 --- a/src/examples/export-spa-device.c +++ b/src/examples/export-spa-device.c @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) data.library = argv[1]; data.factory = argv[2]; - pw_module_load(data.context, "libpipewire-module-spa-device-factory", NULL, NULL); + pw_impl_module_load(data.context, "libpipewire-module-spa-device-factory", NULL, NULL); data.core = pw_context_connect(data.context, NULL, 0); if (data.core == NULL) { diff --git a/src/examples/export-spa.c b/src/examples/export-spa.c index a11012826..18bc44aed 100644 --- a/src/examples/export-spa.c +++ b/src/examples/export-spa.c @@ -150,7 +150,7 @@ int main(int argc, char *argv[]) if (argc > 3) data.path = argv[3]; - pw_module_load(data.context, "libpipewire-module-spa-node-factory", NULL, NULL); + pw_impl_module_load(data.context, "libpipewire-module-spa-node-factory", NULL, NULL); data.core = pw_context_connect(data.context, NULL, 0); if (data.core == NULL) { diff --git a/src/examples/local-v4l2.c b/src/examples/local-v4l2.c index 9f5638a82..dcb521f13 100644 --- a/src/examples/local-v4l2.c +++ b/src/examples/local-v4l2.c @@ -409,8 +409,8 @@ int main(int argc, char *argv[]) spa_hook_list_init(&data.hooks); - pw_module_load(data.context, "libpipewire-module-spa-node-factory", NULL, NULL); - pw_module_load(data.context, "libpipewire-module-link-factory", NULL, NULL); + pw_impl_module_load(data.context, "libpipewire-module-spa-node-factory", NULL, NULL); + pw_impl_module_load(data.context, "libpipewire-module-link-factory", NULL, NULL); if (SDL_Init(SDL_INIT_VIDEO) < 0) { printf("can't initialize SDL: %s\n", SDL_GetError()); diff --git a/src/modules/module-access.c b/src/modules/module-access.c index c8f4a2c02..d7f7cdfcb 100644 --- a/src/modules/module-access.c +++ b/src/modules/module-access.c @@ -208,15 +208,15 @@ static void module_destroy(void *data) free(impl); } -static const struct pw_module_events module_events = { - PW_VERSION_MODULE_EVENTS, +static const struct pw_impl_module_events module_events = { + PW_VERSION_IMPL_MODULE_EVENTS, .destroy = module_destroy, }; SPA_EXPORT -int pipewire__module_init(struct pw_module *module, const char *args) +int pipewire__module_init(struct pw_impl_module *module, const char *args) { - struct pw_context *context = pw_module_get_context(module); + struct pw_context *context = pw_impl_module_get_context(module); struct pw_properties *props; struct impl *impl; @@ -235,9 +235,9 @@ int pipewire__module_init(struct pw_module *module, const char *args) impl->properties = props; pw_context_add_listener(context, &impl->context_listener, &context_events, impl); - pw_module_add_listener(module, &impl->module_listener, &module_events, impl); + pw_impl_module_add_listener(module, &impl->module_listener, &module_events, impl); - pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); + pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); return 0; } diff --git a/src/modules/module-adapter.c b/src/modules/module-adapter.c index 9f0c5ca3f..289869c2a 100644 --- a/src/modules/module-adapter.c +++ b/src/modules/module-adapter.c @@ -56,7 +56,7 @@ struct factory_data { struct spa_list node_list; struct pw_context *context; - struct pw_module *module; + struct pw_impl_module *module; struct spa_hook module_listener; }; @@ -184,7 +184,7 @@ static void *create_object(void *_data, goto error_no_mem; } - adapter = pw_adapter_new(pw_module_get_context(d->module), + adapter = pw_adapter_new(pw_impl_module_get_context(d->module), slave, properties, sizeof(struct node_data)); @@ -259,7 +259,7 @@ static void module_destroy(void *data) static void module_registered(void *data) { struct factory_data *d = data; - struct pw_module *module = d->module; + struct pw_impl_module *module = d->module; struct pw_impl_factory *factory = d->this; struct spa_dict_item items[1]; char id[16]; @@ -274,16 +274,16 @@ static void module_registered(void *data) } } -static const struct pw_module_events module_events = { - PW_VERSION_MODULE_EVENTS, +static const struct pw_impl_module_events module_events = { + PW_VERSION_IMPL_MODULE_EVENTS, .destroy = module_destroy, .registered = module_registered, }; SPA_EXPORT -int pipewire__module_init(struct pw_module *module, const char *args) +int pipewire__module_init(struct pw_impl_module *module, const char *args) { - struct pw_context *context = pw_module_get_context(module); + struct pw_context *context = pw_impl_module_get_context(module); struct pw_impl_factory *factory; struct factory_data *data; @@ -310,9 +310,9 @@ int pipewire__module_init(struct pw_module *module, const char *args) &impl_factory, data); - pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); + pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); - pw_module_add_listener(module, &data->module_listener, &module_events, data); + pw_impl_module_add_listener(module, &data->module_listener, &module_events, data); return 0; } diff --git a/src/modules/module-client-device.c b/src/modules/module-client-device.c index 320e2c8bf..e77e94be5 100644 --- a/src/modules/module-client-device.c +++ b/src/modules/module-client-device.c @@ -52,7 +52,7 @@ struct pw_protocol *pw_protocol_native_ext_client_device_init(struct pw_context struct factory_data { struct pw_impl_factory *this; - struct pw_module *module; + struct pw_impl_module *module; struct spa_hook module_listener; struct pw_export_type export_spadevice; @@ -136,13 +136,13 @@ static void module_destroy(void *data) static void module_registered(void *data) { struct factory_data *d = data; - struct pw_module *module = d->module; + struct pw_impl_module *module = d->module; struct pw_impl_factory *factory = d->this; struct spa_dict_item items[1]; char id[16]; int res; - snprintf(id, sizeof(id), "%d", pw_global_get_id(pw_module_get_global(module))); + snprintf(id, sizeof(id), "%d", pw_global_get_id(pw_impl_module_get_global(module))); items[0] = SPA_DICT_ITEM_INIT(PW_KEY_MODULE_ID, id); pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1)); @@ -151,16 +151,16 @@ static void module_registered(void *data) } } -static const struct pw_module_events module_events = { - PW_VERSION_MODULE_EVENTS, +static const struct pw_impl_module_events module_events = { + PW_VERSION_IMPL_MODULE_EVENTS, .destroy = module_destroy, .registered = module_registered, }; SPA_EXPORT -int pipewire__module_init(struct pw_module *module, const char *args) +int pipewire__module_init(struct pw_impl_module *module, const char *args) { - struct pw_context *context = pw_module_get_context(module); + struct pw_context *context = pw_impl_module_get_context(module); struct pw_impl_factory *factory; struct factory_data *data; @@ -191,9 +191,9 @@ int pipewire__module_init(struct pw_module *module, const char *args) data->export_spadevice.func = pw_core_spa_device_export; pw_context_register_export_type(context, &data->export_spadevice); - pw_module_add_listener(module, &data->module_listener, &module_events, data); + pw_impl_module_add_listener(module, &data->module_listener, &module_events, data); - pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); + pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); return 0; } diff --git a/src/modules/module-client-node.c b/src/modules/module-client-node.c index 5c847768a..e2b9d1ec5 100644 --- a/src/modules/module-client-node.c +++ b/src/modules/module-client-node.c @@ -55,7 +55,7 @@ struct pw_protocol *pw_protocol_native_ext_client_node0_init(struct pw_context * struct factory_data { struct pw_impl_factory *this; - struct pw_module *module; + struct pw_impl_module *module; struct spa_hook module_listener; struct pw_export_type export_node; @@ -127,13 +127,13 @@ static void module_destroy(void *data) static void module_registered(void *data) { struct factory_data *d = data; - struct pw_module *module = d->module; + struct pw_impl_module *module = d->module; struct pw_impl_factory *factory = d->this; struct spa_dict_item items[1]; char id[16]; int res; - snprintf(id, sizeof(id), "%d", pw_global_get_id(pw_module_get_global(module))); + snprintf(id, sizeof(id), "%d", pw_global_get_id(pw_impl_module_get_global(module))); items[0] = SPA_DICT_ITEM_INIT(PW_KEY_MODULE_ID, id); pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1)); @@ -142,16 +142,16 @@ static void module_registered(void *data) } } -static const struct pw_module_events module_events = { - PW_VERSION_MODULE_EVENTS, +static const struct pw_impl_module_events module_events = { + PW_VERSION_IMPL_MODULE_EVENTS, .destroy = module_destroy, .registered = module_registered, }; SPA_EXPORT -int pipewire__module_init(struct pw_module *module, const char *args) +int pipewire__module_init(struct pw_impl_module *module, const char *args) { - struct pw_context *context = pw_module_get_context(module); + struct pw_context *context = pw_impl_module_get_context(module); struct pw_impl_factory *factory; struct factory_data *data; @@ -185,9 +185,9 @@ int pipewire__module_init(struct pw_module *module, const char *args) data->export_spanode.func = pw_core_spa_node_export; pw_context_register_export_type(context, &data->export_spanode); - pw_module_add_listener(module, &data->module_listener, &module_events, data); + pw_impl_module_add_listener(module, &data->module_listener, &module_events, data); - pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); + pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); return 0; } diff --git a/src/modules/module-link-factory.c b/src/modules/module-link-factory.c index fea213e97..1378be93d 100644 --- a/src/modules/module-link-factory.c +++ b/src/modules/module-link-factory.c @@ -48,7 +48,7 @@ static const struct spa_dict_item module_props[] = { }; struct factory_data { - struct pw_module *module; + struct pw_impl_module *module; struct pw_impl_factory *this; struct spa_list link_list; @@ -340,13 +340,13 @@ static void module_destroy(void *data) static void module_registered(void *data) { struct factory_data *d = data; - struct pw_module *module = d->module; + struct pw_impl_module *module = d->module; struct pw_impl_factory *factory = d->this; struct spa_dict_item items[1]; char id[16]; int res; - snprintf(id, sizeof(id), "%d", pw_global_get_id(pw_module_get_global(module))); + snprintf(id, sizeof(id), "%d", pw_global_get_id(pw_impl_module_get_global(module))); items[0] = SPA_DICT_ITEM_INIT(PW_KEY_MODULE_ID, id); pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1)); @@ -355,16 +355,16 @@ static void module_registered(void *data) } } -static const struct pw_module_events module_events = { - PW_VERSION_MODULE_EVENTS, +static const struct pw_impl_module_events module_events = { + PW_VERSION_IMPL_MODULE_EVENTS, .destroy = module_destroy, .registered = module_registered, }; SPA_EXPORT -int pipewire__module_init(struct pw_module *module, const char *args) +int pipewire__module_init(struct pw_impl_module *module, const char *args) { - struct pw_context *context = pw_module_get_context(module); + struct pw_context *context = pw_impl_module_get_context(module); struct pw_impl_factory *factory; struct factory_data *data; @@ -390,9 +390,9 @@ int pipewire__module_init(struct pw_module *module, const char *args) &impl_factory, data); - pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); + pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); - pw_module_add_listener(module, &data->module_listener, &module_events, data); + pw_impl_module_add_listener(module, &data->module_listener, &module_events, data); return 0; } diff --git a/src/modules/module-metadata.c b/src/modules/module-metadata.c index 8c72f3174..14b128c92 100644 --- a/src/modules/module-metadata.c +++ b/src/modules/module-metadata.c @@ -54,7 +54,7 @@ int pw_protocol_native_ext_metadata_init(struct pw_context *context); struct factory_data { struct pw_impl_factory *this; - struct pw_module *module; + struct pw_impl_module *module; struct spa_hook module_listener; struct pw_export_type export_metadata; @@ -122,13 +122,13 @@ static void module_destroy(void *data) static void module_registered(void *data) { struct factory_data *d = data; - struct pw_module *module = d->module; + struct pw_impl_module *module = d->module; struct pw_impl_factory *factory = d->this; struct spa_dict_item items[1]; char id[16]; int res; - snprintf(id, sizeof(id), "%d", pw_global_get_id(pw_module_get_global(module))); + snprintf(id, sizeof(id), "%d", pw_global_get_id(pw_impl_module_get_global(module))); items[0] = SPA_DICT_ITEM_INIT(PW_KEY_MODULE_ID, id); pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1)); @@ -137,16 +137,16 @@ static void module_registered(void *data) } } -static const struct pw_module_events module_events = { - PW_VERSION_MODULE_EVENTS, +static const struct pw_impl_module_events module_events = { + PW_VERSION_IMPL_MODULE_EVENTS, .destroy = module_destroy, .registered = module_registered, }; SPA_EXPORT -int pipewire__module_init(struct pw_module *module, const char *args) +int pipewire__module_init(struct pw_impl_module *module, const char *args) { - struct pw_context *context = pw_module_get_context(module); + struct pw_context *context = pw_impl_module_get_context(module); struct pw_impl_factory *factory; struct factory_data *data; int res; @@ -177,9 +177,9 @@ int pipewire__module_init(struct pw_module *module, const char *args) data->export_metadata.func = pw_core_metadata_export; pw_context_register_export_type(context, &data->export_metadata); - pw_module_add_listener(module, &data->module_listener, &module_events, data); + pw_impl_module_add_listener(module, &data->module_listener, &module_events, data); - pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); + pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); return 0; } diff --git a/src/modules/module-protocol-native.c b/src/modules/module-protocol-native.c index 560362671..fc0bfe7f1 100644 --- a/src/modules/module-protocol-native.c +++ b/src/modules/module-protocol-native.c @@ -71,7 +71,7 @@ void pw_protocol_native_init(struct pw_protocol *protocol); void pw_protocol_native0_init(struct pw_protocol *protocol); struct protocol_data { - struct pw_module *module; + struct pw_impl_module *module; struct spa_hook module_listener; struct pw_protocol *protocol; @@ -1076,15 +1076,15 @@ static void module_destroy(void *data) pw_protocol_destroy(d->protocol); } -static const struct pw_module_events module_events = { - PW_VERSION_MODULE_EVENTS, +static const struct pw_impl_module_events module_events = { + PW_VERSION_IMPL_MODULE_EVENTS, .destroy = module_destroy, }; SPA_EXPORT -int pipewire__module_init(struct pw_module *module, const char *args) +int pipewire__module_init(struct pw_impl_module *module, const char *args) { - struct pw_context *context = pw_module_get_context(module); + struct pw_context *context = pw_impl_module_get_context(module); struct pw_protocol *this; const char *val; struct protocol_data *d; @@ -1126,9 +1126,9 @@ int pipewire__module_init(struct pw_module *module, const char *args) } } - pw_module_add_listener(module, &d->module_listener, &module_events, d); + pw_impl_module_add_listener(module, &d->module_listener, &module_events, d); - pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); + pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); return 0; diff --git a/src/modules/module-rtkit.c b/src/modules/module-rtkit.c index 4c390482a..b4f21d13f 100644 --- a/src/modules/module-rtkit.c +++ b/src/modules/module-rtkit.c @@ -426,8 +426,8 @@ static void module_destroy(void *data) free(impl); } -static const struct pw_module_events module_events = { - PW_VERSION_MODULE_EVENTS, +static const struct pw_impl_module_events module_events = { + PW_VERSION_IMPL_MODULE_EVENTS, .destroy = module_destroy, }; @@ -484,9 +484,9 @@ static void idle_func(struct spa_source *source) } SPA_EXPORT -int pipewire__module_init(struct pw_module *module, const char *args) +int pipewire__module_init(struct pw_impl_module *module, const char *args) { - struct pw_context *context = pw_module_get_context(module); + struct pw_context *context = pw_impl_module_get_context(module); struct impl *impl; struct spa_loop *loop; struct spa_system *system; @@ -526,9 +526,9 @@ int pipewire__module_init(struct pw_module *module, const char *args) spa_loop_add_source(impl->loop, &impl->source); - pw_module_add_listener(module, &impl->module_listener, &module_events, impl); + pw_impl_module_add_listener(module, &impl->module_listener, &module_events, impl); - pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); + pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); return 0; diff --git a/src/modules/module-session-manager.c b/src/modules/module-session-manager.c index fbc1e2f9a..b8ef16f35 100644 --- a/src/modules/module-session-manager.c +++ b/src/modules/module-session-manager.c @@ -28,9 +28,9 @@ #include /* client-endpoint.c */ -int client_endpoint_factory_init(struct pw_module *module); +int client_endpoint_factory_init(struct pw_impl_module *module); /* client-session.c */ -int client_session_factory_init(struct pw_module *module); +int client_session_factory_init(struct pw_impl_module *module); /* protocol-native.c */ struct pw_protocol *pw_protocol_native_ext_session_manager_init(struct pw_context *context); @@ -41,16 +41,16 @@ static const struct spa_dict_item module_props[] = { }; SPA_EXPORT -int pipewire__module_init(struct pw_module *module, const char *args) +int pipewire__module_init(struct pw_impl_module *module, const char *args) { - struct pw_context *context = pw_module_get_context(module); + struct pw_context *context = pw_impl_module_get_context(module); client_endpoint_factory_init(module); client_session_factory_init(module); pw_protocol_native_ext_session_manager_init(context); - pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); + pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); return 0; } diff --git a/src/modules/module-session-manager/client-endpoint.c b/src/modules/module-session-manager/client-endpoint.c index af950a4f7..818a202b1 100644 --- a/src/modules/module-session-manager/client-endpoint.c +++ b/src/modules/module-session-manager/client-endpoint.c @@ -39,7 +39,7 @@ struct factory_data { struct pw_impl_factory *factory; - struct pw_module *module; + struct pw_impl_module *module; struct spa_hook module_listener; }; @@ -229,7 +229,7 @@ static void module_destroy(void *data) static void module_registered(void *data) { struct factory_data *d = data; - struct pw_module *module = d->module; + struct pw_impl_module *module = d->module; struct pw_impl_factory *factory = d->factory; struct spa_dict_item items[1]; char id[16]; @@ -244,15 +244,15 @@ static void module_registered(void *data) } } -static const struct pw_module_events module_events = { - PW_VERSION_MODULE_EVENTS, +static const struct pw_impl_module_events module_events = { + PW_VERSION_IMPL_MODULE_EVENTS, .destroy = module_destroy, .registered = module_registered, }; -int client_endpoint_factory_init(struct pw_module *module) +int client_endpoint_factory_init(struct pw_impl_module *module) { - struct pw_context *context = pw_module_get_context(module); + struct pw_context *context = pw_impl_module_get_context(module); struct pw_impl_factory *factory; struct factory_data *data; @@ -271,7 +271,7 @@ int client_endpoint_factory_init(struct pw_module *module) pw_impl_factory_set_implementation(factory, &impl_factory, data); - pw_module_add_listener(module, &data->module_listener, &module_events, data); + pw_impl_module_add_listener(module, &data->module_listener, &module_events, data); return 0; } diff --git a/src/modules/module-session-manager/client-endpoint.h b/src/modules/module-session-manager/client-endpoint.h index b59cde7df..d2f68fbc5 100644 --- a/src/modules/module-session-manager/client-endpoint.h +++ b/src/modules/module-session-manager/client-endpoint.h @@ -53,7 +53,7 @@ struct client_endpoint { #define pw_client_endpoint_resource_create_link(r,...) \ pw_client_endpoint_resource(r,create_link,0,__VA_ARGS__) -int client_endpoint_factory_init(struct pw_module *module); +int client_endpoint_factory_init(struct pw_impl_module *module); #ifdef __cplusplus } /* extern "C" */ diff --git a/src/modules/module-session-manager/client-session.c b/src/modules/module-session-manager/client-session.c index 6ab0c7d8c..c9365c161 100644 --- a/src/modules/module-session-manager/client-session.c +++ b/src/modules/module-session-manager/client-session.c @@ -39,7 +39,7 @@ struct factory_data { struct pw_impl_factory *factory; - struct pw_module *module; + struct pw_impl_module *module; struct spa_hook module_listener; }; @@ -228,7 +228,7 @@ static void module_destroy(void *data) static void module_registered(void *data) { struct factory_data *d = data; - struct pw_module *module = d->module; + struct pw_impl_module *module = d->module; struct pw_impl_factory *factory = d->factory; struct spa_dict_item items[1]; char id[16]; @@ -243,15 +243,15 @@ static void module_registered(void *data) } } -static const struct pw_module_events module_events = { - PW_VERSION_MODULE_EVENTS, +static const struct pw_impl_module_events module_events = { + PW_VERSION_IMPL_MODULE_EVENTS, .destroy = module_destroy, .registered = module_registered, }; -int client_session_factory_init(struct pw_module *module) +int client_session_factory_init(struct pw_impl_module *module) { - struct pw_context *context = pw_module_get_context(module); + struct pw_context *context = pw_impl_module_get_context(module); struct pw_impl_factory *factory; struct factory_data *data; @@ -270,7 +270,7 @@ int client_session_factory_init(struct pw_module *module) pw_impl_factory_set_implementation(factory, &impl_factory, data); - pw_module_add_listener(module, &data->module_listener, &module_events, data); + pw_impl_module_add_listener(module, &data->module_listener, &module_events, data); return 0; } diff --git a/src/modules/spa/module-device-factory.c b/src/modules/spa/module-device-factory.c index 932addfa5..68ab13423 100644 --- a/src/modules/spa/module-device-factory.c +++ b/src/modules/spa/module-device-factory.c @@ -48,7 +48,7 @@ static const struct spa_dict_item module_props[] = { struct factory_data { struct pw_context *context; - struct pw_module *module; + struct pw_impl_module *module; struct pw_impl_factory *this; struct spa_hook factory_listener; @@ -177,13 +177,13 @@ static void module_destroy(void *_data) static void module_registered(void *data) { struct factory_data *d = data; - struct pw_module *module = d->module; + struct pw_impl_module *module = d->module; struct pw_impl_factory *factory = d->this; struct spa_dict_item items[1]; char id[16]; int res; - snprintf(id, sizeof(id), "%d", pw_global_get_id(pw_module_get_global(module))); + snprintf(id, sizeof(id), "%d", pw_global_get_id(pw_impl_module_get_global(module))); items[0] = SPA_DICT_ITEM_INIT(PW_KEY_MODULE_ID, id); pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1)); @@ -192,16 +192,16 @@ static void module_registered(void *data) } } -static const struct pw_module_events module_events = { - PW_VERSION_MODULE_EVENTS, +static const struct pw_impl_module_events module_events = { + PW_VERSION_IMPL_MODULE_EVENTS, .destroy = module_destroy, .registered = module_registered, }; SPA_EXPORT -int pipewire__module_init(struct pw_module *module, const char *args) +int pipewire__module_init(struct pw_impl_module *module, const char *args) { - struct pw_context *context = pw_module_get_context(module); + struct pw_context *context = pw_impl_module_get_context(module); struct pw_impl_factory *factory; struct factory_data *data; @@ -224,9 +224,9 @@ int pipewire__module_init(struct pw_module *module, const char *args) pw_impl_factory_set_implementation(factory, &factory_impl, data); pw_log_debug("module %p: new", module); - pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); + pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); - pw_module_add_listener(module, &data->module_listener, &module_events, data); + pw_impl_module_add_listener(module, &data->module_listener, &module_events, data); return 0; } diff --git a/src/modules/spa/module-device.c b/src/modules/spa/module-device.c index fab9771c9..9538b9608 100644 --- a/src/modules/spa/module-device.c +++ b/src/modules/spa/module-device.c @@ -58,18 +58,18 @@ static void module_destroy(void *_data) pw_impl_device_destroy(data->this); } -static const struct pw_module_events module_events = { - PW_VERSION_MODULE_EVENTS, +static const struct pw_impl_module_events module_events = { + PW_VERSION_IMPL_MODULE_EVENTS, .destroy = module_destroy, }; SPA_EXPORT -int pipewire__module_init(struct pw_module *module, const char *args) +int pipewire__module_init(struct pw_impl_module *module, const char *args) { struct pw_properties *props = NULL; char **argv = NULL; int n_tokens; - struct pw_context *context = pw_module_get_context(module); + struct pw_context *context = pw_impl_module_get_context(module); struct pw_impl_device *device; struct device_data *data; int res; @@ -106,9 +106,9 @@ int pipewire__module_init(struct pw_module *module, const char *args) data->context = context; pw_log_debug("module %p: new", module); - pw_module_add_listener(module, &data->module_listener, &module_events, data); + pw_impl_module_add_listener(module, &data->module_listener, &module_events, data); - pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); + pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); return 0; diff --git a/src/modules/spa/module-node-factory.c b/src/modules/spa/module-node-factory.c index 1cd1a93e9..b91f328d1 100644 --- a/src/modules/spa/module-node-factory.c +++ b/src/modules/spa/module-node-factory.c @@ -49,7 +49,7 @@ static const struct spa_dict_item module_props[] = { struct factory_data { struct pw_context *context; struct pw_impl_factory *this; - struct pw_module *module; + struct pw_impl_module *module; struct spa_hook factory_listener; struct spa_hook module_listener; @@ -211,13 +211,13 @@ static void module_destroy(void *_data) static void module_registered(void *data) { struct factory_data *d = data; - struct pw_module *module = d->module; + struct pw_impl_module *module = d->module; struct pw_impl_factory *factory = d->this; struct spa_dict_item items[1]; char id[16]; int res; - snprintf(id, sizeof(id), "%d", pw_global_get_id(pw_module_get_global(module))); + snprintf(id, sizeof(id), "%d", pw_global_get_id(pw_impl_module_get_global(module))); items[0] = SPA_DICT_ITEM_INIT(PW_KEY_MODULE_ID, id); pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1)); @@ -226,16 +226,16 @@ static void module_registered(void *data) } } -static const struct pw_module_events module_events = { - PW_VERSION_MODULE_EVENTS, +static const struct pw_impl_module_events module_events = { + PW_VERSION_IMPL_MODULE_EVENTS, .destroy = module_destroy, .registered = module_registered, }; SPA_EXPORT -int pipewire__module_init(struct pw_module *module, const char *args) +int pipewire__module_init(struct pw_impl_module *module, const char *args) { - struct pw_context *context = pw_module_get_context(module); + struct pw_context *context = pw_impl_module_get_context(module); struct pw_impl_factory *factory; struct factory_data *data; @@ -258,9 +258,9 @@ int pipewire__module_init(struct pw_module *module, const char *args) pw_impl_factory_set_implementation(factory, &factory_impl, data); pw_log_debug("module %p: new", module); - pw_module_add_listener(module, &data->module_listener, &module_events, data); + pw_impl_module_add_listener(module, &data->module_listener, &module_events, data); - pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); + pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); return 0; } diff --git a/src/modules/spa/module-node.c b/src/modules/spa/module-node.c index e3659af95..747ee2a49 100644 --- a/src/modules/spa/module-node.c +++ b/src/modules/spa/module-node.c @@ -59,18 +59,18 @@ static void module_destroy(void *_data) pw_node_destroy(data->this); } -static const struct pw_module_events module_events = { - PW_VERSION_MODULE_EVENTS, +static const struct pw_impl_module_events module_events = { + PW_VERSION_IMPL_MODULE_EVENTS, .destroy = module_destroy, }; SPA_EXPORT -int pipewire__module_init(struct pw_module *module, const char *args) +int pipewire__module_init(struct pw_impl_module *module, const char *args) { struct pw_properties *props = NULL; char **argv = NULL; int n_tokens, res; - struct pw_context *context = pw_module_get_context(module); + struct pw_context *context = pw_impl_module_get_context(module); struct pw_node *node; struct node_data *data; @@ -108,9 +108,9 @@ int pipewire__module_init(struct pw_module *module, const char *args) data->properties = props; pw_log_debug("module %p: new", module); - pw_module_add_listener(module, &data->module_listener, &module_events, data); + pw_impl_module_add_listener(module, &data->module_listener, &module_events, data); - pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); + pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); return 0; diff --git a/src/pipewire/context.c b/src/pipewire/context.c index 3f92b5080..28ad3fa00 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -455,13 +455,13 @@ static int load_module_profile(struct pw_context *this, const char *profile) { pw_log_debug(NAME" %p: module profile %s", this, profile); if (strcmp(profile, "default") == 0) { - pw_module_load(this, "libpipewire-module-rtkit", NULL, NULL); - pw_module_load(this, "libpipewire-module-protocol-native", NULL, NULL); - pw_module_load(this, "libpipewire-module-client-node", NULL, NULL); - pw_module_load(this, "libpipewire-module-client-device", NULL, NULL); - pw_module_load(this, "libpipewire-module-adapter", NULL, NULL); - pw_module_load(this, "libpipewire-module-metadata", NULL, NULL); - pw_module_load(this, "libpipewire-module-session-manager", NULL, NULL); + pw_impl_module_load(this, "libpipewire-module-rtkit", NULL, NULL); + pw_impl_module_load(this, "libpipewire-module-protocol-native", NULL, NULL); + pw_impl_module_load(this, "libpipewire-module-client-node", NULL, NULL); + pw_impl_module_load(this, "libpipewire-module-client-device", NULL, NULL); + pw_impl_module_load(this, "libpipewire-module-adapter", NULL, NULL); + pw_impl_module_load(this, "libpipewire-module-metadata", NULL, NULL); + pw_impl_module_load(this, "libpipewire-module-session-manager", NULL, NULL); } return 0; } @@ -649,7 +649,7 @@ void pw_context_destroy(struct pw_context *context) { struct impl *impl = SPA_CONTAINER_OF(context, struct impl, this); struct pw_global *global; - struct pw_module *module; + struct pw_impl_module *module; struct pw_impl_device *device; struct pw_core *core; struct pw_resource *resource; @@ -665,7 +665,7 @@ void pw_context_destroy(struct pw_context *context) pw_core_disconnect(core); spa_list_consume(module, &context->module_list, link) - pw_module_destroy(module); + pw_impl_module_destroy(module); spa_list_consume(node, &context->node_list, link) pw_node_destroy(node); diff --git a/src/pipewire/impl-module.c b/src/pipewire/impl-module.c index fe4ce282f..580181fc3 100644 --- a/src/pipewire/impl-module.c +++ b/src/pipewire/impl-module.c @@ -40,7 +40,7 @@ /** \cond */ struct impl { - struct pw_module this; + struct pw_impl_module this; void *hnd; }; @@ -120,7 +120,7 @@ static int global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions, uint32_t version, uint32_t id) { - struct pw_module *this = _data; + struct pw_impl_module *this = _data; struct pw_global *global = this->global; struct pw_resource *resource; struct resource_data *data; @@ -150,10 +150,10 @@ error_resource: static void global_destroy(void *object) { - struct pw_module *module = object; + struct pw_impl_module *module = object; spa_hook_remove(&module->global_listener); module->global = NULL; - pw_module_destroy(module); + pw_impl_module_destroy(module); } static const struct pw_global_events global_events = { @@ -167,23 +167,23 @@ static const struct pw_global_events global_events = { * \param name name of the module to load * \param args A string with arguments for the module * \param[out] error Return location for an error string, or NULL - * \return A \ref pw_module if the module could be loaded, or NULL on failure. + * \return A \ref pw_impl_module if the module could be loaded, or NULL on failure. * - * \memberof pw_module + * \memberof pw_impl_module */ SPA_EXPORT -struct pw_module * -pw_module_load(struct pw_context *context, +struct pw_impl_module * +pw_impl_module_load(struct pw_context *context, const char *name, const char *args, struct pw_properties *properties) { - struct pw_module *this; + struct pw_impl_module *this; struct impl *impl; void *hnd; char *filename = NULL; const char *module_dir; int res; - pw_module_init_func_t init_func; + pw_impl_module_init_func_t init_func; module_dir = getenv("PIPEWIRE_MODULE_DIR"); if (module_dir != NULL) { @@ -261,7 +261,7 @@ pw_module_load(struct pw_context *context, pw_properties_setf(this->properties, PW_KEY_OBJECT_ID, "%d", this->info.id); this->info.props = &this->properties->dict; - pw_module_emit_initialized(this); + pw_impl_module_emit_initialized(this); pw_global_add_listener(this->global, &this->global_listener, &global_events, this); @@ -270,7 +270,7 @@ pw_module_load(struct pw_context *context, pw_global_register(this->global); - pw_module_emit_registered(this); + pw_impl_module_emit_registered(this); pw_log_debug(NAME" %p: loaded module: %s", this, this->info.name); @@ -301,7 +301,7 @@ error_init_failed: goto error_free_module; error_free_module: - pw_module_destroy(this); + pw_impl_module_destroy(this); error_close: if (hnd) dlclose(hnd); @@ -317,15 +317,15 @@ error_cleanup: /** Destroy a module * \param module the module to destroy - * \memberof pw_module + * \memberof pw_impl_module */ SPA_EXPORT -void pw_module_destroy(struct pw_module *module) +void pw_impl_module_destroy(struct pw_impl_module *module) { struct impl *impl = SPA_CONTAINER_OF(module, struct impl, this); pw_log_debug(NAME" %p: destroy", module); - pw_module_emit_destroy(module); + pw_impl_module_emit_destroy(module); if (module->global) { spa_list_remove(&module->link); @@ -334,7 +334,7 @@ void pw_module_destroy(struct pw_module *module) } pw_log_debug(NAME" %p: free", module); - pw_module_emit_free(module); + pw_impl_module_emit_free(module); free((char *) module->info.name); free((char *) module->info.filename); free((char *) module->info.args); @@ -348,25 +348,25 @@ void pw_module_destroy(struct pw_module *module) SPA_EXPORT struct pw_context * -pw_module_get_context(struct pw_module *module) +pw_impl_module_get_context(struct pw_impl_module *module) { return module->context; } SPA_EXPORT -struct pw_global * pw_module_get_global(struct pw_module *module) +struct pw_global * pw_impl_module_get_global(struct pw_impl_module *module) { return module->global; } SPA_EXPORT -const struct pw_properties *pw_module_get_properties(struct pw_module *module) +const struct pw_properties *pw_impl_module_get_properties(struct pw_impl_module *module) { return module->properties; } SPA_EXPORT -int pw_module_update_properties(struct pw_module *module, const struct spa_dict *dict) +int pw_impl_module_update_properties(struct pw_impl_module *module, const struct spa_dict *dict) { struct pw_resource *resource; int changed; @@ -390,15 +390,15 @@ int pw_module_update_properties(struct pw_module *module, const struct spa_dict SPA_EXPORT const struct pw_module_info * -pw_module_get_info(struct pw_module *module) +pw_impl_module_get_info(struct pw_impl_module *module) { return &module->info; } SPA_EXPORT -void pw_module_add_listener(struct pw_module *module, +void pw_impl_module_add_listener(struct pw_impl_module *module, struct spa_hook *listener, - const struct pw_module_events *events, + const struct pw_impl_module_events *events, void *data) { spa_hook_list_append(&module->listener_list, listener, events, data); diff --git a/src/pipewire/impl-module.h b/src/pipewire/impl-module.h index 6fde7151f..81a2115f1 100644 --- a/src/pipewire/impl-module.h +++ b/src/pipewire/impl-module.h @@ -23,8 +23,8 @@ * DEALINGS IN THE SOFTWARE. */ -#ifndef PIPEWIRE_MODULE_H -#define PIPEWIRE_MODULE_H +#ifndef PIPEWIRE_IMPL_MODULE_H +#define PIPEWIRE_IMPL_MODULE_H #ifdef __cplusplus extern "C" { @@ -37,28 +37,28 @@ extern "C" { #define PIPEWIRE_SYMBOL_MODULE_INIT "pipewire__module_init" #define PIPEWIRE_MODULE_PREFIX "libpipewire-" -/** \class pw_module +/** \class pw_impl_module * * A dynamically loadable module */ -struct pw_module; +struct pw_impl_module; /** Module init function signature * - * \param module A \ref pw_module + * \param module A \ref pw_impl_module * \param args Arguments to the module * \return 0 on success, < 0 otherwise with an errno style error * * A module should provide an init function with this signature. This function * will be called when a module is loaded. * - * \memberof pw_module + * \memberof pw_impl_module */ -typedef int (*pw_module_init_func_t) (struct pw_module *module, const char *args); +typedef int (*pw_impl_module_init_func_t) (struct pw_impl_module *module, const char *args); -/** Module events added with \ref pw_module_add_listener */ -struct pw_module_events { -#define PW_VERSION_MODULE_EVENTS 0 +/** Module events added with \ref pw_impl_module_add_listener */ +struct pw_impl_module_events { +#define PW_VERSION_IMPL_MODULE_EVENTS 0 uint32_t version; /** The module is destroyed */ @@ -73,38 +73,38 @@ struct pw_module_events { void (*registered) (void *data); }; -struct pw_module * -pw_module_load(struct pw_context *context, +struct pw_impl_module * +pw_impl_module_load(struct pw_context *context, const char *name, /**< name of the module */ const char *args /**< arguments of the module */, struct pw_properties *properties /**< extra global properties */); /** Get the context of a module */ -struct pw_context * pw_module_get_context(struct pw_module *module); +struct pw_context * pw_impl_module_get_context(struct pw_impl_module *module); /** Get the global of a module */ -struct pw_global * pw_module_get_global(struct pw_module *module); +struct pw_global * pw_impl_module_get_global(struct pw_impl_module *module); /** Get the node properties */ -const struct pw_properties *pw_module_get_properties(struct pw_module *module); +const struct pw_properties *pw_impl_module_get_properties(struct pw_impl_module *module); /** Update the module properties */ -int pw_module_update_properties(struct pw_module *module, const struct spa_dict *dict); +int pw_impl_module_update_properties(struct pw_impl_module *module, const struct spa_dict *dict); /** Get the module info */ -const struct pw_module_info *pw_module_get_info(struct pw_module *module); +const struct pw_module_info *pw_impl_module_get_info(struct pw_impl_module *module); /** Add an event listener to a module */ -void pw_module_add_listener(struct pw_module *module, +void pw_impl_module_add_listener(struct pw_impl_module *module, struct spa_hook *listener, - const struct pw_module_events *events, + const struct pw_impl_module_events *events, void *data); /** Destroy a module */ -void pw_module_destroy(struct pw_module *module); +void pw_impl_module_destroy(struct pw_impl_module *module); #ifdef __cplusplus } #endif -#endif /* PIPEWIRE_MODULE_H */ +#endif /* PIPEWIRE_IMPL_MODULE_H */ diff --git a/src/pipewire/private.h b/src/pipewire/private.h index d49cc9491..62dee920f 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -300,13 +300,13 @@ struct pw_impl_device { unsigned int registered:1; }; -#define pw_module_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_module_events, m, v, ##__VA_ARGS__) -#define pw_module_emit_destroy(m) pw_module_emit(m, destroy, 0) -#define pw_module_emit_free(m) pw_module_emit(m, free, 0) -#define pw_module_emit_initialized(m) pw_module_emit(m, initialized, 0) -#define pw_module_emit_registered(m) pw_module_emit(m, registered, 0) +#define pw_impl_module_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_impl_module_events, m, v, ##__VA_ARGS__) +#define pw_impl_module_emit_destroy(m) pw_impl_module_emit(m, destroy, 0) +#define pw_impl_module_emit_free(m) pw_impl_module_emit(m, free, 0) +#define pw_impl_module_emit_initialized(m) pw_impl_module_emit(m, initialized, 0) +#define pw_impl_module_emit_registered(m) pw_impl_module_emit(m, registered, 0) -struct pw_module { +struct pw_impl_module { struct pw_context *context; /**< the context object */ struct spa_list link; /**< link in the context module_list */ struct pw_global *global; /**< global object for this module */ diff --git a/src/tools/pipewire-cli.c b/src/tools/pipewire-cli.c index 303bf1d47..ffaffe520 100644 --- a/src/tools/pipewire-cli.c +++ b/src/tools/pipewire-cli.c @@ -238,7 +238,7 @@ static bool do_help(struct data *data, const char *cmd, char *args, char **error static bool do_load_module(struct data *data, const char *cmd, char *args, char **error) { - struct pw_module *module; + struct pw_impl_module *module; char *a[2]; int n; uint32_t id; @@ -249,14 +249,14 @@ static bool do_load_module(struct data *data, const char *cmd, char *args, char return false; } - module = pw_module_load(data->context, a[0], n == 2 ? a[1] : NULL, NULL); + module = pw_impl_module_load(data->context, a[0], n == 2 ? a[1] : NULL, NULL); if (module == NULL) { asprintf(error, "Could not load module"); return false; } id = pw_map_insert_new(&data->vars, module); - fprintf(stdout, "%d = @module:%d\n", id, pw_global_get_id(pw_module_get_global(module))); + fprintf(stdout, "%d = @module:%d\n", id, pw_global_get_id(pw_impl_module_get_global(module))); return true; } @@ -1648,7 +1648,7 @@ int main(int argc, char *argv[]) data.context = pw_context_new(l, pw_properties_new(PW_KEY_CORE_DAEMON, "1", NULL), 0); info = pw_context_get_info(data.context); - pw_module_load(data.context, "libpipewire-module-link-factory", NULL, NULL); + pw_impl_module_load(data.context, "libpipewire-module-link-factory", NULL, NULL); pw_loop_add_io(l, STDIN_FILENO, SPA_IO_IN|SPA_IO_HUP, false, do_input, &data);