alsa-utils/0005-aplay-option-to-dump-HW-parameters.patch
Takashi Iwai 3a57fbf7f8 Accepting request 122710 from home:tiwai:branches:multimedia:libs
- backport fix patches from upstream:
  * Some document fixes
  * Improve xrun_sync in alsaloop
  * Add option to dump HW parameters to aplay
  * Add the support for mapped volumes to amixer
  * Add option to tread any xrun as fatal to aplay/arecord
  * configure.in fixes
  * alsactl: Don't access other cards than specified
  * aplay prints Vu-meter to stderr now
  * fix the avail_min setup in alsaloop

OBS-URL: https://build.opensuse.org/request/show/122710
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=52
2012-05-29 09:34:36 +00:00

101 lines
3.5 KiB
Diff

From 2d105e0f18a82783ea69e2dbe9da7aeb7d3c1346 Mon Sep 17 00:00:00 2001
From: Pavel Hofman <pavel.hofman@ivitera.com>
Date: Mon, 5 Mar 2012 21:27:00 +0000
Subject: [PATCH 05/13] aplay - option to dump HW parameters
Dumping HW parameters of the current device with snd_pcm_hw_params_dump,
a new option --dump-hw-params added.
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
aplay/aplay.1 | 7 +++++++
aplay/aplay.c | 18 ++++++++++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/aplay/aplay.1 b/aplay/aplay.1
index 2acaed5..0195322 100644
--- a/aplay/aplay.1
+++ b/aplay/aplay.1
@@ -184,6 +184,13 @@ the month, %H hour, %M minute and %S second. In addition, %v is
the file number, starting at 1. When this option is specified,
intermediate directories for the output file are created automatically.
This option has no effect if \-\-separate\-channels is specified.
+.TP
+\fI\-\-dump\-hw\-params\fP
+Dump hw_params of the device preconfigured status to stderr. The dump
+lists capabilities of the selected device such as supported formats,
+sampling rates, numbers of channels, period and buffer bytes/sizes/times.
+For raw device hw:X this option basically lists hardware capabilities of
+the soundcard.
.SH SIGNALS
When recording, SIGINT, SIGTERM and SIGABRT will close the output
diff --git a/aplay/aplay.c b/aplay/aplay.c
index 73a9544..0633cbd 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -129,6 +129,7 @@ static int max_file_time = 0;
static int use_strftime = 0;
volatile static int recycle_capture_file = 0;
static long term_c_lflag = -1;
+static int dump_hw_params = 0;
static int fd = -1;
static off64_t pbrec_count = LLONG_MAX, fdcount;
@@ -223,7 +224,8 @@ _("Usage: %s [OPTION]... [FILE]...\n"
" --max-file-time=# start another output file when the old file has recorded\n"
" for this many seconds\n"
" --process-id-file write the process ID here\n"
-" --use-strftime apply the strftime facility to the output file name\n")
+" --use-strftime apply the strftime facility to the output file name\n"
+" --dump-hw-params dump hw_params of the device\n")
, command);
printf(_("Recognized sample formats are:"));
for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
@@ -416,7 +418,8 @@ enum {
OPT_TEST_NOWAIT,
OPT_MAX_FILE_TIME,
OPT_PROCESS_ID_FILE,
- OPT_USE_STRFTIME
+ OPT_USE_STRFTIME,
+ OPT_DUMP_HWPARAMS
};
int main(int argc, char *argv[])
@@ -461,6 +464,7 @@ int main(int argc, char *argv[])
{"process-id-file", 1, 0, OPT_PROCESS_ID_FILE},
{"use-strftime", 0, 0, OPT_USE_STRFTIME},
{"interactive", 0, 0, 'i'},
+ {"dump-hw-params", 0, 0, OPT_DUMP_HWPARAMS},
{0, 0, 0, 0}
};
char *pcm_name = "default";
@@ -662,6 +666,9 @@ int main(int argc, char *argv[])
case OPT_USE_STRFTIME:
use_strftime = 1;
break;
+ case OPT_DUMP_HWPARAMS:
+ dump_hw_params = 1;
+ break;
default:
fprintf(stderr, _("Try `%s --help' for more information.\n"), command);
return 1;
@@ -1059,6 +1066,13 @@ static void set_params(void)
error(_("Broken configuration for this PCM: no configurations available"));
prg_exit(EXIT_FAILURE);
}
+ if (dump_hw_params) {
+ fprintf(stderr, _("HW Params of device \"%s\":\n"),
+ snd_pcm_name(handle));
+ fprintf(stderr, "--------------------\n");
+ snd_pcm_hw_params_dump(params, log);
+ fprintf(stderr, "--------------------\n");
+ }
if (mmap_flag) {
snd_pcm_access_mask_t *mask = alloca(snd_pcm_access_mask_sizeof());
snd_pcm_access_mask_none(mask);
--
1.7.9.2