filter-graph: add a null plugin

It discards all input.
This commit is contained in:
Wim Taymans 2026-01-21 16:14:45 +01:00
parent a97c4d10af
commit 7f2cce1021
2 changed files with 35 additions and 0 deletions

View file

@ -3217,6 +3217,35 @@ static const struct spa_fga_descriptor busy_desc = {
.cleanup = builtin_cleanup,
};
/* null */
static void null_run(void * Instance, unsigned long SampleCount)
{
}
static struct spa_fga_port null_ports[] = {
{ .index = 0,
.name = "In",
.flags = SPA_FGA_PORT_INPUT | SPA_FGA_PORT_AUDIO,
},
{ .index = 1,
.name = "Control",
.flags = SPA_FGA_PORT_INPUT | SPA_FGA_PORT_CONTROL,
},
};
static const struct spa_fga_descriptor null_desc = {
.name = "null",
.flags = SPA_FGA_DESCRIPTOR_SUPPORTS_NULL_DATA,
.n_ports = SPA_N_ELEMENTS(null_ports),
.ports = null_ports,
.instantiate = builtin_instantiate,
.connect_port = builtin_connect_port,
.run = null_run,
.cleanup = builtin_cleanup,
};
static const struct spa_fga_descriptor * builtin_descriptor(unsigned long Index)
{
switch(Index) {
@ -3284,6 +3313,8 @@ static const struct spa_fga_descriptor * builtin_descriptor(unsigned long Index)
return &noisegate_desc;
case 31:
return &busy_desc;
case 32:
return &null_desc;
}
return NULL;
}

View file

@ -682,6 +682,10 @@ extern struct spa_handle_factory spa_filter_graph_factory;
* - `cpu-percent` the percentage of time to keep the CPU busy. This keeps both the
* graph and CPU busy. Default 0.0
*
* ### Null
*
* The `null` plugin has one data input "In" and one control input "Control" that
* simply discards the data.
*
* ## SOFA filters
*