mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
modules: support config overrides for access & protocol-native
These modules are loaded in default config, but to configure sockets and their permissions, the args need to be overridden.
This commit is contained in:
parent
5e8a7f434b
commit
0d80a13771
2 changed files with 53 additions and 10 deletions
|
|
@ -95,6 +95,22 @@
|
|||
* - \ref PW_KEY_ACCESS
|
||||
* - \ref PW_KEY_CLIENT_ACCESS
|
||||
*
|
||||
* ## Config override
|
||||
*
|
||||
* A `module.access.args` config section can be added
|
||||
* to override the module arguments.
|
||||
*
|
||||
*\code{.unparsed}
|
||||
* # ~/.config/pipewire/pipewire.conf.d/my-access-args.conf
|
||||
*
|
||||
* module.access.args = {
|
||||
* access.socket = {
|
||||
* pipewire-0 = "default",
|
||||
* pipewire-0-manager = "unrestricted",
|
||||
* }
|
||||
* }
|
||||
*\endcode
|
||||
*
|
||||
* ## Example configuration
|
||||
*
|
||||
*\code{.unparsed}
|
||||
|
|
@ -294,17 +310,11 @@ static int parse_socket_args(struct impl *impl, const char *str)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int parse_args(struct impl *impl, const struct pw_properties *props, const char *args_str)
|
||||
static int parse_args(struct impl *impl, const struct pw_properties *props, const struct pw_properties *args)
|
||||
{
|
||||
spa_autoptr(pw_properties) args = NULL;
|
||||
const char *str;
|
||||
int res;
|
||||
|
||||
if (args_str)
|
||||
args = pw_properties_new_string(args_str);
|
||||
else
|
||||
args = pw_properties_new(NULL, NULL);
|
||||
|
||||
if ((str = pw_properties_get(args, "access.legacy")) != NULL) {
|
||||
impl->legacy = spa_atob(str);
|
||||
} else if (pw_properties_get(args, "access.socket")) {
|
||||
|
|
@ -347,10 +357,11 @@ static int parse_args(struct impl *impl, const struct pw_properties *props, cons
|
|||
}
|
||||
|
||||
SPA_EXPORT
|
||||
int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
||||
int pipewire__module_init(struct pw_impl_module *module, const char *args_str)
|
||||
{
|
||||
struct pw_context *context = pw_impl_module_get_context(module);
|
||||
const struct pw_properties *props = pw_context_get_properties(context);
|
||||
spa_autoptr(pw_properties) args = NULL;
|
||||
struct impl *impl;
|
||||
int res;
|
||||
|
||||
|
|
@ -360,7 +371,19 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
if (impl == NULL)
|
||||
return -errno;
|
||||
|
||||
pw_log_debug("module %p: new %s", impl, args);
|
||||
pw_log_debug("module %p: new %s", impl, args_str);
|
||||
|
||||
if (args_str)
|
||||
args = pw_properties_new_string(args_str);
|
||||
else
|
||||
args = pw_properties_new(NULL, NULL);
|
||||
|
||||
if (!args) {
|
||||
res = -errno;
|
||||
goto error;
|
||||
}
|
||||
|
||||
pw_context_conf_update_props(context, "module."NAME".args", args);
|
||||
|
||||
impl->socket_access = pw_properties_new(NULL, NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -130,6 +130,22 @@ PW_LOG_TOPIC(mod_topic_connection, "conn." NAME);
|
|||
* local context. This can be done even when the server is not a daemon. It can
|
||||
* be used to treat a local context as if it was a server.
|
||||
*
|
||||
* ## Config override
|
||||
*
|
||||
* A `module.protocol-native.args` config section can be added
|
||||
* to override the module arguments.
|
||||
*
|
||||
*\code{.unparsed}
|
||||
* # ~/.config/pipewire/pipewire.conf.d/my-protocol-native-args.conf
|
||||
*
|
||||
* module.protocol-native.args = {
|
||||
* sockets = [
|
||||
* { name = "pipewire-0" }
|
||||
* { name = "pipewire-0-manager" }
|
||||
* ]
|
||||
* }
|
||||
*\endcode
|
||||
*
|
||||
* ## Example configuration
|
||||
*
|
||||
*\code{.unparsed}
|
||||
|
|
@ -1798,7 +1814,11 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args_str)
|
|||
return -EEXIST;
|
||||
}
|
||||
|
||||
args = args_str ? pw_properties_new_string(args_str) : NULL;
|
||||
args = args_str ? pw_properties_new_string(args_str) : pw_properties_new(NULL, NULL);
|
||||
if (!args)
|
||||
return -errno;
|
||||
|
||||
pw_context_conf_update_props(context, "module."NAME".args", args);
|
||||
|
||||
this = pw_protocol_new(context, PW_TYPE_INFO_PROTOCOL_Native, sizeof(struct protocol_data));
|
||||
if (this == NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue