]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Check PCM format aliases
authorTakashi Iwai <tiwai@suse.de>
Tue, 29 Mar 2005 16:34:31 +0000 (16:34 +0000)
committerTakashi Iwai <tiwai@suse.de>
Tue, 29 Mar 2005 16:34:31 +0000 (16:34 +0000)
Check PCM format alias strings (e.g. "S16") as acceptable PCM formats.

src/pcm/pcm.c

index c2fc9547846c3431650fb649691a3f8d503414ed..03ba6413f20086e06ffb1fee30981abc1f87c0df 100644 (file)
@@ -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] &&