spa-node: use new function to parse arguments

This commit is contained in:
Wim Taymans 2018-01-27 11:27:12 +01:00
parent 5fbf79a4b2
commit 1361a12094

View file

@ -57,7 +57,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
{ {
struct pw_properties *props = NULL; struct pw_properties *props = NULL;
char **argv; char **argv;
int i, n_tokens; int n_tokens;
struct pw_core *core = pw_module_get_core(module); struct pw_core *core = pw_module_get_core(module);
struct pw_node *node; struct pw_node *node;
struct node_data *data; struct node_data *data;
@ -65,23 +65,14 @@ int pipewire__module_init(struct pw_module *module, const char *args)
if (args == NULL) if (args == NULL)
goto wrong_arguments; goto wrong_arguments;
argv = pw_split_strv(args, " \t", INT_MAX, &n_tokens); argv = pw_split_strv(args, " \t", 4, &n_tokens);
if (n_tokens < 3) if (n_tokens < 3)
goto not_enough_arguments; goto not_enough_arguments;
props = pw_properties_new(NULL, NULL); if (n_tokens == 4) {
if (props == NULL) props = pw_properties_new_string(argv[3]);
return -ENOMEM; if (props == NULL)
return -ENOMEM;
for (i = 3; i < n_tokens; i++) {
char **prop;
int n_props;
prop = pw_split_strv(argv[i], "=", INT_MAX, &n_props);
if (n_props >= 2)
pw_properties_set(props, prop[0], prop[1]);
pw_free_strv(prop);
} }
node = pw_spa_node_load(core, node = pw_spa_node_load(core,