alsa/0016-pcm-Fix-DSD-formats-userland-usability.patch
Takashi Iwai 14fb2f9866 Accepting request 244348 from home:tiwai:branches:multimedia:libs
- Backport upstream fixes for supporting the missing DSD formats:
  0016-pcm-Fix-DSD-formats-userland-usability.patch
  0017-Sync-include-sound-asound.h-with-3.17-rc1-kernel.patch
  0018-pcm-Add-missing-signed-and-endianess-definitions-for.patch
- Remove alsa-info.sh from alsa.rpm; it's moved into alsa-utils

OBS-URL: https://build.opensuse.org/request/show/244348
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=166
2014-08-12 14:25:15 +00:00

68 lines
2.5 KiB
Diff

From 87df9f3b7a650418b9aef943ac246549c132672a Mon Sep 17 00:00:00 2001
From: Jurgen Kramer <gtmkramer@xs4all.nl>
Date: Sat, 9 Aug 2014 12:09:21 +0200
Subject: [PATCH] pcm: Fix DSD formats userland usability
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 | 4 +++-
src/pcm/pcm_misc.c | 4 ++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/sound/asound.h b/include/sound/asound.h
index c819df421434..519452466317 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -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
diff --git a/src/pcm/pcm_misc.c b/src/pcm/pcm_misc.c
index d52160cec653..44bb89cb0d44 100644
--- a/src/pcm/pcm_misc.c
+++ b/src/pcm/pcm_misc.c
@@ -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:
--
2.0.4