pulse-server: fix module arg parsing

Parse the module arguments according to the pulseaudio syntax,
not our own syntax (which requires "" around a , delimter). Fixes
audio.position=FL,FR argument.

See #527
This commit is contained in:
Wim Taymans 2021-01-04 17:25:28 +01:00
parent 776147c125
commit 518365e350

View file

@ -133,6 +133,8 @@ static void add_props(struct pw_properties *props, const char *str)
f = ' '; f = ' ';
} }
e = strchr(p, f); e = strchr(p, f);
if (e == NULL)
e = strchr(p, '\0');
if (e == NULL) if (e == NULL)
break; break;
*e = '\0'; *e = '\0';
@ -156,11 +158,13 @@ static int load_module(struct client *client, const char *name, const char *argu
res = -EINVAL; res = -EINVAL;
goto out; goto out;
} }
props = pw_properties_new_string(argument); props = pw_properties_new(NULL, NULL);
if (props == NULL) { if (props == NULL) {
res = -EINVAL; res = -EINVAL;
goto out; goto out;
} }
add_props(props, argument);
if ((str = pw_properties_get(props, "sink_name")) != NULL) { if ((str = pw_properties_get(props, "sink_name")) != NULL) {
pw_properties_set(props, PW_KEY_NODE_NAME, str); pw_properties_set(props, PW_KEY_NODE_NAME, str);
pw_properties_set(props, "sink_name", NULL); pw_properties_set(props, "sink_name", NULL);