diff --git a/spa/include/spa/filter-graph/filter-graph.h b/spa/include/spa/filter-graph/filter-graph.h index ac8a68225..af7f8dcd0 100644 --- a/spa/include/spa/filter-graph/filter-graph.h +++ b/spa/include/spa/filter-graph/filter-graph.h @@ -81,7 +81,7 @@ struct spa_filter_graph_methods { int (*get_props) (void *object, struct spa_pod_builder *b, const 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_fraction *rate); + int (*activate) (void *object, const struct spa_dict *props); int (*deactivate) (void *object); int (*reset) (void *object); @@ -120,10 +120,10 @@ 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_activate(struct spa_filter_graph *object, const struct spa_fraction *rate) +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, - spa_filter_graph, &object->iface, activate, 0, rate); + spa_filter_graph, &object->iface, activate, 0, props); } SPA_API_FILTER_GRAPH int spa_filter_graph_deactivate(struct spa_filter_graph *object) { diff --git a/spa/plugins/filter-graph/filter-graph.c b/spa/plugins/filter-graph/filter-graph.c index d50f22617..6190f59a3 100644 --- a/spa/plugins/filter-graph/filter-graph.c +++ b/spa/plugins/filter-graph/filter-graph.c @@ -1422,7 +1422,7 @@ static int impl_deactivate(void *object) return 0; } -static int impl_activate(void *object, const struct spa_fraction *rate) +static int impl_activate(void *object, const struct spa_dict *props) { struct impl *impl = object; struct graph *graph = &impl->graph; @@ -1435,13 +1435,15 @@ static int impl_activate(void *object, const struct spa_fraction *rate) uint32_t i, j, max_samples = impl->quantum_limit; int res; float *sd, *dd; + const char *rate; if (graph->activated) return 0; graph->activated = true; - impl->rate = rate->denom; + rate = spa_dict_lookup(props, SPA_KEY_AUDIO_RATE); + impl->rate = rate ? atoi(rate) : DEFAULT_RATE; /* first make instances */ spa_list_for_each(node, &graph->node_list, link) { diff --git a/src/modules/module-filter-chain.c b/src/modules/module-filter-chain.c index e4042e172..0b6584f16 100644 --- a/src/modules/module-filter-chain.c +++ b/src/modules/module-filter-chain.c @@ -1001,9 +1001,13 @@ static void state_changed(void *data, enum pw_stream_state old, goto error; } if (impl->rate != target) { + char rate[64]; impl->rate = target; + snprintf(rate, sizeof(rate), "%lu", impl->rate); spa_filter_graph_deactivate(graph); - if ((res = spa_filter_graph_activate(graph, &SPA_FRACTION(1, impl->rate))) < 0) + if ((res = spa_filter_graph_activate(graph, + &SPA_DICT_ITEMS( + SPA_DICT_ITEM(SPA_KEY_AUDIO_RATE, rate)))) < 0) goto error; } break;