From: Richard Kettlewell Date: Thu, 7 Nov 2013 16:56:46 +0000 (+0000) Subject: playrtp: --api option instead of a new option for every audio API X-Git-Tag: 5.2~129 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/ba32e50c1894049659544cd2cbb0f7ab06981add?ds=sidebyside playrtp: --api option instead of a new option for every audio API --- diff --git a/clients/playrtp.c b/clients/playrtp.c index 61cf6ab..5956122 100644 --- a/clients/playrtp.c +++ b/clients/playrtp.c @@ -207,6 +207,7 @@ static const struct option options[] = { #if HAVE_COREAUDIO_AUDIOHARDWARE_H { "core-audio", no_argument, 0, 'c' }, #endif + { "api", required_argument, 0, 'A' }, { "dump", required_argument, 0, 'r' }, { "command", required_argument, 0, 'e' }, { "pause-mode", required_argument, 0, 'P' }, @@ -492,15 +493,19 @@ static void help(void) { " --max, -x FRAMES Buffer maximum size\n" " --rcvbuf, -R BYTES Socket receive buffer size\n" " --config, -C PATH Set configuration file\n" -#if HAVE_ALSA_ASOUNDLIB_H - " --alsa, -a Use ALSA to play audio\n" -#endif -#if HAVE_SYS_SOUNDCARD_H || EMPEG_HOST - " --oss, -o Use OSS to play audio\n" -#endif -#if HAVE_COREAUDIO_AUDIOHARDWARE_H - " --core-audio, -c Use Core Audio to play audio\n" -#endif + " --api, -A API Select audio API. Possibilities:\n" + " "); + int first = 1; + for(int n = 0; uaudio_apis[n]; ++n) { + if(uaudio_apis[n]->flags & UAUDIO_API_CLIENT) { + if(first) + first = 0; + else + xprintf(", "); + xprintf("%s", uaudio_apis[n]->name); + } + } + xprintf("\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" @@ -648,7 +653,7 @@ int main(int argc, char **argv) { logdate = 1; mem_init(); if(!setlocale(LC_CTYPE, "")) disorder_fatal(errno, "error calling setlocale"); - while((n = getopt_long(argc, argv, "hVdD:m:x:L:R:aocC:re:P:M", options, 0)) >= 0) { + while((n = getopt_long(argc, argv, "hVdD:m:x:L:R:aocC:re:P:MA:", options, 0)) >= 0) { switch(n) { case 'h': help(); case 'V': version("disorder-playrtp"); @@ -659,14 +664,23 @@ int main(int argc, char **argv) { case 'L': logfp = fopen(optarg, "w"); break; case 'R': target_rcvbuf = atoi(optarg); break; #if HAVE_ALSA_ASOUNDLIB_H - case 'a': backend = &uaudio_alsa; break; + case 'a': + disorder_error(0, "deprecated option; use --api alsa instead"); + backend = &uaudio_alsa; break; #endif #if HAVE_SYS_SOUNDCARD_H || EMPEG_HOST - case 'o': backend = &uaudio_oss; break; + case 'o': + disorder_error(0, "deprecated option; use --api oss instead"); + backend = &uaudio_oss; + break; #endif #if HAVE_COREAUDIO_AUDIOHARDWARE_H - case 'c': backend = &uaudio_coreaudio; break; + case 'c': + disorder_error(0, "deprecated option; use --api coreaudio instead"); + backend = &uaudio_coreaudio; + break; #endif + case 'A': backend = uaudio_find(optarg); break; case 'C': configfile = optarg; break; case 's': control_socket = optarg; break; case 'r': dumpfile = optarg; break; diff --git a/doc/disorder-playrtp.1.in b/doc/disorder-playrtp.1.in index c92c55a..abbeed5 100644 --- a/doc/disorder-playrtp.1.in +++ b/doc/disorder-playrtp.1.in @@ -1,5 +1,5 @@ .\" -.\" Copyright (C) 2007-2009 Richard Kettlewell +.\" Copyright (C) 2007-2009, 2013 Richard Kettlewell .\" .\" This program is free software: you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by @@ -37,20 +37,28 @@ broadcast to that port. If an address and a port are specified then the RTP stream is assumed to be multicast to that group address and port. .SH OPTIONS -The default sound API is the first of the ones listed below that are available. -Usually this implies ALSA under Linux and Core Audio under OS X. .TP -.B \-\-alsa\fR, \fB\-a -Use ALSA to play sound. -Only available on Linux. +.B \-\-api\fR, -\fB-A\fR \fIAPI\fR +Select the playback API. +The possibilities are, depending on platform and compilation options: +.RS 8 .TP -.B \-\-oss\fR, \fB\-o -Use OSS to play sound. -Only available on Linux and FreeBSD. +.B alsa +ALSA. +Linux only. .TP -.B \-\-core\-audio\fR, \fB\-c -Use Core Audio to play sound. -Only available on Macs. +.B oss +OSS. +.TP +.B coreaudio +Core Audio. +OS X only. +.TP +.B command +Pipe audio to a command. +.RE +.IP +The default is the first of the possibilities above that is supported. .TP .B \-\-device \fIDEVICE\fR, \fB\-D \fIDEVICE\fR Specifies the audio device to use. @@ -122,6 +130,21 @@ Periodically report how close to the buffer low watermark the buffer is. If you have trouble with poor playback quality, enable this option to see if the buffer is emptying out (or overfilling, though there are measures to prevent that from happening). +.SS "Deprecated Options" +These options may be removed in a future version. +Use \fB\-\-api\fR instead. +.TP +.B \-\-alsa\fR, \fB\-a +Use ALSA to play sound. +Only available on Linux. +.TP +.B \-\-oss\fR, \fB\-o +Use OSS to play sound. +Only available on Linux and FreeBSD. +.TP +.B \-\-core\-audio\fR, \fB\-c +Use Core Audio to play sound. +Only available on Macs. .SH "REMOTE CONTROL" The .B \-\-socket