diff options
author | Arnout Engelen <alsa2@bzzt.net> | 2009-10-18 21:34:30 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-11-02 16:44:06 +0100 |
commit | 325462e80ade753abea24fb3707e34dcf617ef51 (patch) | |
tree | 63474255b8a29aab2056b813238957d28e907339 /aplay | |
parent | a227f00690f051a62c41ae6ec77976fedb6cfe9c (diff) |
aplay - Show available formats
Report available sample formats in aplay/arecord when currently selected
one doesn't work.
Signed-off-by: Arnout Engelen <alsa2@bzzt.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'aplay')
-rw-r--r-- | aplay/aplay.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/aplay/aplay.c b/aplay/aplay.c index c7c82a1..af6fede 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -941,6 +941,17 @@ static int test_au(int fd, void *buffer) return 0; } +static void show_available_sample_formats(snd_pcm_hw_params_t* params) +{ + snd_pcm_format_t format; + + fprintf(stderr, "Available formats:\n"); + for (format = 0; format < SND_PCM_FORMAT_LAST; format++) { + if (snd_pcm_hw_params_test_format(handle, params, format) == 0) + fprintf(stderr, "- %s\n", snd_pcm_format_name(format)); + } +} + static void set_params(void) { snd_pcm_hw_params_t *params; @@ -977,6 +988,7 @@ static void set_params(void) err = snd_pcm_hw_params_set_format(handle, params, hwparams.format); if (err < 0) { error(_("Sample format non available")); + show_available_sample_formats(params); exit(EXIT_FAILURE); } err = snd_pcm_hw_params_set_channels(handle, params, hwparams.channels); |