diff --git a/src/daemon/main.c b/src/daemon/main.c index 09d9e510a..07f7449d0 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -93,6 +93,7 @@ int main(int argc, char *argv[]) properties = pw_properties_new( PW_KEY_CORE_NAME, daemon_name, + PW_KEY_CORE_PROFILE_MODULES, "none", PW_KEY_CORE_DAEMON, "1", NULL); /* parse configuration */ diff --git a/src/examples/bluez-session.c b/src/examples/bluez-session.c index aafef325f..cee7c4c22 100644 --- a/src/examples/bluez-session.c +++ b/src/examples/bluez-session.c @@ -385,8 +385,6 @@ int main(int argc, char *argv[]) pw_core_add_spa_lib(impl.core, "api.bluez5.*", "bluez5/libspa-bluez5"); - pw_module_load(impl.core, "libpipewire-module-client-device", NULL, NULL); - clock_gettime(CLOCK_MONOTONIC, &impl.now); spa_list_init(&impl.device_list); diff --git a/src/examples/export-spa-device.c b/src/examples/export-spa-device.c index cc14a3181..a9571009d 100644 --- a/src/examples/export-spa-device.c +++ b/src/examples/export-spa-device.c @@ -128,7 +128,6 @@ int main(int argc, char *argv[]) data.factory = argv[2]; pw_module_load(data.core, "libpipewire-module-spa-device-factory", NULL, NULL); - pw_module_load(data.core, "libpipewire-module-client-device", NULL, NULL); pw_remote_add_listener(data.remote, &data.remote_listener, &remote_events, &data); diff --git a/src/examples/media-session/media-session.c b/src/examples/media-session/media-session.c index c4a0de3e3..a360d2e4c 100644 --- a/src/examples/media-session/media-session.c +++ b/src/examples/media-session/media-session.c @@ -1669,11 +1669,6 @@ int main(int argc, char *argv[]) impl.policy_remote = pw_remote_new(impl.this.core, NULL, 0); pw_remote_add_listener(impl.policy_remote, &impl.policy_listener, &policy_remote_events, &impl); - pw_module_load(impl.this.core, "libpipewire-module-client-device", NULL, NULL); - pw_module_load(impl.this.core, "libpipewire-module-adapter", NULL, NULL); - pw_module_load(impl.this.core, "libpipewire-module-metadata", NULL, NULL); - pw_module_load(impl.this.core, "libpipewire-module-session-manager", NULL, NULL); - pw_map_init(&impl.globals, 64, 64); spa_list_init(&impl.global_list); pw_map_init(&impl.endpoint_links, 64, 64); diff --git a/src/pipewire/core.c b/src/pipewire/core.c index 7495952e5..e7e6b9ed8 100644 --- a/src/pipewire/core.c +++ b/src/pipewire/core.c @@ -460,6 +460,21 @@ static const struct pw_global_events global_events = { .destroy = global_destroy, }; +static int load_module_profile(struct pw_core *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); + } + return 0; +} + /** Create a new core object * * \param main_loop the main loop to use @@ -612,6 +627,13 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop, pw_global_add_listener(this->global, &this->global_listener, &global_events, this); pw_global_register(this->global); + if ((str = pw_properties_get(properties, PW_KEY_CORE_PROFILE_MODULES)) == NULL) + str = "default"; + + load_module_profile(this, str); + + pw_log_debug(NAME" %p: created", this); + return this; error_free_loop: diff --git a/src/pipewire/keys.h b/src/pipewire/keys.h index f6fd921ac..b0e0bbab6 100644 --- a/src/pipewire/keys.h +++ b/src/pipewire/keys.h @@ -71,6 +71,7 @@ extern "C" { #define PW_KEY_CORE_ID "core.id" /**< the core id */ #define PW_KEY_CORE_MONITORS "core.monitors" /**< the apis monitored by core. */ +#define PW_KEY_CORE_PROFILE_MODULES "core.profile.modules" /**< a core profile for modules */ /* cpu */ #define PW_KEY_CPU_MAX_ALIGN "cpu.max-align" /**< maximum alignment needed to support diff --git a/src/pipewire/remote.c b/src/pipewire/remote.c index 3c4a7d571..5919ec8f7 100644 --- a/src/pipewire/remote.c +++ b/src/pipewire/remote.c @@ -235,11 +235,7 @@ struct pw_remote *pw_remote_new(struct pw_core *core, if ((protocol_name = pw_properties_get(core->properties, PW_KEY_PROTOCOL)) == NULL) { protocol_name = PW_TYPE_INFO_PROTOCOL_Native; if ((protocol = pw_core_find_protocol(core, protocol_name)) == NULL) { - if (pw_module_load(core, "libpipewire-module-protocol-native", - NULL, NULL) == NULL) { - res = -errno; - goto error_protocol; - } + goto error_protocol; } } } @@ -255,12 +251,6 @@ struct pw_remote *pw_remote_new(struct pw_core *core, if (this->conn == NULL) goto error_connection; - pw_module_load(core, "libpipewire-module-rtkit", NULL, NULL); - pw_module_load(core, "libpipewire-module-client-node", NULL, NULL); - pw_module_load(core, "libpipewire-module-adapter", NULL, NULL); - pw_module_load(core, "libpipewire-module-metadata", NULL, NULL); - pw_module_load(core, "libpipewire-module-session-manager", NULL, NULL); - spa_list_append(&core->remote_list, &this->link); return this;