alsa/0024-pcm-add-new-32-bit-DSD-sample-format.patch
Takashi Iwai 84789a8f60 Accepting request 257835 from home:tiwai:branches:multimedia:libs
- Backport upstream fixes / enhancements: mostly small fixes
  spotted by coccinelle and oethers, the fixes for proper rewind
  support, a new DSD format support, hwdep definitions sync, and
  addition of PAZ00 UCM configs.
  0022-pcm-fix-snd_pcm_mmap_hw_avail-near-the-boundary.patch
  0023-pcm-fix-return-value-of-snd_pcm_share_slave_avail.patch
  0024-pcm-add-new-32-bit-DSD-sample-format.patch
  0025-dmix-actually-rewind-when-running-or-being-drained.patch
  0026-pcm-express-the-rewind-size-limitation-logic-better.patch
  0027-pcm-handle-negative-values-from-snd_pcm_mmap_hw_avai.patch
  0028-pcm-rate-use-the-snd_pcm_mmap_hw_avail-function.patch
  0029-pcm-null-use-the-snd_pcm_mmap_avail-function.patch
  0030-rate-handle-negative-values-from-snd_pcm_mmap_playba.patch
  0031-dsnoop-rewindable-and-forwardable-logic-was-swapped.patch
  0033-pcm-file-don-t-recurse-in-the-rewindable-and-forward.patch
  0034-pcm-route-Fix-the-bad-condition-always-false.patch
  0035-pcm-rate-hw_avail-must-not-be-negative-before-starti.patch
  0036-hwdep-add-missing-declaration-for-snd_hwdep_poll_des.patch
  0037-mixer-fixed-double-free.patch
  0038-pcm_file-fixed-missing-free.patch
  0039-sbase-fixed-missing-free.patch
  0040-rawmidi-close-handle-h.patch
  0041-pcm_share-fixing-missing-mutex-unlock.patch
  0042-simple_abst-null-check-for-lib.patch
  0043-socket-missing-socket-close.patch
  0044-pcm_hooks-null-check-for-h.patch
  0045-conf-return-negative-value-in-case-of-error.patch
  0046-control-return-negative-value-in-case-of-error.patch
  0047-pcm-return-negative-value-in-case-of-error.patch
  0048-mixer-Fix-missing-hctl-handle-free-in-snd_mixer_atta.patch

OBS-URL: https://build.opensuse.org/request/show/257835
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=170
2014-10-21 07:48:48 +00:00

124 lines
4.7 KiB
Diff

