filter-graph: pass spa_pod in get_props

This commit is contained in:
Wim Taymans 2024-12-10 16:10:27 +01:00
parent 094a45a6f7
commit 9f9e962dd6
3 changed files with 19 additions and 11 deletions

View file

@ -77,8 +77,9 @@ struct spa_filter_graph_methods {
const struct spa_filter_graph_events *events,
void *data);
int (*enum_prop_info) (void *object, uint32_t idx, struct spa_pod_builder *b);
int (*get_props) (void *object, struct spa_pod_builder *b, const struct spa_pod **props);
int (*enum_prop_info) (void *object, uint32_t idx, struct spa_pod_builder *b,
struct spa_pod **param);
int (*get_props) (void *object, struct spa_pod_builder *b, struct spa_pod **props);
int (*set_props) (void *object, enum spa_direction direction, const struct spa_pod *props);
int (*activate) (void *object, const struct spa_dict *props);
@ -101,13 +102,13 @@ SPA_API_FILTER_GRAPH int spa_filter_graph_add_listener(struct spa_filter_graph *
}
SPA_API_FILTER_GRAPH int spa_filter_graph_enum_prop_info(struct spa_filter_graph *object,
uint32_t idx, struct spa_pod_builder *b)
uint32_t idx, struct spa_pod_builder *b, struct spa_pod **param)
{
return spa_api_method_r(int, -ENOTSUP,
spa_filter_graph, &object->iface, enum_prop_info, 0, idx, b);
spa_filter_graph, &object->iface, enum_prop_info, 0, idx, b, param);
}
SPA_API_FILTER_GRAPH int spa_filter_graph_get_props(struct spa_filter_graph *object,
struct spa_pod_builder *b, const struct spa_pod **props)
struct spa_pod_builder *b, struct spa_pod **props)
{
return spa_api_method_r(int, -ENOTSUP,
spa_filter_graph, &object->iface, get_props, 0, b, props);

View file

@ -359,10 +359,12 @@ static struct port *find_port(struct node *node, const char *name, int descripto
return NULL;
}
static int impl_enum_prop_info(void *object, uint32_t idx, struct spa_pod_builder *b)
static int impl_enum_prop_info(void *object, uint32_t idx, struct spa_pod_builder *b,
struct spa_pod **param)
{
struct impl *impl = object;
struct graph *graph = &impl->graph;
struct spa_pod *pod;
struct spa_pod_frame f[2];
struct port *port;
struct node *node;
@ -436,13 +438,16 @@ static int impl_enum_prop_info(void *object, uint32_t idx, struct spa_pod_builde
}
spa_pod_builder_prop(b, SPA_PROP_INFO_params, 0);
spa_pod_builder_bool(b, true);
if (spa_pod_builder_pop(b, &f[0]) == NULL)
pod = spa_pod_builder_pop(b, &f[0]);
if (pod == NULL)
return -ENOSPC;
if (param)
*param = pod;
return 1;
}
static int impl_get_props(void *object, struct spa_pod_builder *b, const struct spa_pod **props)
static int impl_get_props(void *object, struct spa_pod_builder *b, struct spa_pod **props)
{
struct impl *impl = object;
struct graph *graph = &impl->graph;
@ -705,8 +710,10 @@ static int impl_set_props(void *object, enum spa_direction direction, const stru
sync_volume(graph, vol);
spa_filter_graph_emit_apply_props(&impl->hooks, direction, props);
} else {
props = spa_pod_builder_pop(&b.b, &f[0]);
}
spa_filter_graph_emit_apply_props(&impl->hooks, direction, props);
spa_pod_dynamic_builder_clean(&b);

View file

@ -1153,7 +1153,7 @@ static int setup_streams(struct impl *impl)
for (i = 0;; i++) {
if ((offs = pw_array_add(&offsets, sizeof(uint32_t))) != NULL)
*offs = b.b.state.offset;
if (spa_filter_graph_enum_prop_info(graph, i, &b.b) != 1)
if (spa_filter_graph_enum_prop_info(graph, i, &b.b, NULL) != 1)
break;
}
@ -1251,7 +1251,7 @@ static void graph_props_changed(void *object, enum spa_direction direction)
const struct spa_pod *params[1];
spa_pod_dynamic_builder_init(&b, buffer, sizeof(buffer), 4096);
spa_filter_graph_get_props(graph, &b.b, &params[0]);
spa_filter_graph_get_props(graph, &b.b, (struct spa_pod **)&params[0]);
pw_stream_update_params(impl->capture, params, 1);
spa_pod_dynamic_builder_clean(&b);