filter-graph: accept String param values

We parse the string as a float and if that works, set the value.
This commit is contained in:
Wim Taymans 2025-10-10 15:03:04 +02:00
parent 16ce5a2ccf
commit 4da25df986

View file

@ -613,7 +613,7 @@ static int parse_params(struct graph *graph, const struct spa_pod *pod)
return 0;
while (true) {
const char *name;
const char *name, *str_val;
float value, *val = NULL;
double dbl_val;
bool bool_val;
@ -636,6 +636,9 @@ static int parse_params(struct graph *graph, const struct spa_pod *pod)
} else if (spa_pod_parser_get_bool(&prs, &bool_val) >= 0) {
value = bool_val ? 1.0f : 0.0f;
val = &value;
} else if (spa_pod_parser_get_string(&prs, &str_val) >= 0 &&
spa_json_parse_float(str_val, strlen(str_val), &value) >= 0) {
val = &value;
} else {
struct spa_pod *pod;
spa_pod_parser_get_pod(&prs, &pod);