diff --git a/spa/include/spa/filter-graph/filter-graph.h b/spa/include/spa/filter-graph/filter-graph.h index 481085c5f..d8a30eeaa 100644 --- a/spa/include/spa/filter-graph/filter-graph.h +++ b/spa/include/spa/filter-graph/filter-graph.h @@ -77,6 +77,8 @@ struct spa_filter_graph_methods { 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 (*set_io) (void *object, const char *type, void *data, size_t size); + int (*activate) (void *object, const struct spa_dict *props); int (*deactivate) (void *object); @@ -114,6 +116,13 @@ SPA_API_FILTER_GRAPH int spa_filter_graph_set_props(struct spa_filter_graph *obj spa_filter_graph, &object->iface, set_props, 0, direction, props); } +SPA_API_FILTER_GRAPH int spa_filter_graph_set_io(struct spa_filter_graph *object, + const char *type, void *data, size_t size) +{ + return spa_api_method_r(int, -ENOTSUP, + spa_filter_graph, &object->iface, set_io, 0, type, data, size); +} + SPA_API_FILTER_GRAPH int spa_filter_graph_activate(struct spa_filter_graph *object, const struct spa_dict *props) { return spa_api_method_r(int, -ENOTSUP, diff --git a/spa/plugins/filter-graph/audio-plugin.h b/spa/plugins/filter-graph/audio-plugin.h index 1971135bf..5522b7763 100644 --- a/spa/plugins/filter-graph/audio-plugin.h +++ b/spa/plugins/filter-graph/audio-plugin.h @@ -67,6 +67,8 @@ struct spa_fga_descriptor { void (*cleanup) (void *instance); + void (*set_io) (void *instance, const char *type, void *data, size_t size); + void (*connect_port) (void *instance, unsigned long port, void *data); void (*control_changed) (void *instance); void (*control_sync) (void *instance); diff --git a/spa/plugins/filter-graph/filter-graph.c b/spa/plugins/filter-graph/filter-graph.c index b16e1cf13..d5229011b 100644 --- a/spa/plugins/filter-graph/filter-graph.c +++ b/spa/plugins/filter-graph/filter-graph.c @@ -875,6 +875,25 @@ static int impl_set_props(void *object, enum spa_direction direction, const stru return 0; } +static int impl_set_io(void *object, const char *type, void *data, size_t size) +{ + struct impl *impl = object; + struct graph *graph = &impl->graph; + struct node *node; + uint32_t i; + + spa_list_for_each(node, &graph->node_list, link) { + const struct spa_fga_descriptor *d = node->desc->desc; + if (d->set_io == NULL) + continue; + for (i = 0; i < node->n_hndl; i++) { + if (node->hndl[i] != NULL) + d->set_io(node->hndl[i], type, data, size); + } + } + return 0; +} + static uint32_t count_array(struct spa_json *json) { struct spa_json it = *json; @@ -1757,9 +1776,7 @@ static int impl_activate(void *object, const struct spa_dict *props) /* now activate */ spa_list_for_each(node, &graph->node_list, link) { - desc = node->desc; - d = desc->desc; - + d = node->desc->desc; for (i = 0; i < node->n_hndl; i++) { if (d->activate) d->activate(node->hndl[i]); @@ -2399,6 +2416,7 @@ static const struct spa_filter_graph_methods impl_filter_graph = { .enum_prop_info = impl_enum_prop_info, .get_props = impl_get_props, .set_props = impl_set_props, + .set_io = impl_set_io, .activate = impl_activate, .deactivate = impl_deactivate, .reset = impl_reset,