mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
core: add PW_KEY_CORE_PROFILE_MODULES
Let the core load a set of default modules. Add a key to control what default set to load, falling back to a reasonable set. Make the daemon not load any set and rely on the config script to load modules.
This commit is contained in:
parent
6b1e1a82f1
commit
1ba5a17236
7 changed files with 25 additions and 19 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -235,14 +235,10 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (protocol == NULL)
|
||||
protocol = pw_core_find_protocol(core, protocol_name);
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue