SHA256
1
0
forked from pool/alsa-utils
alsa-utils/0007-aplay-Show-usage-if-no-parameter-is-passed.patch
Takashi Iwai 8bad45cd50 Accepting request 143675 from home:tiwai:branches:multimedia:libs
- Build with libsamplerate for aloop (bnc#792173)
- Add a patch to handle alsaloop properly without libsamplerate
  (bnc#792173):
  0010-alsaloop-Make-alsaloop-working-without-libsamplerate.patch
  0011-alsaloop-Fix-missing-endif.patch

- Backport fixes from upstream
  0006-alsamixer-fix-handling-of-removed-controls.patch
  0007-aplay-Show-usage-if-no-parameter-is-passed.patch
  0008-amixer-fix-rounding-of-relative-changes.patch
  0009-amixer-Fix-parsing-container-TLV-entries.patch

OBS-URL: https://build.opensuse.org/request/show/143675
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=66
2012-11-30 13:56:26 +00:00

53 lines
1.4 KiB
Diff

From c6614dbdab1cbe541e7d6cd29f3922510e0b6981 Mon Sep 17 00:00:00 2001
From: Fabio Estevam <fabio.estevam@freescale.com>
Date: Tue, 13 Nov 2012 10:05:39 -0200
Subject: [PATCH 7/9] aplay: Show usage if no parameter is passed
When aplay/arecord are called without any argument the application hangs forever.
Instead of hanging, print the usage and exit.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
aplay/aplay.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/aplay/aplay.c b/aplay/aplay.c
index 741979a..f35f603 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -493,6 +493,7 @@ int main(int argc, char *argv[])
int tmp, err, c;
int do_device_list = 0, do_pcm_list = 0;
snd_pcm_info_t *info;
+ FILE *direction;
#ifdef ENABLE_NLS
setlocale(LC_ALL, "");
@@ -511,14 +512,21 @@ int main(int argc, char *argv[])
file_type = FORMAT_WAVE;
command = "arecord";
start_delay = 1;
+ direction = stdout;
} else if (strstr(argv[0], "aplay")) {
stream = SND_PCM_STREAM_PLAYBACK;
command = "aplay";
+ direction = stdin;
} else {
error(_("command should be named either arecord or aplay"));
return 1;
}
+ if (isatty(fileno(direction)) && (argc == 1)) {
+ usage(command);
+ return 1;
+ }
+
chunk_size = -1;
rhwparams.format = DEFAULT_FORMAT;
rhwparams.rate = DEFAULT_SPEED;
--
1.8.0.1