From 774dc23ab34cc4c38f3d1d04c7d5dc6190ec923b Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 3 Jun 2013 17:38:04 +0000 Subject: ao_jack: add (no-)connect suboption Add (no)connect option to ao_jack. Patch by Markus Appel [masolomaster3000 googlemail com]. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@36297 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: DOCS/man/de/mplayer.1 DOCS/man/en/mplayer.1 audio/out/ao_jack.c --- audio/out/ao_jack.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'audio') 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=\n" " Connects to the given ports instead of the default physical ones\n" " 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++) { -- cgit v1.2.3