From dc47f9ea45b0082a56d3913a04c2c0428e4146e0 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 8 Apr 2026 17:45:28 +0200 Subject: [PATCH] filter-graph: return current control value correctly The control values are only set in the port control_data after the filter has been activated and the instances are created. Property enumerations might happen before that and then we can either return the current_value (when set in a control section or later with a param property) or the default value. --- spa/plugins/filter-graph/filter-graph.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/spa/plugins/filter-graph/filter-graph.c b/spa/plugins/filter-graph/filter-graph.c index c806da591..4b47d0c9f 100644 --- a/spa/plugins/filter-graph/filter-graph.c +++ b/spa/plugins/filter-graph/filter-graph.c @@ -554,19 +554,25 @@ static int impl_get_props(void *object, struct spa_pod_builder *b, struct spa_po struct descriptor *desc = node->desc; const struct spa_fga_descriptor *d = desc->desc; struct spa_fga_port *p = &d->ports[port->p]; + float v, min, max; if (node->name[0] != '\0') snprintf(name, sizeof(name), "%s:%s", node->name, p->name); else snprintf(name, sizeof(name), "%s", p->name); + if (port->control_initialized) + v = port->control_current; + else + get_ranges(impl, p, &v, &min, &max); + spa_pod_builder_string(b, name); if (p->hint & SPA_FGA_HINT_BOOLEAN) { - spa_pod_builder_bool(b, port->control_data[0] <= 0.0f ? false : true); + spa_pod_builder_bool(b, v <= 0.0f ? false : true); } else if (p->hint & SPA_FGA_HINT_INTEGER) { - spa_pod_builder_int(b, (int32_t)port->control_data[0]); + spa_pod_builder_int(b, (int32_t)v); } else { - spa_pod_builder_float(b, port->control_data[0]); + spa_pod_builder_float(b, v); } } spa_pod_builder_pop(b, &f[1]);