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
This commit is contained in:
reimar 2013-06-03 17:38:04 +00:00 committed by wm4
parent 3725ab980c
commit 774dc23ab3
2 changed files with 21 additions and 11 deletions

View File

@ -56,6 +56,10 @@ jack
(no-)autostart
Automatically start jackd if necessary (default: disabled). Note that
this seems unreliable and will spam stdout with server messages.
(no-)connect
Automatically create connections to output ports (default: enabled).
When enabled, the maximum number of output channels will be limited to
the number of available output ports.
coreaudio (Mac OS X only)
native Mac OS X audio output driver

View File

@ -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++) {