From 7ccf40ee3bb2d91e6fad6e40acaa7ac9e2e1b4fb Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen Date: Thu, 25 Oct 2007 05:49:11 +0000 Subject: Add "support" for plugins that have control output ports, i.e. don't crash on them anymore (the plugins correctly assume that every port is connected to a buffer, so we connect them to a dummy buffer that isn't used anywhere). git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1952 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/modules/module-ladspa-sink.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c index 29ca89f0..0265d971 100644 --- a/src/modules/module-ladspa-sink.c +++ b/src/modules/module-ladspa-sink.c @@ -21,6 +21,9 @@ USA. ***/ +/* TODO: Some plugins cause latency, and some even report it by using a control + out port. We don't currently use the latency information. */ + #ifdef HAVE_CONFIG_H #include #endif @@ -71,6 +74,10 @@ struct userdata { unsigned long input_port, output_port; LADSPA_Data *control; + /* This is a dummy buffer. Every port must be connected, but we don't care + about control out ports. We connect them all to this single buffer. */ + LADSPA_Data control_out; + pa_memchunk memchunk; }; @@ -386,8 +393,10 @@ int pa__init(pa_module*m) { } else if (LADSPA_IS_PORT_INPUT(d->PortDescriptors[p]) && LADSPA_IS_PORT_CONTROL(d->PortDescriptors[p])) n_control++; - else - pa_log("Cannot handle type of port %s", d->PortNames[p]); + else { + pa_assert(LADSPA_IS_PORT_OUTPUT(d->PortDescriptors[p]) && LADSPA_IS_PORT_CONTROL(d->PortDescriptors[p])); + pa_log_info("Ignored port \"%s\", because we ignore all control out ports.", d->PortNames[p]); + } } if ((input_port == (unsigned long) -1) || (output_port == (unsigned long) -1)) { @@ -466,9 +475,15 @@ int pa__init(pa_module*m) { for (p = 0; p < d->PortCount; p++) { LADSPA_PortRangeHintDescriptor hint = d->PortRangeHints[p].HintDescriptor; - if (!LADSPA_IS_PORT_INPUT(d->PortDescriptors[p]) || !LADSPA_IS_PORT_CONTROL(d->PortDescriptors[p])) + if (!LADSPA_IS_PORT_CONTROL(d->PortDescriptors[p])) continue; + if (LADSPA_IS_PORT_OUTPUT(d->PortDescriptors[p])) { + for (c = 0; c < ss.channels; c++) + d->connect_port(u->handle[c], p, &u->control_out); + continue; + } + pa_assert(h < n_control); if (use_default[h]) { -- cgit