From e59ffbf30ec13f7f1615ba266ec2f3e770801d6f Mon Sep 17 00:00:00 2001
From: Jurgen Kramer <gtmkramer@xs4all.nl>
Date: Wed, 10 Sep 2014 09:00:28 +0200
Subject: [PATCH] pcm: add new 32-bit DSD sample format
Add the new DSD_U32_LE sample format to alsa-lib.
NB include/pcm.h and include/sound/asound.h are updated so a new sync with the
kernel headers is not needed
Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
include/pcm.h | 4 +++-
include/sound/asound.h | 3 ++-
src/pcm/pcm.c | 2 ++
src/pcm/pcm_misc.c | 6 ++++++
4 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/include/pcm.h b/include/pcm.h
index 11e9f0dfba13..db88ad5ee41a 100644
--- a/include/pcm.h
+++ b/include/pcm.h
@@ -211,7 +211,9 @@ typedef enum _snd_pcm_format {
SND_PCM_FORMAT_DSD_U8,
/* Direct Stream Digital (DSD) in 2-byte samples (x16) */
SND_PCM_FORMAT_DSD_U16_LE,
- SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_DSD_U16_LE,
+ /* Direct Stream Digital (DSD) in 4-byte samples (x32) */
+ SND_PCM_FORMAT_DSD_U32_LE,
+ SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_DSD_U32_LE,
#if __BYTE_ORDER == __LITTLE_ENDIAN
/** Signed 16 bit CPU endian */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 32168f7ffce3..6ee586728df9 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -219,7 +219,8 @@ typedef int __bitwise snd_pcm_format_t;
#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
-#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U16_LE
+#define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */
+#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_LE
#ifdef SNDRV_LITTLE_ENDIAN
#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index 1399a5b2e671..2e2433829016 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -1565,6 +1565,7 @@ static const char *const snd_pcm_format_names[] = {
FORMAT(G723_40_1B),
FORMAT(DSD_U8),
FORMAT(DSD_U16_LE),
+ FORMAT(DSD_U32_LE),
};
static const char *const snd_pcm_format_aliases[SND_PCM_FORMAT_LAST+1] = {
@@ -1624,6 +1625,7 @@ static const char *const snd_pcm_format_descriptions[] = {
FORMATD(G723_40_1B, "G.723 (ADPCM) 40 kbit/s, 1 sample in 1 byte"),
FORMATD(DSD_U8, "Direct Stream Digital, 1-byte (x8), oldest bit in MSB"),
FORMATD(DSD_U16_LE, "Direct Stream Digital, 2-byte (x16), little endian, oldest bits in MSB"),
+ FORMATD(DSD_U32_LE, "Direct Stream Digital, 4-byte (x32), little endian, oldest bits in MSB"),
};
static const char *const snd_pcm_type_names[] = {
diff --git a/src/pcm/pcm_misc.c b/src/pcm/pcm_misc.c
index 46fc7719978e..92721796aa1f 100644
--- a/src/pcm/pcm_misc.c
+++ b/src/pcm/pcm_misc.c
@@ -64,6 +64,7 @@ int snd_pcm_format_signed(snd_pcm_format_t format)
case SNDRV_PCM_FORMAT_U18_3BE:
case SNDRV_PCM_FORMAT_DSD_U8:
case SNDRV_PCM_FORMAT_DSD_U16_LE:
+ case SNDRV_PCM_FORMAT_DSD_U32_LE:
return 0;
default:
return -EINVAL;
@@ -154,6 +155,7 @@ int snd_pcm_format_little_endian(snd_pcm_format_t format)
case SNDRV_PCM_FORMAT_U18_3BE:
case SNDRV_PCM_FORMAT_DSD_U8:
case SNDRV_PCM_FORMAT_DSD_U16_LE:
+ case SNDRV_PCM_FORMAT_DSD_U32_LE:
return 0;
default:
return -EINVAL;
@@ -232,6 +234,7 @@ int snd_pcm_format_width(snd_pcm_format_t format)
case SNDRV_PCM_FORMAT_U32_BE:
case SNDRV_PCM_FORMAT_FLOAT_LE:
case SNDRV_PCM_FORMAT_FLOAT_BE:
+ case SNDRV_PCM_FORMAT_DSD_U32_LE:
return 32;
case SNDRV_PCM_FORMAT_FLOAT64_LE:
case SNDRV_PCM_FORMAT_FLOAT64_BE:
@@ -292,6 +295,7 @@ int snd_pcm_format_physical_width(snd_pcm_format_t format)
case SNDRV_PCM_FORMAT_FLOAT_BE:
case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE:
case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE:
+ case SNDRV_PCM_FORMAT_DSD_U32_LE:
return 32;
case SNDRV_PCM_FORMAT_FLOAT64_LE:
case SNDRV_PCM_FORMAT_FLOAT64_BE:
@@ -348,6 +352,7 @@ ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples)
case SNDRV_PCM_FORMAT_U32_BE:
case SNDRV_PCM_FORMAT_FLOAT_LE:
case SNDRV_PCM_FORMAT_FLOAT_BE:
+ case SNDRV_PCM_FORMAT_DSD_U32_LE:
return samples * 4;
case SNDRV_PCM_FORMAT_FLOAT64_LE:
case SNDRV_PCM_FORMAT_FLOAT64_BE:
@@ -394,6 +399,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
return 0x8080808080808080ULL;
case SNDRV_PCM_FORMAT_DSD_U8:
case SNDRV_PCM_FORMAT_DSD_U16_LE:
+ case SNDRV_PCM_FORMAT_DSD_U32_LE:
return 0x6969696969696969ULL;
#ifdef SNDRV_LITTLE_ENDIAN
case SNDRV_PCM_FORMAT_U16_LE:
--
2.1.2