From 5c91ee386d57b80593c7178d722a4122e4bf68c6 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 29 Mar 2005 16:34:31 +0000 Subject: [PATCH] Check PCM format aliases Check PCM format alias strings (e.g. "S16") as acceptable PCM formats. --- src/pcm/pcm.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index c2fc9547..03ba6413 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -1430,6 +1430,18 @@ static const char *snd_pcm_format_names[] = { FORMAT(U18_3BE), }; +static const char *snd_pcm_format_aliases[SND_PCM_FORMAT_LAST+1] = { + FORMAT(S16), + FORMAT(U16), + FORMAT(S24), + FORMAT(U24), + FORMAT(S32), + FORMAT(U32), + FORMAT(FLOAT), + FORMAT(FLOAT64), + FORMAT(IEC958_SUBFRAME), +}; + static const char *snd_pcm_format_descriptions[] = { FORMATD(S8, "Signed 8 bit"), FORMATD(U8, "Unsigned 8 bit"), @@ -1583,6 +1595,10 @@ snd_pcm_format_t snd_pcm_format_value(const char* name) strcasecmp(name, snd_pcm_format_names[format]) == 0) { return format; } + if (snd_pcm_format_aliases[format] && + strcasecmp(name, snd_pcm_format_aliases[format]) == 0) { + return format; + } } for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) { if (snd_pcm_format_descriptions[format] && -- 2.47.1