OSDN Git Service

pcm: Fix DSD formats userland usability
authorJurgen Kramer <gtmkramer@xs4all.nl>
Sat, 9 Aug 2014 10:09:21 +0000 (12:09 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 11 Aug 2014 09:51:04 +0000 (11:51 +0200)
Support for DSD sample formats has been added a while ago. This patch makes
those sample formats beter usable from userland (e.g. aplay).

[These implementation details have been forgotten in the previous DSD
 support patch -- tiwai]

Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/asound.h
src/pcm/pcm_misc.c

index c819df4..5194524 100644 (file)
@@ -214,7 +214,9 @@ typedef int __bitwise snd_pcm_format_t;
 #define        SNDRV_PCM_FORMAT_G723_24_1B     ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
 #define        SNDRV_PCM_FORMAT_G723_40        ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
 #define        SNDRV_PCM_FORMAT_G723_40_1B     ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
-#define        SNDRV_PCM_FORMAT_LAST           SNDRV_PCM_FORMAT_G723_40_1B
+#define SNDRV_PCM_FORMAT_DSD_U8                ((__force snd_pcm_format_t) 48) /* 8 1-bit samples in 1 byte */
+#define SNDRV_PCM_FORMAT_DSD_U16_LE    ((__force snd_pcm_format_t) 49) /* 16 1-bit samples in 2 bytes */
+#define        SNDRV_PCM_FORMAT_LAST           SNDRV_PCM_FORMAT_DSD_U16_LE
 
 #ifdef SNDRV_LITTLE_ENDIAN
 #define        SNDRV_PCM_FORMAT_S16            SNDRV_PCM_FORMAT_S16_LE
index d52160c..44bb89c 100644 (file)
@@ -195,11 +195,13 @@ int snd_pcm_format_width(snd_pcm_format_t format)
        switch (format) {
        case SNDRV_PCM_FORMAT_S8:
        case SNDRV_PCM_FORMAT_U8:
+       case SNDRV_PCM_FORMAT_DSD_U8:
                return 8;
        case SNDRV_PCM_FORMAT_S16_LE:
        case SNDRV_PCM_FORMAT_S16_BE:
        case SNDRV_PCM_FORMAT_U16_LE:
        case SNDRV_PCM_FORMAT_U16_BE:
+       case SNDRV_PCM_FORMAT_DSD_U16_LE:
                return 16;
        case SNDRV_PCM_FORMAT_S18_3LE:
        case SNDRV_PCM_FORMAT_S18_3BE:
@@ -253,11 +255,13 @@ int snd_pcm_format_physical_width(snd_pcm_format_t format)
        switch (format) {
        case SNDRV_PCM_FORMAT_S8:
        case SNDRV_PCM_FORMAT_U8:
+       case SNDRV_PCM_FORMAT_DSD_U8:
                return 8;
        case SNDRV_PCM_FORMAT_S16_LE:
        case SNDRV_PCM_FORMAT_S16_BE:
        case SNDRV_PCM_FORMAT_U16_LE:
        case SNDRV_PCM_FORMAT_U16_BE:
+       case SNDRV_PCM_FORMAT_DSD_U16_LE:
                return 16;
        case SNDRV_PCM_FORMAT_S18_3LE:
        case SNDRV_PCM_FORMAT_S18_3BE: