mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
make PULSE_PROP env vars non-overriding but introduce PULSE_PROP_OVERRIDE for allowing overriding
This commit is contained in:
parent
689e6f8a81
commit
f863756b43
1 changed files with 25 additions and 7 deletions
|
|
@ -58,18 +58,27 @@ void pa_init_proplist(pa_proplist *p) {
|
|||
for (e = environ; *e; e++) {
|
||||
|
||||
if (pa_startswith(*e, "PULSE_PROP_")) {
|
||||
size_t kl = strcspn(*e+11, "=");
|
||||
size_t kl, skip;
|
||||
char *k;
|
||||
pa_bool_t override;
|
||||
|
||||
if ((*e)[11+kl] != '=')
|
||||
if (pa_startswith(*e, "PULSE_PROP_OVERRIDE_")) {
|
||||
skip = 20;
|
||||
override = TRUE;
|
||||
} else {
|
||||
skip = 11;
|
||||
override = FALSE;
|
||||
}
|
||||
|
||||
kl = strcspn(*e+skip, "=");
|
||||
|
||||
if ((*e)[skip+kl] != '=')
|
||||
continue;
|
||||
|
||||
if (!pa_utf8_valid(*e+11+kl+1))
|
||||
continue;
|
||||
k = pa_xstrndup(*e+skip, kl);
|
||||
|
||||
k = pa_xstrndup(*e+11, kl);
|
||||
|
||||
pa_proplist_sets(p, k, *e+11+kl+1);
|
||||
if (override || !pa_proplist_contains(p, k))
|
||||
pa_proplist_sets(p, k, *e+skip+kl+1);
|
||||
pa_xfree(k);
|
||||
}
|
||||
}
|
||||
|
|
@ -78,6 +87,15 @@ void pa_init_proplist(pa_proplist *p) {
|
|||
if ((pp = getenv("PULSE_PROP"))) {
|
||||
pa_proplist *t;
|
||||
|
||||
if ((t = pa_proplist_from_string(pp))) {
|
||||
pa_proplist_update(p, PA_UPDATE_MERGE, t);
|
||||
pa_proplist_free(t);
|
||||
}
|
||||
}
|
||||
|
||||
if ((pp = getenv("PULSE_PROP_OVERRIDE"))) {
|
||||
pa_proplist *t;
|
||||
|
||||
if ((t = pa_proplist_from_string(pp))) {
|
||||
pa_proplist_update(p, PA_UPDATE_REPLACE, t);
|
||||
pa_proplist_free(t);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue