mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
filter-graph: add NULL data support per port
It would be good to define NULL support per port in e.g. LV2 plugins where sidechains are usually defined optional.
This commit is contained in:
parent
97a1609b29
commit
2ac708d916
2 changed files with 14 additions and 6 deletions
|
|
@ -27,10 +27,11 @@ struct spa_fga_plugin_methods {
|
||||||
struct spa_fga_port {
|
struct spa_fga_port {
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
const char *name;
|
const char *name;
|
||||||
#define SPA_FGA_PORT_INPUT (1ULL << 0)
|
#define SPA_FGA_PORT_INPUT (1ULL << 0)
|
||||||
#define SPA_FGA_PORT_OUTPUT (1ULL << 1)
|
#define SPA_FGA_PORT_OUTPUT (1ULL << 1)
|
||||||
#define SPA_FGA_PORT_CONTROL (1ULL << 2)
|
#define SPA_FGA_PORT_CONTROL (1ULL << 2)
|
||||||
#define SPA_FGA_PORT_AUDIO (1ULL << 3)
|
#define SPA_FGA_PORT_AUDIO (1ULL << 3)
|
||||||
|
#define SPA_FGA_PORT_SUPPORTS_NULL_DATA (1ULL << 4)
|
||||||
uint64_t flags;
|
uint64_t flags;
|
||||||
|
|
||||||
#define SPA_FGA_HINT_BOOLEAN (1ULL << 0)
|
#define SPA_FGA_HINT_BOOLEAN (1ULL << 0)
|
||||||
|
|
@ -47,6 +48,7 @@ struct spa_fga_port {
|
||||||
#define SPA_FGA_IS_PORT_OUTPUT(x) ((x) & SPA_FGA_PORT_OUTPUT)
|
#define SPA_FGA_IS_PORT_OUTPUT(x) ((x) & SPA_FGA_PORT_OUTPUT)
|
||||||
#define SPA_FGA_IS_PORT_CONTROL(x) ((x) & SPA_FGA_PORT_CONTROL)
|
#define SPA_FGA_IS_PORT_CONTROL(x) ((x) & SPA_FGA_PORT_CONTROL)
|
||||||
#define SPA_FGA_IS_PORT_AUDIO(x) ((x) & SPA_FGA_PORT_AUDIO)
|
#define SPA_FGA_IS_PORT_AUDIO(x) ((x) & SPA_FGA_PORT_AUDIO)
|
||||||
|
#define SPA_FGA_SUPPORTS_NULL_DATA(x) ((x) & SPA_FGA_PORT_SUPPORTS_NULL_DATA)
|
||||||
|
|
||||||
struct spa_fga_descriptor {
|
struct spa_fga_descriptor {
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
|
||||||
|
|
@ -1619,6 +1619,8 @@ static int impl_activate(void *object, const struct spa_dict *props)
|
||||||
if ((res = port_ensure_data(link->output, i, max_samples)) < 0)
|
if ((res = port_ensure_data(link->output, i, max_samples)) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
data = link->output->audio_data[i];
|
data = link->output->audio_data[i];
|
||||||
|
} else if (SPA_FGA_SUPPORTS_NULL_DATA(d->ports[port->p].flags)) {
|
||||||
|
data = NULL;
|
||||||
} else {
|
} else {
|
||||||
data = sd;
|
data = sd;
|
||||||
}
|
}
|
||||||
|
|
@ -1629,9 +1631,13 @@ static int impl_activate(void *object, const struct spa_dict *props)
|
||||||
for (j = 0; j < desc->n_output; j++) {
|
for (j = 0; j < desc->n_output; j++) {
|
||||||
port = &node->output_port[j];
|
port = &node->output_port[j];
|
||||||
if (port->audio_data[i] == NULL) {
|
if (port->audio_data[i] == NULL) {
|
||||||
|
if (SPA_FGA_SUPPORTS_NULL_DATA(d->ports[port->p].flags))
|
||||||
|
data = NULL;
|
||||||
|
else
|
||||||
|
data = dd;
|
||||||
spa_log_info(impl->log, "connect output port %s[%d]:%s %p",
|
spa_log_info(impl->log, "connect output port %s[%d]:%s %p",
|
||||||
node->name, i, d->ports[port->p].name, dd);
|
node->name, i, d->ports[port->p].name, data);
|
||||||
d->connect_port(node->hndl[i], port->p, dd);
|
d->connect_port(node->hndl[i], port->p, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (j = 0; j < desc->n_control; j++) {
|
for (j = 0; j < desc->n_control; j++) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue