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

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,