mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-07-04 00:06:43 -04:00
Revert "filter-graph: pass context to plugins"
This reverts commit 5e521d3532.
I think this can be done in a better, more flexible way with a new
method on the filter-graph to set io areas.
This commit is contained in:
parent
c4a9023215
commit
c06b6c53c2
10 changed files with 17 additions and 67 deletions
|
|
@ -52,12 +52,6 @@ struct spa_filter_graph_info {
|
|||
struct spa_dict *props;
|
||||
};
|
||||
|
||||
struct spa_filter_graph_ctx {
|
||||
const char *type;
|
||||
void *data;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
struct spa_filter_graph_events {
|
||||
#define SPA_VERSION_FILTER_GRAPH_EVENTS 0
|
||||
uint32_t version;
|
||||
|
|
@ -83,8 +77,7 @@ 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 (*activate) (void *object, const struct spa_dict *props,
|
||||
uint32_t n_ctx, const struct spa_filter_graph_ctx ctx[]);
|
||||
int (*activate) (void *object, const struct spa_dict *props);
|
||||
int (*deactivate) (void *object);
|
||||
|
||||
int (*reset) (void *object);
|
||||
|
|
@ -121,11 +114,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_dict *props, uint32_t n_ctx, const struct spa_filter_graph_ctx ctx[])
|
||||
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, props, n_ctx, ctx);
|
||||
spa_filter_graph, &object->iface, activate, 0, props);
|
||||
}
|
||||
SPA_API_FILTER_GRAPH int spa_filter_graph_deactivate(struct spa_filter_graph *object)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1278,8 +1278,7 @@ static int setup_filter_graph(struct impl *this, struct filter_graph *g,
|
|||
res = spa_filter_graph_activate(g->graph,
|
||||
&SPA_DICT_ITEMS(
|
||||
SPA_DICT_ITEM(SPA_KEY_AUDIO_RATE, rate_str),
|
||||
SPA_DICT_ITEM("filter-graph.n_inputs", channels ? in_ports : NULL)),
|
||||
0, NULL);
|
||||
SPA_DICT_ITEM("filter-graph.n_inputs", channels ? in_ports : NULL)));
|
||||
|
||||
g->setup = res >= 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -51,12 +51,6 @@ struct spa_fga_port {
|
|||
#define SPA_FGA_SUPPORTS_NULL_DATA(x) ((x) & SPA_FGA_PORT_SUPPORTS_NULL_DATA)
|
||||
#define SPA_FGA_IS_PORT_SEQUENCE(x) ((x) & SPA_FGA_PORT_SEQUENCE)
|
||||
|
||||
struct spa_fga_ctx {
|
||||
const char *type;
|
||||
const void *data;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
struct spa_fga_descriptor {
|
||||
const char *name;
|
||||
#define SPA_FGA_DESCRIPTOR_SUPPORTS_NULL_DATA (1ULL << 0)
|
||||
|
|
@ -77,7 +71,7 @@ struct spa_fga_descriptor {
|
|||
void (*control_changed) (void *instance);
|
||||
void (*control_sync) (void *instance);
|
||||
|
||||
void (*activate) (void *instance, uint32_t n_ctx, const struct spa_fga_ctx ctx[]);
|
||||
void (*activate) (void *instance);
|
||||
void (*deactivate) (void *instance);
|
||||
|
||||
void (*run) (void *instance, unsigned long SampleCount);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.filter-graph");
|
|||
|
||||
#define MAX_HNDL 64
|
||||
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||
#define MAX_CTX 8u
|
||||
|
||||
#define DEFAULT_RATE 48000
|
||||
|
||||
|
|
@ -228,8 +227,6 @@ struct impl {
|
|||
|
||||
uint64_t info_all;
|
||||
struct spa_filter_graph_info info;
|
||||
struct spa_fga_ctx ctx[MAX_CTX];
|
||||
uint32_t n_ctx;
|
||||
|
||||
struct graph graph;
|
||||
|
||||
|
|
@ -711,7 +708,7 @@ static int impl_reset(void *object)
|
|||
if (d->deactivate)
|
||||
d->deactivate(*hndl->hndl);
|
||||
if (d->activate)
|
||||
d->activate(*hndl->hndl, impl->n_ctx, impl->ctx);
|
||||
d->activate(*hndl->hndl);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1630,8 +1627,7 @@ static struct node *sort_next_node(struct graph *graph)
|
|||
|
||||
static int setup_graph(struct graph *graph);
|
||||
|
||||
static int impl_activate(void *object, const struct spa_dict *props,
|
||||
uint32_t n_ctx, const struct spa_filter_graph_ctx ctx[])
|
||||
static int impl_activate(void *object, const struct spa_dict *props)
|
||||
{
|
||||
struct impl *impl = object;
|
||||
struct graph *graph = &impl->graph;
|
||||
|
|
@ -1649,16 +1645,7 @@ static int impl_activate(void *object, const struct spa_dict *props,
|
|||
if (graph->activated)
|
||||
return 0;
|
||||
|
||||
if (n_ctx > MAX_CTX)
|
||||
return -EINVAL;
|
||||
|
||||
graph->activated = true;
|
||||
for (i = 0; i < n_ctx; i++) {
|
||||
impl->ctx[i].type = ctx[i].type;
|
||||
impl->ctx[i].data = ctx[i].data;
|
||||
impl->ctx[i].size = ctx[i].size;
|
||||
}
|
||||
impl->n_ctx = n_ctx;
|
||||
|
||||
rate = spa_dict_lookup(props, SPA_KEY_AUDIO_RATE);
|
||||
impl->rate = rate ? atoi(rate) : DEFAULT_RATE;
|
||||
|
|
@ -1775,7 +1762,7 @@ static int impl_activate(void *object, const struct spa_dict *props,
|
|||
|
||||
for (i = 0; i < node->n_hndl; i++) {
|
||||
if (d->activate)
|
||||
d->activate(node->hndl[i], impl->n_ctx, impl->ctx);
|
||||
d->activate(node->hndl[i]);
|
||||
}
|
||||
}
|
||||
emit_node_control_changed(impl);
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ static void bq_freq_update(struct builtin *impl, int type, float freq, float Q,
|
|||
impl->port[10][0] = impl->a2 = bq->a2;
|
||||
}
|
||||
|
||||
static void bq_activate(void * Instance, uint32_t n_ctx, const struct spa_fga_ctx ctx[])
|
||||
static void bq_activate(void * Instance)
|
||||
{
|
||||
struct builtin *impl = Instance;
|
||||
if (impl->type == BQ_NONE) {
|
||||
|
|
@ -1285,7 +1285,7 @@ static struct spa_fga_port convolve_ports[] = {
|
|||
},
|
||||
};
|
||||
|
||||
static void convolver_activate(void * Instance, uint32_t n_ctx, const struct spa_fga_ctx ctx[])
|
||||
static void convolver_activate(void * Instance)
|
||||
{
|
||||
struct convolver_impl *impl = Instance;
|
||||
if (impl->port[2] != NULL)
|
||||
|
|
@ -1447,7 +1447,7 @@ static void convolver2_run(void * Instance, unsigned long SampleCount)
|
|||
impl->port[1][0] = impl->latency;
|
||||
}
|
||||
|
||||
static void convolver2_activate(void * Instance, uint32_t n_ctx, const struct spa_fga_ctx ctx[])
|
||||
static void convolver2_activate(void * Instance)
|
||||
{
|
||||
struct convolver_impl *impl = Instance;
|
||||
if (impl->port[1] != NULL)
|
||||
|
|
@ -1621,7 +1621,7 @@ static void delay_connect_port(void * Instance, unsigned long Port,
|
|||
impl->port[Port] = DataLocation;
|
||||
}
|
||||
|
||||
static void delay_activate(void * Instance, uint32_t n_ctx, const struct spa_fga_ctx ctx[])
|
||||
static void delay_activate(void * Instance)
|
||||
{
|
||||
struct delay_impl *impl = Instance;
|
||||
if (impl->port[3] != NULL)
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ static void ebur128_cleanup(void * Instance)
|
|||
free(impl);
|
||||
}
|
||||
|
||||
static void ebur128_activate(void * Instance, uint32_t n_ctx, const struct spa_fga_ctx ctx[])
|
||||
static void ebur128_activate(void * Instance)
|
||||
{
|
||||
struct ebur128_impl *impl = Instance;
|
||||
unsigned long max_window;
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ static const struct spa_fga_descriptor *ladspa_plugin_make_desc(void *plugin, co
|
|||
desc->desc.instantiate = ladspa_instantiate;
|
||||
desc->desc.cleanup = d->cleanup;
|
||||
desc->desc.connect_port = (__typeof__(desc->desc.connect_port))d->connect_port;
|
||||
desc->desc.activate = (__typeof__(desc->desc.activate))d->activate;
|
||||
desc->desc.activate = d->activate;
|
||||
desc->desc.deactivate = d->deactivate;
|
||||
desc->desc.run = d->run;
|
||||
|
||||
|
|
|
|||
|
|
@ -491,7 +491,7 @@ static void lv2_connect_port(void *instance, unsigned long port, void *data)
|
|||
lilv_instance_connect_port(i->instance, port, data);
|
||||
}
|
||||
|
||||
static void lv2_activate(void *instance, uint32_t n_ctx, const struct spa_fga_ctx ctx[])
|
||||
static void lv2_activate(void *instance)
|
||||
{
|
||||
struct instance *i = instance;
|
||||
lilv_instance_activate(i->instance);
|
||||
|
|
|
|||
|
|
@ -395,7 +395,7 @@ static void spatializer_control_changed(void * Instance)
|
|||
spatializer_reload(Instance);
|
||||
}
|
||||
|
||||
static void spatializer_activate(void * Instance, uint32_t n_ctx, const struct spa_fga_ctx ctx[])
|
||||
static void spatializer_activate(void * Instance)
|
||||
{
|
||||
struct spatializer_impl *impl = Instance;
|
||||
impl->port[6][0] = impl->latency;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue