diff --git a/NEWS b/NEWS index 9c4ea5a62..7a70c1bfb 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ ver 0.22 (not yet released) - ffmpeg: new plugin based on FFmpeg's libavfilter library - hdcd: new plugin based on FFmpeg's "af_hdcd" for HDCD playback - volume: convert S16 to S24 to preserve quality and reduce dithering noise +* output + - jack: add option "auto_destination_ports" * switch to C++17 - GCC 7 or clang 4 (or newer) recommended diff --git a/doc/plugins.rst b/doc/plugins.rst index 59283f262..55a914011 100644 --- a/doc/plugins.rst +++ b/doc/plugins.rst @@ -864,6 +864,10 @@ The jack plugin connects to a `JACK server `_. - The names of the JACK source ports to be created. By default, the ports "left" and "right" are created. To use more ports, you have to tweak this option. * - **destination_ports A,B** - The names of the JACK destination ports to connect to. + * - **auto_destination_ports yes|no** + - If set to *yes*, then MPD will automatically create connections between the send ports of + MPD and receive ports of the first sound card; if set to *no*, then MPD will only create + connections to the contents of *destination_ports* if it is set. Enabled by default. * - **ringbuffer_size NBYTES** - Sets the size of the ring buffer for each channel. Do not configure this value unless you know what you're doing. diff --git a/src/output/plugins/JackOutputPlugin.cxx b/src/output/plugins/JackOutputPlugin.cxx index 686aa89aa..bb4b8a721 100644 --- a/src/output/plugins/JackOutputPlugin.cxx +++ b/src/output/plugins/JackOutputPlugin.cxx @@ -57,6 +57,8 @@ struct JackOutput final : AudioOutput { std::string destination_ports[MAX_PORTS]; unsigned num_destination_ports; + /* overrides num_destination_ports*/ + bool auto_destination_ports; size_t ringbuffer_size; @@ -201,6 +203,8 @@ JackOutput::JackOutput(const ConfigBlock &block) num_destination_ports = 0; } + auto_destination_ports = block.GetBlockValue("auto_destination_ports", true); + if (num_destination_ports > 0 && num_destination_ports != num_source_ports) FormatWarning(jack_output_domain, @@ -498,6 +502,10 @@ JackOutput::Start() const char *dports[MAX_PORTS], **jports; unsigned num_dports; if (num_destination_ports == 0) { + /* if user requests no auto connect, we are done */ + if (!auto_destination_ports) { + return; + } /* no output ports were configured - ask libjack for defaults */ jports = jack_get_ports(client, nullptr, nullptr,