[pulseaudio-discuss] [PATCH 3/3] pacat: State purpose of program depending how it was invoked
Peter Meerwald
pmeerw at pmeerw.net
Mon Nov 17 02:46:26 PST 2014
From: Peter Meerwald <p.meerwald at bct-electronic.com>
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 at pmeerw.net>
---
src/utils/pacat.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/utils/pacat.c b/src/utils/pacat.c
index e60dfca..d1f5502 100644
--- a/src/utils/pacat.c
+++ b/src/utils/pacat.c
@@ -52,6 +52,7 @@
#define CLEAR_LINE "\x1B[K"
static enum { RECORD, PLAYBACK } mode = PLAYBACK;
+static const char *purpose = NULL;
static pa_context *context = NULL;
static pa_stream *stream = NULL;
@@ -669,7 +670,8 @@ static void time_event_callback(pa_mainloop_api *m, pa_time_event *e, const stru
static void help(const char *argv0) {
- printf(_("%s [options]\n\n"
+ printf(_("%s [options]\n"
+ "%s\n\n"
" -h, --help Show this help\n"
" --version Show version\n\n"
" -r, --record Create a connection for recording\n"
@@ -705,7 +707,7 @@ static void help(const char *argv0) {
" --file-format[=FFORMAT] Record/play formatted PCM data.\n"
" --list-file-formats List available file formats.\n"
" --monitor-stream=INDEX Record from the sink input with index INDEX.\n")
- , argv0);
+ , argv0, purpose);
}
enum {
@@ -785,15 +787,19 @@ int main(int argc, char *argv[]) {
if (strstr(bn, "play")) {
mode = PLAYBACK;
raw = false;
+ purpose = _("Play back encoded audio files on a PulseAudio sound server.");
} else if (strstr(bn, "record")) {
mode = RECORD;
raw = false;
- } else if (strstr(bn, "cat")) {
- mode = PLAYBACK;
- raw = true;
+ purpose = _("Capture audio data from a PulseAudio sound server and write it to a file.");
} else if (strstr(bn, "rec") || strstr(bn, "mon")) {
mode = RECORD;
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();
--
1.7.9.5
More information about the pulseaudio-discuss
mailing list