pacat: State purpose of program depending how it was invoked

see https://bugs.freedesktop.org/show_bug.cgi?id=68135

state purpose of paplay/parec/pamon/parecord/pacat when invoked with -h

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
This commit is contained in:
Peter Meerwald 2014-11-17 11:34:59 +01:00 committed by David Henningsson
parent 0f54a91718
commit 8a08e7e38a

View file

@ -50,6 +50,7 @@
#define CLEAR_LINE "\x1B[K" #define CLEAR_LINE "\x1B[K"
static enum { RECORD, PLAYBACK } mode = PLAYBACK; static enum { RECORD, PLAYBACK } mode = PLAYBACK;
static const char *purpose = NULL;
static pa_context *context = NULL; static pa_context *context = NULL;
static pa_stream *stream = NULL; static pa_stream *stream = NULL;
@ -667,7 +668,8 @@ static void time_event_callback(pa_mainloop_api *m, pa_time_event *e, const stru
static void help(const char *argv0) { static void help(const char *argv0) {
printf(_("%s [options]\n\n" printf(_("%s [options]\n"
"%s\n\n"
" -h, --help Show this help\n" " -h, --help Show this help\n"
" --version Show version\n\n" " --version Show version\n\n"
" -r, --record Create a connection for recording\n" " -r, --record Create a connection for recording\n"
@ -703,7 +705,7 @@ static void help(const char *argv0) {
" --file-format[=FFORMAT] Record/play formatted PCM data.\n" " --file-format[=FFORMAT] Record/play formatted PCM data.\n"
" --list-file-formats List available file formats.\n" " --list-file-formats List available file formats.\n"
" --monitor-stream=INDEX Record from the sink input with index INDEX.\n") " --monitor-stream=INDEX Record from the sink input with index INDEX.\n")
, argv0); , argv0, purpose);
} }
enum { enum {
@ -783,15 +785,19 @@ int main(int argc, char *argv[]) {
if (strstr(bn, "play")) { if (strstr(bn, "play")) {
mode = PLAYBACK; mode = PLAYBACK;
raw = false; raw = false;
purpose = _("Play back encoded audio files on a PulseAudio sound server.");
} else if (strstr(bn, "record")) { } else if (strstr(bn, "record")) {
mode = RECORD; mode = RECORD;
raw = false; raw = false;
} else if (strstr(bn, "cat")) { purpose = _("Capture audio data from a PulseAudio sound server and write it to a file.");
mode = PLAYBACK;
raw = true;
} else if (strstr(bn, "rec") || strstr(bn, "mon")) { } else if (strstr(bn, "rec") || strstr(bn, "mon")) {
mode = RECORD; mode = RECORD;
raw = true; raw = true;
purpose = _("Capture audio data from a PulseAudio sound server and write it to STDOUT or the specified file.");
} else { /* pacat */
mode = PLAYBACK;
raw = true;
purpose = _("Play back audio data from STDIN or the specified file on a PulseAudio sound server.");
} }
proplist = pa_proplist_new(); proplist = pa_proplist_new();