comparison libao2/ao_jack.c @ 15641:1bb5111490cd

Create a unique client name so that multiple instances work. Patch by Jason Tackaberry (tack sault org)
author reimar
date Sun, 05 Jun 2005 08:37:48 +0000
parents 7c67124786a0
children 8bb0701496ec
comparison
equal deleted inserted replaced
15640:f585d2bcdc6b 15641:1bb5111490cd
9 */ 9 */
10 10
11 #include <stdio.h> 11 #include <stdio.h>
12 #include <stdlib.h> 12 #include <stdlib.h>
13 #include <string.h> 13 #include <string.h>
14 #include <unistd.h>
14 15
15 #include "config.h" 16 #include "config.h"
16 #include "mp_msg.h" 17 #include "mp_msg.h"
17 #include "help_mp.h" 18 #include "help_mp.h"
18 19
207 } 208 }
208 209
209 static int init(int rate, int channels, int format, int flags) { 210 static int init(int rate, int channels, int format, int flags) {
210 const char **matching_ports = NULL; 211 const char **matching_ports = NULL;
211 char *port_name = NULL; 212 char *port_name = NULL;
213 char client_name[40];
212 opt_t subopts[] = { 214 opt_t subopts[] = {
213 {"port", OPT_ARG_MSTRZ, &port_name, NULL}, 215 {"port", OPT_ARG_MSTRZ, &port_name, NULL},
214 {NULL} 216 {NULL}
215 }; 217 };
216 int port_flags = JackPortIsInput; 218 int port_flags = JackPortIsInput;
221 } 223 }
222 if (channels > MAX_CHANS) { 224 if (channels > MAX_CHANS) {
223 mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] Invalid number of channels: %i\n", channels); 225 mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] Invalid number of channels: %i\n", channels);
224 goto err_out; 226 goto err_out;
225 } 227 }
226 client = jack_client_new("MPlayer"); 228 sprintf(client_name, "MPlayer [%d]", getpid());
229 client = jack_client_new(client_name);
227 if (!client) { 230 if (!client) {
228 mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] cannot open server\n"); 231 mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] cannot open server\n");
229 goto err_out; 232 goto err_out;
230 } 233 }
231 jack_set_process_callback(client, outputaudio, 0); 234 jack_set_process_callback(client, outputaudio, 0);