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.
This commit is contained in:
Wim Taymans 2026-04-08 17:45:28 +02:00
parent 0f00ad19cb
commit dc47f9ea45

View file

@ -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]);