Ticket #988: jack-use-more-ports.patch
| File jack-use-more-ports.patch, 2.3 KB (added by , 18 years ago) |
|---|
-
libao2/ao_jack.
old new 229 229 {NULL} 230 230 }; 231 231 int port_flags = JackPortIsInput; 232 int i ;232 int i, j; 233 233 estimate = 1; 234 234 if (subopt_parse(ao_subdevice, subopts) != 0) { 235 235 print_help(); … … 252 252 jack_set_process_callback(client, outputaudio, 0); 253 253 254 254 // list matching ports 255 mp_msg(MSGT_AO, MSGL_V, "[JACK] searching for ports named \"%s\" to connect to\n", port_name); 256 255 257 if (!port_name) 256 258 port_flags |= JackPortIsPhysical; 257 259 matching_ports = jack_get_ports(client, port_name, NULL, port_flags); … … 260 262 mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] no physical ports available\n"); 261 263 goto err_out; 262 264 } 265 266 mp_msg(MSGT_AO, MSGL_V, "[JACK] We have %d channels and found %d ports\n", channels, num_ports); 267 268 // originally, port-connections were limited here 269 // num_ports will be set to channels futher down, after connecting the ports 270 /* 263 271 if (channels > num_ports) channels = num_ports; 264 272 num_ports = channels; 273 */ 265 274 266 // create out output ports267 for (i = 0; i < num_ports; i++) {275 // create output ports 276 for (i = 0; i < channels; i++) { 268 277 char pname[30]; 269 278 snprintf(pname, 30, "out_%d", i); 270 279 ports[i] = jack_port_register(client, pname, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); … … 278 287 goto err_out; 279 288 } 280 289 for (i = 0; i < num_ports; i++) { 281 if (jack_connect(client, jack_port_name(ports[i]), matching_ports[i])) { 290 // this is quite a hack since it assumes that we only found ports that 291 // "fit well" with our number of channels 292 j = i % channels; 293 /* printf("Connecting our port %d to matching port %d (%s) ... ", j, i, matching_ports[i]); */ 294 if (jack_connect(client, jack_port_name(ports[j]), matching_ports[i])) { 282 295 mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] connecting failed\n"); 283 296 goto err_out; 297 } else { 298 /* printf("connection ok!\n"); */ 284 299 } 285 300 } 301 302 // moved here; mplayer crashes if we don't set this, used again at outputaudio 303 // (wouldn't it be better to use channels instead of num_ports in the callback-functions?) 304 num_ports = channels; 305 286 306 rate = jack_get_sample_rate(client); 287 307 jack_latency = (float)(jack_port_get_total_latency(client, ports[0]) + 288 308 jack_get_buffer_size(client)) / (float)rate;
