summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_jack.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio/out/ao_jack.c')
-rw-r--r--audio/out/ao_jack.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/audio/out/ao_jack.c b/audio/out/ao_jack.c
index c93d07c2a2..abcd73849c 100644
--- a/audio/out/ao_jack.c
+++ b/audio/out/ao_jack.c
@@ -191,6 +191,8 @@ static void print_help (void)
"Example: mpv -ao jack:port=myout\n"
" connects mpv to the jack ports named myout\n"
"\nOptions:\n"
+ " connect\n"
+ " Automatically connect to output ports\n"
" port=<port name>\n"
" Connects to the given ports instead of the default physical ones\n"
" name=<client name>\n"
@@ -208,11 +210,13 @@ static int init(int rate, const struct mp_chmap *channels, int format, int flags
char *port_name = NULL;
char *client_name = NULL;
int autostart = 0;
+ int connect = 1;
const opt_t subopts[] = {
{"port", OPT_ARG_MSTRZ, &port_name, NULL},
{"name", OPT_ARG_MSTRZ, &client_name, NULL},
{"estimate", OPT_ARG_BOOL, &estimate, NULL},
{"autostart", OPT_ARG_BOOL, &autostart, NULL},
+ {"connect", OPT_ARG_BOOL, &connect, NULL},
{NULL}
};
jack_options_t open_options = JackUseExactName;
@@ -243,18 +247,20 @@ static int init(int rate, const struct mp_chmap *channels, int format, int flags
buffer = av_fifo_alloc(BUFFSIZE);
jack_set_process_callback(client, outputaudio, 0);
- // list matching ports
- if (!port_name)
- port_flags |= JackPortIsPhysical;
- matching_ports = jack_get_ports(client, port_name, NULL, port_flags);
- if (!matching_ports || !matching_ports[0]) {
- mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] no physical ports available\n");
- goto err_out;
+ // list matching ports if connections should be made
+ if (connect) {
+ if (!port_name)
+ port_flags |= JackPortIsPhysical;
+ matching_ports = jack_get_ports(client, port_name, NULL, port_flags);
+ if (!matching_ports || !matching_ports[0]) {
+ mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] no physical ports available\n");
+ goto err_out;
+ }
+ i = 1;
+ num_ports = ao_data.channels.num;
+ while (matching_ports[i]) i++;
+ if (num_ports > i) num_ports = i;
}
- i = 1;
- num_ports = ao_data.channels.num;
- while (matching_ports[i]) i++;
- if (num_ports > i) num_ports = i;
// create out output ports
for (i = 0; i < num_ports; i++) {