Mercurial > mplayer.hg
changeset 36139:1f8e6c375fc3
Make code simpler and more flexible.
author | reimar |
---|---|
date | Sat, 04 May 2013 21:55:52 +0000 |
parents | a8fc00cb36c3 |
children | 6a13cab4e830 |
files | libao2/ao_jack.c |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libao2/ao_jack.c Sat May 04 21:44:42 2013 +0000 +++ b/libao2/ao_jack.c Sat May 04 21:55:52 2013 +0000 @@ -245,12 +245,12 @@ if (!port_name) port_flags |= JackPortIsPhysical; matching_ports = jack_get_ports(client, port_name, NULL, port_flags); - if (!matching_ports || !matching_ports[0]) { + i = 0; + while (matching_ports && matching_ports[i]) i++; + if (!i) { mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] no physical ports available\n"); goto err_out; } - i = 1; - while (matching_ports[i]) i++; if (channels > i) channels = i; num_ports = channels; @@ -268,7 +268,7 @@ mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] activate failed\n"); goto err_out; } - for (i = 0; i < num_ports; i++) { + for (i = 0; i < num_ports && matching_ports && matching_ports[i]; i++) { if (jack_connect(client, jack_port_name(ports[i]), matching_ports[i])) { mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] connecting failed\n"); goto err_out;