--- libao2/ao_jack.c.orig 2007-10-07 21:49:27.000000000 +0200 +++ libao2/ao_jack.c 2008-04-26 00:26:55.000000000 +0200 @@ -207,11 +207,15 @@ { mp_msg (MSGT_AO, MSGL_FATAL, "\n-ao jack commandline help:\n" - "Example: mplayer -ao jack:port=myout\n" - " connects MPlayer to the jack ports named myout\n" + "Example: mplayer -ao jack:dest=myapp\n" + " connects MPlayer to the first ports of 'myapp'\n" + "Example: mplayer -ao jack:dest=myapp:port=input\n" + " connects MPlayer to the ports named 'input' of 'myapp'\n" "\nOptions:\n" - " port=\n" - " Connects to the given ports instead of the default physical ones\n" + " dest=\n" + " Connects to the named destination instead of the sound card\n" + " port=\n" + " Connects only ports with names starting with the given prefix\n" " name=\n" " Client name to pass to JACK\n" " estimate\n" @@ -220,9 +224,12 @@ static int init(int rate, int channels, int format, int flags) { const char **matching_ports = NULL; + char *dest_name = NULL; char *port_name = NULL; + char patt [256]; char *client_name = NULL; opt_t subopts[] = { + {"dest", OPT_ARG_MSTRZ, &dest_name, NULL}, {"port", OPT_ARG_MSTRZ, &port_name, NULL}, {"name", OPT_ARG_MSTRZ, &client_name, NULL}, {"estimate", OPT_ARG_BOOL, &estimate, NULL}, @@ -252,9 +259,20 @@ 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 (dest_name && port_name) { + sprintf (patt, "%s:%s", dest_name, port_name); + } + else if (dest_name) { + strcpy (patt, dest_name); + } + else if (port_name) { + strcpy (patt, port_name); + } + else { + port_flags |= JackPortIsPhysical; + *patt = 0; + } + matching_ports = jack_get_ports(client, patt, JACK_DEFAULT_AUDIO_TYPE, port_flags); for (num_ports = 0; matching_ports && matching_ports[num_ports]; num_ports++) ; if (!num_ports) { mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] no physical ports available\n");