]> err.no Git - linux-2.6/commitdiff
[ALSA] Add new AFMT_* formats for OSS emulation
authorTakashi Iwai <tiwai@suse.de>
Wed, 8 Aug 2007 15:00:32 +0000 (17:00 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 16 Oct 2007 13:58:33 +0000 (15:58 +0200)
The recent OSS includes the support for 32bit and other formats, which
we already have, too.  Let's define and map them.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/core/oss/pcm_oss.c

index fc11572c48cf8038b52d329f9aa12d7ec047f9ca..c058713dd567b5d4bf7aab73e8d484a5c8b7c919 100644 (file)
@@ -633,6 +633,22 @@ static long snd_pcm_alsa_frames(struct snd_pcm_substream *substream, long bytes)
        return bytes_to_frames(runtime, (buffer_size * bytes) / runtime->oss.buffer_bytes);
 }
 
+/* define extended formats in the recent OSS versions (if any) */
+/* linear formats */
+#define AFMT_S32_LE      0x00001000
+#define AFMT_S32_BE      0x00002000
+#define AFMT_S24_LE      0x00008000
+#define AFMT_S24_BE      0x00010000
+#define AFMT_S24_PACKED  0x00040000
+
+/* other supported formats */
+#define AFMT_FLOAT       0x00004000
+#define AFMT_SPDIF_RAW   0x00020000
+
+/* unsupported formats */
+#define AFMT_AC3         0x00000400
+#define AFMT_VORBIS      0x00000800
+
 static int snd_pcm_oss_format_from(int format)
 {
        switch (format) {
@@ -646,6 +662,13 @@ static int snd_pcm_oss_format_from(int format)
        case AFMT_U16_LE:       return SNDRV_PCM_FORMAT_U16_LE;
        case AFMT_U16_BE:       return SNDRV_PCM_FORMAT_U16_BE;
        case AFMT_MPEG:         return SNDRV_PCM_FORMAT_MPEG;
+       case AFMT_S32_LE:       return SNDRV_PCM_FORMAT_S32_LE;
+       case AFMT_S32_BE:       return SNDRV_PCM_FORMAT_S32_BE;
+       case AFMT_S24_LE:       return SNDRV_PCM_FORMAT_S24_LE;
+       case AFMT_S24_BE:       return SNDRV_PCM_FORMAT_S24_BE;
+       case AFMT_S24_PACKED:   return SNDRV_PCM_FORMAT_S24_3LE;
+       case AFMT_FLOAT:        return SNDRV_PCM_FORMAT_FLOAT;
+       case AFMT_SPDIF_RAW:    return SNDRV_PCM_FORMAT_IEC958_SUBFRAME;
        default:                return SNDRV_PCM_FORMAT_U8;
        }
 }
@@ -663,6 +686,13 @@ static int snd_pcm_oss_format_to(int format)
        case SNDRV_PCM_FORMAT_U16_LE:   return AFMT_U16_LE;
        case SNDRV_PCM_FORMAT_U16_BE:   return AFMT_U16_BE;
        case SNDRV_PCM_FORMAT_MPEG:             return AFMT_MPEG;
+       case SNDRV_PCM_FORMAT_S32_LE:   return AFMT_S32_LE;
+       case SNDRV_PCM_FORMAT_S32_BE:   return AFMT_S32_BE;
+       case SNDRV_PCM_FORMAT_S24_LE:   return AFMT_S24_LE;
+       case SNDRV_PCM_FORMAT_S24_BE:   return AFMT_S24_BE;
+       case SNDRV_PCM_FORMAT_S24_3LE:  return AFMT_S24_PACKED;
+       case SNDRV_PCM_FORMAT_FLOAT:    return AFMT_FLOAT;
+       case SNDRV_PCM_FORMAT_IEC958_SUBFRAME: return AFMT_SPDIF_RAW;
        default:                        return -EINVAL;
        }
 }
@@ -1725,7 +1755,10 @@ static int snd_pcm_oss_get_formats(struct snd_pcm_oss_file *pcm_oss_file)
                return AFMT_MU_LAW | AFMT_U8 |
                       AFMT_S16_LE | AFMT_S16_BE |
                       AFMT_S8 | AFMT_U16_LE |
-                      AFMT_U16_BE;
+                      AFMT_U16_BE |
+                       AFMT_S32_LE | AFMT_S32_BE |
+                       AFMT_S24_LE | AFMT_S24_LE |
+                       AFMT_S24_PACKED;
        params = kmalloc(sizeof(*params), GFP_KERNEL);
        if (!params)
                return -ENOMEM;