Add option to not connect jack ports automatically

This commit is contained in:
Richard Dodd 2019-07-15 17:52:43 +01:00 committed by Max Kellermann
parent 8f981845dc
commit 4f6a713b32
3 changed files with 14 additions and 0 deletions

2
NEWS
View File

@ -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

View File

@ -864,6 +864,10 @@ The jack plugin connects to a `JACK server <http://jackaudio.org/>`_.
- 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.

View File

@ -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,