mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-05 05:28:01 +02:00
daemon config: add the ability to register spa libraries from the config file
This commit is contained in:
parent
340b52fbee
commit
d5acbdd87c
2 changed files with 27 additions and 2 deletions
27
src/main.c
27
src/main.c
|
|
@ -9,6 +9,7 @@
|
|||
#include <wp/wp.h>
|
||||
#include <gio/gio.h>
|
||||
#include <glib-unix.h>
|
||||
#include <pipewire/pipewire.h>
|
||||
|
||||
static GOptionEntry entries[] =
|
||||
{
|
||||
|
|
@ -98,7 +99,7 @@ parse_commands_file (struct WpDaemonData *d, GInputStream * stream,
|
|||
gchar buffer[4096];
|
||||
gssize bytes_read;
|
||||
gchar *cur, *linestart, *saveptr;
|
||||
gchar *cmd, *abi, *module, *props;
|
||||
gchar *cmd;
|
||||
gint lineno = 1, block_lines = 1, in_block = 0;
|
||||
gboolean eof = FALSE;
|
||||
GVariant *properties;
|
||||
|
|
@ -148,6 +149,8 @@ parse_commands_file (struct WpDaemonData *d, GInputStream * stream,
|
|||
if (!cmd || cmd[0] == '#') {
|
||||
/* empty line or comment, skip */
|
||||
} else if (!g_strcmp0 (cmd, "load-module")) {
|
||||
gchar *abi, *module, *props;
|
||||
|
||||
abi = strtok_r (NULL, " ", &saveptr);
|
||||
module = strtok_r (NULL, " ", &saveptr);
|
||||
|
||||
|
|
@ -181,6 +184,28 @@ parse_commands_file (struct WpDaemonData *d, GInputStream * stream,
|
|||
if (!wp_module_load (d->core, abi, module, properties, error)) {
|
||||
return FALSE;
|
||||
}
|
||||
} else if (!g_strcmp0 (cmd, "add-spa-lib")) {
|
||||
gchar *regex, *lib;
|
||||
gint ret;
|
||||
|
||||
regex = strtok_r (NULL, " ", &saveptr);
|
||||
lib = strtok_r (NULL, " ", &saveptr);
|
||||
|
||||
if (!regex || !lib ||
|
||||
(regex && regex[0] == '{') || (lib && lib[0] == '{'))
|
||||
{
|
||||
g_set_error (error, WP_DOMAIN_DAEMON, WP_CODE_INVALID_ARGUMENT,
|
||||
"expected REGEX and LIB at line %i", lineno);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ret = pw_core_add_spa_lib (wp_core_get_pw_core (d->core), regex, lib);
|
||||
if (ret < 0) {
|
||||
g_set_error (error, WP_DOMAIN_DAEMON, WP_CODE_OPERATION_FAILED,
|
||||
"failed to add spa lib ('%s' on '%s'): %s", regex, lib,
|
||||
g_strerror (-ret));
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
g_set_error (error, WP_DOMAIN_DAEMON, WP_CODE_INVALID_ARGUMENT,
|
||||
"unknown command '%s' at line %i", cmd, lineno);
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ executable('wireplumber',
|
|||
'-DWIREPLUMBER_DEFAULT_CONFIG_FILE="@0@"'.format(wireplumber_config_file),
|
||||
],
|
||||
install: true,
|
||||
dependencies : [gobject_dep, gio_dep, wp_dep],
|
||||
dependencies : [gobject_dep, gio_dep, wp_dep, pipewire_dep],
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue