mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
daemon: support containers as arguments
so that
ags = "foo=bar baz=5"
can be written as:
args = { foo = bar baz = 5 }
This commit is contained in:
parent
ff416cdc9e
commit
23fd40df94
2 changed files with 31 additions and 17 deletions
|
|
@ -145,9 +145,9 @@ static int parse_modules(struct data *d, const char *str)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
while (spa_json_get_string(&it[1], key, sizeof(key)-1) > 0) {
|
while (spa_json_get_string(&it[1], key, sizeof(key)-1) > 0) {
|
||||||
const char *val;
|
const char *val, *aval;
|
||||||
char *args = NULL, *flags = NULL;
|
char *args = NULL, *flags = NULL;
|
||||||
int len;
|
int len, alen;
|
||||||
|
|
||||||
if ((len = spa_json_next(&it[1], &val)) <= 0)
|
if ((len = spa_json_next(&it[1], &val)) <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
@ -156,18 +156,22 @@ static int parse_modules(struct data *d, const char *str)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (spa_json_is_object(val, len)) {
|
if (spa_json_is_object(val, len)) {
|
||||||
char arg[512], aval[1024];
|
char arg[512];
|
||||||
|
|
||||||
spa_json_enter(&it[1], &it[2]);
|
spa_json_enter(&it[1], &it[2]);
|
||||||
|
|
||||||
while (spa_json_get_string(&it[2], arg, sizeof(arg)-1) > 0) {
|
while (spa_json_get_string(&it[2], arg, sizeof(arg)-1) > 0) {
|
||||||
if (spa_json_get_string(&it[2], aval, sizeof(aval)-1) <= 0)
|
if ((alen = spa_json_next(&it[2], &aval)) <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (strcmp(arg, "args") == 0) {
|
if (strcmp(arg, "args") == 0) {
|
||||||
args = strdup(aval);
|
if (spa_json_is_container(aval, alen))
|
||||||
|
alen = spa_json_container_len(&it[2], aval, alen);
|
||||||
|
|
||||||
|
args = malloc(alen);
|
||||||
|
spa_json_parse_string(aval, alen, args);
|
||||||
} else if (strcmp(arg, "flags") == 0) {
|
} else if (strcmp(arg, "flags") == 0) {
|
||||||
flags = strdup(aval);
|
flags = strndup(aval, alen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -223,9 +227,9 @@ static int parse_objects(struct data *d, const char *str)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
while (spa_json_get_string(&it[1], key, sizeof(key)-1) > 0) {
|
while (spa_json_get_string(&it[1], key, sizeof(key)-1) > 0) {
|
||||||
const char *val;
|
const char *val, *aval;
|
||||||
char *args = NULL, *flags = NULL;
|
char *args = NULL, *flags = NULL;
|
||||||
int len;
|
int len, alen;
|
||||||
|
|
||||||
if ((len = spa_json_next(&it[1], &val)) <= 0)
|
if ((len = spa_json_next(&it[1], &val)) <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
@ -234,18 +238,21 @@ static int parse_objects(struct data *d, const char *str)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (spa_json_is_object(val, len)) {
|
if (spa_json_is_object(val, len)) {
|
||||||
char arg[512], aval[1024];
|
char arg[512];
|
||||||
|
|
||||||
spa_json_enter(&it[1], &it[2]);
|
spa_json_enter(&it[1], &it[2]);
|
||||||
|
|
||||||
while (spa_json_get_string(&it[2], arg, sizeof(arg)-1) > 0) {
|
while (spa_json_get_string(&it[2], arg, sizeof(arg)-1) > 0) {
|
||||||
if (spa_json_get_string(&it[2], aval, sizeof(aval)-1) <= 0)
|
if ((alen = spa_json_next(&it[2], &aval)) <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (strcmp(arg, "args") == 0) {
|
if (strcmp(arg, "args") == 0) {
|
||||||
args = strdup(aval);
|
if (spa_json_is_container(aval, alen))
|
||||||
|
alen = spa_json_container_len(&it[2], aval, alen);
|
||||||
|
args = malloc(alen);
|
||||||
|
spa_json_parse_string(aval, alen, args);
|
||||||
} else if (strcmp(arg, "flags") == 0) {
|
} else if (strcmp(arg, "flags") == 0) {
|
||||||
flags = strdup(aval);
|
flags = strndup(aval, alen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,12 @@ modules = {
|
||||||
# If ifexists is given, the module is ignoed when it is not found.
|
# If ifexists is given, the module is ignoed when it is not found.
|
||||||
# If nofail is given, module initialization failures are ignored.
|
# If nofail is given, module initialization failures are ignored.
|
||||||
#
|
#
|
||||||
libpipewire-module-rtkit = {
|
libpipewire-module-rtkit = { "#args" = { nice.level = -11
|
||||||
"#args" = "nice.level = -11 rt.prio=20 rt.time.soft=200000 rt.time.hard=200000"
|
rt.prio = 20
|
||||||
flags = ifexists|nofail
|
rt.time.soft = 200000
|
||||||
|
rt.time.hard = 200000
|
||||||
|
}
|
||||||
|
"flags" = "ifexists|nofail"
|
||||||
}
|
}
|
||||||
libpipewire-module-protocol-native = null
|
libpipewire-module-protocol-native = null
|
||||||
libpipewire-module-profiler = null
|
libpipewire-module-profiler = null
|
||||||
|
|
@ -58,7 +61,7 @@ modules = {
|
||||||
libpipewire-module-client-node = null
|
libpipewire-module-client-node = null
|
||||||
libpipewire-module-client-device = null
|
libpipewire-module-client-device = null
|
||||||
libpipewire-module-portal = null
|
libpipewire-module-portal = null
|
||||||
libpipewire-module-access = { "#args" = "access.allowed=@media_session_path@ access.force=flatpak" }
|
libpipewire-module-access = { "#args" = { access.allowed = @media_session_path@ access.force = flatpak" } }
|
||||||
libpipewire-module-adapter = null
|
libpipewire-module-adapter = null
|
||||||
libpipewire-module-link-factory = null
|
libpipewire-module-link-factory = null
|
||||||
libpipewire-module-session-manager = null
|
libpipewire-module-session-manager = null
|
||||||
|
|
@ -80,7 +83,11 @@ objects = {
|
||||||
|
|
||||||
# A default dummy driver. This handles nodes marked with the "node.always-driver"
|
# A default dummy driver. This handles nodes marked with the "node.always-driver"
|
||||||
# property when no other driver is currently active. JACK clients need this.
|
# property when no other driver is currently active. JACK clients need this.
|
||||||
spa-node-factory = { args = "factory.name=support.node.driver node.name=Dummy-Driver priority.driver=8000" }
|
spa-node-factory = { args = { factory.name = support.node.driver
|
||||||
|
node.name = Dummy-Driver
|
||||||
|
priority.driver = 8000
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exec = {
|
exec = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue