X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/d76bbdea349bf3856172ce9599e657d566e91162..8d251217b5cfeae9d277054a456c4064eabde569:/clients/playrtp.c diff --git a/clients/playrtp.c b/clients/playrtp.c index d97864b..c6f0ad9 100644 --- a/clients/playrtp.c +++ b/clients/playrtp.c @@ -24,20 +24,20 @@ * systems. There is no support for Microsoft Windows yet, and that will in * fact probably an entirely separate program. * - * The program runs (at least) three threads. listen_thread() is responsible - * for reading RTP packets off the wire and adding them to the linked list @ref - * received_packets, assuming they are basically sound. queue_thread() takes - * packets off this linked list and adds them to @ref packets (an operation - * which might be much slower due to contention for @ref lock). + * The program runs (at least) three threads: * - * The main thread is responsible for actually playing audio. In ALSA this - * means it waits until ALSA says it's ready for more audio which it then - * plays. See @ref clients/playrtp-alsa.c. + * listen_thread() is responsible for reading RTP packets off the wire and + * adding them to the linked list @ref received_packets, assuming they are + * basically sound. * - * In Core Audio the main thread is only responsible for starting and stopping - * play: the system does the actual playback in its own private thread, and - * calls adioproc() to fetch the audio data. See @ref - * clients/playrtp-coreaudio.c. + * queue_thread() takes packets off this linked list and adds them to @ref + * packets (an operation which might be much slower due to contention for @ref + * lock). + * + * control_thread() accepts commands from Disobedience (or anything else). + * + * The main thread activates and deactivates audio playing via the @ref + * lib/uaudio.h API (which probably implies at least one further thread). * * Sometimes it happens that there is no audio available to play. This may * because the server went away, or a packet was dropped, or the server @@ -217,6 +217,7 @@ static const struct option options[] = { #endif { "dump", required_argument, 0, 'r' }, { "command", required_argument, 0, 'e' }, + { "pause-mode", required_argument, 0, 'P' }, { "socket", required_argument, 0, 's' }, { "config", required_argument, 0, 'C' }, { 0, 0, 0, 0 } @@ -492,7 +493,9 @@ static void help(void) { #if HAVE_COREAUDIO_AUDIOHARDWARE_H " --core-audio, -c Use Core Audio to play audio\n" #endif - " --command, -e COMMAND Pipe audio to command\n" + " --command, -e COMMAND Pipe audio to command.\n" + " --pause-mode, -P silence For -e: pauses send silence (default)\n" + " --pause-mode, -P suspend For -e: pauses suspend writes\n" " --help, -h Display usage message\n" " --version, -V Display version number\n" ); @@ -592,7 +595,7 @@ int main(int argc, char **argv) { mem_init(); if(!setlocale(LC_CTYPE, "")) fatal(errno, "error calling setlocale"); backend = uaudio_apis[0]; - while((n = getopt_long(argc, argv, "hVdD:m:b:x:L:R:M:aocC:re:", options, 0)) >= 0) { + while((n = getopt_long(argc, argv, "hVdD:m:b:x:L:R:M:aocC:re:P:", options, 0)) >= 0) { switch(n) { case 'h': help(); case 'V': version("disorder-playrtp"); @@ -616,6 +619,7 @@ int main(int argc, char **argv) { case 's': control_socket = optarg; break; case 'r': dumpfile = optarg; break; case 'e': backend = &uaudio_command; uaudio_set("command", optarg); break; + case 'P': uaudio_set("pause-mode", optarg); break; default: fatal(0, "invalid option"); } }