mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
modules: support overriding default module arguments
Add support for some modules to use a module.$NAME.args config section to override the arguments of the module. Update the docs. Add more conditions to the module loading, use !false to also load the module when the condition is not set and so that we don't have to explicitly set each condition to true. Improve module-profiler example config.
This commit is contained in:
parent
4cf4bd210f
commit
ec972d4fdf
4 changed files with 89 additions and 24 deletions
|
|
@ -61,6 +61,17 @@
|
|||
* }
|
||||
* ]
|
||||
*\endcode
|
||||
|
||||
* ## Config override
|
||||
*
|
||||
* A `module.jackdbus-detect.args` config section can be added in the override directory
|
||||
* to override the module arguments.
|
||||
*
|
||||
*\code{.unparsed}
|
||||
* module.jackdbus-detect.args = {
|
||||
* #tunnel.mode = duplex
|
||||
* }
|
||||
*\endcode
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -359,6 +370,9 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
impl->context = context;
|
||||
impl->properties = args ? pw_properties_new_string(args) : NULL;
|
||||
|
||||
if (impl->properties)
|
||||
pw_context_conf_update_props(context, "module."NAME".args", impl->properties);
|
||||
|
||||
impl->conn = spa_dbus_get_connection(dbus, SPA_DBUS_TYPE_SESSION);
|
||||
if (impl->conn == NULL) {
|
||||
res = -errno;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
*
|
||||
* - `profile.interval.ms`: Can be used to avoid gathering profiling information
|
||||
* on every processing cycle. This allows trading off
|
||||
* CPU usage for profiling accuracy.
|
||||
* CPU usage for profiling accuracy. Default 0
|
||||
*
|
||||
* ## Example configuration
|
||||
*
|
||||
|
|
@ -47,9 +47,24 @@
|
|||
*
|
||||
*\code{.unparsed}
|
||||
* context.modules = [
|
||||
* { name = libpipewire-module-profiler }
|
||||
* { name = libpipewire-module-profiler
|
||||
* args = {
|
||||
* #profile.interval.ms = 0
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
*\endcode
|
||||
|
||||
* ## Config override
|
||||
*
|
||||
* A `module.profiler.args` config section can be added in the override directory
|
||||
* to override the module arguments.
|
||||
*
|
||||
*\code{.unparsed}
|
||||
* module.profiler.args = {
|
||||
* #profile.interval.ms = 10
|
||||
* }
|
||||
*\endcode
|
||||
*
|
||||
* ## See also
|
||||
*
|
||||
|
|
@ -513,6 +528,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
impl->properties = props;
|
||||
impl->main_loop = pw_context_get_main_loop(impl->context);
|
||||
|
||||
pw_context_conf_update_props(context, "module."NAME".args", props);
|
||||
|
||||
impl->interval = SPA_NSEC_PER_MSEC *
|
||||
pw_properties_get_uint32(props, "profile.interval.ms", DEFAULT_INTERVAL);
|
||||
impl->last_signal_time = 0;
|
||||
|
|
|
|||
|
|
@ -115,6 +115,17 @@
|
|||
* }
|
||||
* ]
|
||||
*\endcode
|
||||
*
|
||||
* ## Config override
|
||||
*
|
||||
* A `module.rt.args` config section can be added in the override directory
|
||||
* to override the module arguments.
|
||||
*
|
||||
*\code{.unparsed}
|
||||
* module.rt.args = {
|
||||
* nice.level = 22
|
||||
* }
|
||||
*\endcode
|
||||
*/
|
||||
|
||||
#define NAME "rt"
|
||||
|
|
@ -1076,6 +1087,7 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
res = -errno;
|
||||
goto error;
|
||||
}
|
||||
pw_context_conf_update_props(context, "module."NAME".args", props);
|
||||
|
||||
impl->context = context;
|
||||
impl->nice_level = pw_properties_get_int32(props, "nice.level", DEFAULT_NICE_LEVEL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue