Ticket #14875: patch-autojack.diff
File patch-autojack.diff, 6.9 KB (added by eu@…, 17 years ago) |
---|
-
main.c
diff -ur ../moc-2.4.3.orig/main.c ./main.c
old new 264 264 printf (PACKAGE_STRING"\n" 265 265 "Usage:\n" 266 266 "%s [OPTIONS]... [FILE]...\n" 267 "-V --version Print program version and exit.\n"268 "-h --help Print usage and exit.\n"267 "-V --version Print program version and exit.\n" 268 "-h --help Print usage and exit.\n" 269 269 #ifndef NDEBUG 270 "-D --debug Turn on logging to a file.\n"270 "-D --debug Turn on logging to a file.\n" 271 271 #endif 272 "-S --server Run only the server.\n" 273 "-F --foreground Run server in foreground, log to stdout.\n" 274 "-R --sound-driver NAME Use the specified sound driver (oss, alsa, jack, null).\n" 275 "-m --music-dir Start in MusicDir.\n" 276 "-a --append Append the files/directories/playlists passed in\n" 277 " the command line to playlist and exit.\n" 278 "-c --clear Clear the playlist and exit.\n" 279 "-p --play Start playing from the first item on the playlist.\n" 280 "-l --playit Play files given on command line without modifing the\n" 281 " playlist.\n" 282 "-s --stop Stop playing.\n" 283 "-f --next Play next song.\n" 284 "-r --previous Play previous song.\n" 285 "-x --exit Shutdown the server.\n" 286 "-T --theme theme Use selected theme file (read from ~/.moc/themes if\n" 287 " the path is not absolute.\n" 288 "-C --config FILE Use the specified config file instead of the default.\n" 289 "-M --moc-dir DIR Use the specified MOC directory instead of the default.\n" 290 "-P --pause Pause.\n" 291 "-U --unpause Unpause.\n" 292 "-G --toggle-pause Toggle between play/pause.\n" 293 "-y --sync Synchronize the playlist with other clients.\n" 294 "-n --nosync Don't synchronize the playlist with other clients.\n" 295 "-A --ascii Use ASCII characters to draw lines.\n" 296 "-i --info Print the information about the currently played file.\n" 297 "-e --recursively Alias for -a.\n" 298 "-k --seek N Seek by N seconds (can be negative).\n" 272 "-S --server Run only the server.\n" 273 "-F --foreground Run server in foreground, log to stdout.\n" 274 "-R --sound-driver NAME Use the specified sound driver (oss, alsa, jack, null).\n" 275 "-j --autostart-jackd Start jackd on server init, and close it on server exit.\n" 276 "-J --no-autostart-jackd Do not start jackd on server init, and not close it on server exit.\n" 277 "-m --music-dir Start in MusicDir.\n" 278 "-a --append Append the files/directories/playlists passed in\n" 279 " the command line to playlist and exit.\n" 280 "-c --clear Clear the playlist and exit.\n" 281 "-p --play Start playing from the first item on the playlist.\n" 282 "-l --playit Play files given on command line without modifing the\n" 283 " playlist.\n" 284 "-s --stop Stop playing.\n" 285 "-f --next Play next song.\n" 286 "-r --previous Play previous song.\n" 287 "-x --exit Shutdown the server.\n" 288 "-T --theme theme Use selected theme file (read from ~/.moc/themes if\n" 289 " the path is not absolute.\n" 290 "-C --config FILE Use the specified config file instead of the default.\n" 291 "-M --moc-dir DIR Use the specified MOC directory instead of the default.\n" 292 "-P --pause Pause.\n" 293 "-U --unpause Unpause.\n" 294 "-G --toggle-pause Toggle between play/pause.\n" 295 "-y --sync Synchronize the playlist with other clients.\n" 296 "-n --nosync Don't synchronize the playlist with other clients.\n" 297 "-A --ascii Use ASCII characters to draw lines.\n" 298 "-i --info Print the information about the currently played file.\n" 299 "-e --recursively Alias for -a.\n" 300 "-k --seek N Seek by N seconds (can be negative).\n" 299 301 , prg_name); 300 302 } 301 303 … … 410 412 { "info", 0, NULL, 'i' }, 411 413 { "recursively", 0, NULL, 'e' }, 412 414 { "seek", 1, NULL, 'k' }, 415 { "autostart-jackd", 0, NULL, 'j' }, 416 { "no-autostart-jackd", 0, NULL, 'J' }, 413 417 { 0, 0, 0, 0 } 414 418 }; 415 419 int ret, opt_index = 0; … … 420 424 options_init (); 421 425 422 426 while ((ret = getopt_long(argc, argv, 423 "VhDSFR:macpsxT:C:M:PUynArfiGelk: ",427 "VhDSFR:macpsxT:C:M:PUynArfiGelk:jJ", 424 428 long_options, &opt_index)) != -1) { 425 429 switch (ret) { 426 430 case 'V': … … 446 450 option_set_str ("SoundDriver", optarg); 447 451 option_ignore_config ("SoundDriver"); 448 452 break; 453 case 'j': 454 option_set_int ("AutoStartJackd", 1); 455 option_ignore_config ("AutoStartJackd"); 456 break; 457 case 'J': 458 option_set_int ("AutoStartJackd", 0); 459 option_ignore_config ("AutoStartJackd"); 460 break; 449 461 case 'm': 450 462 option_set_int ("StartInMusicDir", 1); 451 463 option_ignore_config ("StartInMusicDir"); -
options.c
diff -ur ../moc-2.4.3.orig/options.c ./options.c
old new 217 217 option_add_int ("SetXtermTitle", 1); 218 218 option_add_int ("PlaylistFullPaths", 1); 219 219 option_add_int ("Allow24bitOutput", 0); 220 221 // Option to start Jackd on server init 222 option_add_int ("AutoStartJackd", 1); 223 220 224 } 221 225 222 226 /* Return 1 if a parameter to an integer option is valid. */ … … 243 247 || !strcasecmp(name, "SetXtermTitle") 244 248 || !strcasecmp(name, "PlaylistFullPaths") 245 249 || !strcasecmp(name, "Allow24bitOutput") 250 || !strcasecmp(name, "AutoStartJackd") 246 251 ) { 247 252 if (!(val == 1 || val == 0)) 248 253 return 0; -
server.c
diff -ur ../moc-2.4.3.orig/server.c ./server.c
old new 48 48 49 49 #define SERVER_LOG "mocp_server_log" 50 50 #define PID_FILE "pid" 51 #define JACKD_PATH "/opt/local/bin/jackd" 51 52 52 53 struct client 53 54 { … … 324 325 if (listen(server_sock, 1) == -1) 325 326 fatal ("listen() failed: %s", strerror(errno)); 326 327 328 329 /******* JACKd init ********/ 330 if(options_get_int ("AutoStartJackd")){ 331 int res; 332 pid_t pid; 333 334 pid = fork(); 335 if (pid == (pid_t)-1) { 336 perror("I can't start JACK\n"); 337 res=1; 338 } 339 if (pid == 0) { 340 printf("Starting JACKd"); 341 execl(JACKD_PATH,JACKD_PATH,"-R","-T","--silent","-d", "coreaudio",0); 342 343 _exit(1); 344 } 345 else{ 346 res=0; 347 } 348 349 if(!res){ 350 sleep(1); 351 } 352 } 353 /***************************************/ 354 355 327 356 audio_initialize (); 328 357 tags_cache_init (&tags_cache, options_get_int("TagsCacheSize") * 1024); 329 358 tags_cache_load (&tags_cache, create_file_name("tags_cache"));