* [PATCH] Fix DSD formats userland usability
@ 2014-08-09 10:09 Jurgen Kramer
2014-08-10 11:44 ` Takashi Iwai
0 siblings, 1 reply; 5+ messages in thread
From: Jurgen Kramer @ 2014-08-09 10:09 UTC (permalink / raw)
To: alsa-devel; +Cc: Jurgen Kramer
Support for DSD sample formats has been added a while ago. This patch makes
those sample formats beter usable from userland (e.g. aplay).
---
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 c819df4..5194524 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 d52160c..44bb89c 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:
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix DSD formats userland usability
2014-08-09 10:09 [PATCH] Fix DSD formats userland usability Jurgen Kramer
@ 2014-08-10 11:44 ` Takashi Iwai
2014-08-10 13:38 ` Jurgen Kramer
0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2014-08-10 11:44 UTC (permalink / raw)
To: Jurgen Kramer; +Cc: alsa-devel
At Sat, 9 Aug 2014 12:09:21 +0200,
Jurgen Kramer wrote:
>
> Support for DSD sample formats has been added a while ago. This patch makes
> those sample formats beter usable from userland (e.g. aplay).
>
> ---
> include/sound/asound.h | 4 +++-
> src/pcm/pcm_misc.c | 4 ++++
The new definitions are still missing in include/pcm.h?
include/sound/asound.h is a copy from the kernel, and the user-land
API is defined rather in include/pcm.h.
thanks,
Takashi
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/include/sound/asound.h b/include/sound/asound.h
> index c819df4..5194524 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 d52160c..44bb89c 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:
> --
> 1.9.3
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix DSD formats userland usability
2014-08-10 11:44 ` Takashi Iwai
@ 2014-08-10 13:38 ` Jurgen Kramer
2014-08-11 8:06 ` Takashi Iwai
0 siblings, 1 reply; 5+ messages in thread
From: Jurgen Kramer @ 2014-08-10 13:38 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
On Sun, 2014-08-10 at 13:44 +0200, Takashi Iwai wrote:
> At Sat, 9 Aug 2014 12:09:21 +0200,
> Jurgen Kramer wrote:
> >
> > Support for DSD sample formats has been added a while ago. This patch makes
> > those sample formats beter usable from userland (e.g. aplay).
> >
> > ---
> > include/sound/asound.h | 4 +++-
> > src/pcm/pcm_misc.c | 4 ++++
>
> The new definitions are still missing in include/pcm.h?
> include/sound/asound.h is a copy from the kernel, and the user-land
> API is defined rather in include/pcm.h.
>
OK, the updates to alsa-lib pcm_misc.c are still valid but do not
compile without my proposed update to include/sound/asound.h:
Compiling alsa-lib from git with update pcm_misc.c gives:
pcm_misc.c: In function 'snd_pcm_format_width':
pcm_misc.c:198:7: error: 'SNDRV_PCM_FORMAT_DSD_U8' undeclared (first use
in this function)
case SNDRV_PCM_FORMAT_DSD_U8:
^
pcm_misc.c:198:7: note: each undeclared identifier is reported only once
for each function it appears in
pcm_misc.c:209:7: error: 'SNDRV_PCM_FORMAT_DSD_U16_LE' undeclared (first
use in this function)
case SNDRV_PCM_FORMAT_DSD_U16_LE:
^
pcm_misc.c: In function 'snd_pcm_format_physical_width':
pcm_misc.c:258:7: error: 'SNDRV_PCM_FORMAT_DSD_U8' undeclared (first use
in this function)
case SNDRV_PCM_FORMAT_DSD_U8:
^
pcm_misc.c:264:7: error: 'SNDRV_PCM_FORMAT_DSD_U16' undeclared (first
use in this function)
case SNDRV_PCM_FORMAT_DSD_U16:
The SNDRV_PCM_FORMAT_DSD??? are there in /usr/include/sound/asound.h
It seems alsa-lib uses it own asound.h which does not have the DSD
defines. See 'include/sound/asound.h' is this intentional?
Jurgen
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix DSD formats userland usability
2014-08-10 13:38 ` Jurgen Kramer
@ 2014-08-11 8:06 ` Takashi Iwai
2014-08-11 9:56 ` Takashi Iwai
0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2014-08-11 8:06 UTC (permalink / raw)
To: Jurgen Kramer; +Cc: alsa-devel
At Sun, 10 Aug 2014 15:38:42 +0200,
Jurgen Kramer wrote:
>
> On Sun, 2014-08-10 at 13:44 +0200, Takashi Iwai wrote:
> > At Sat, 9 Aug 2014 12:09:21 +0200,
> > Jurgen Kramer wrote:
> > >
> > > Support for DSD sample formats has been added a while ago. This patch makes
> > > those sample formats beter usable from userland (e.g. aplay).
> > >
> > > ---
> > > include/sound/asound.h | 4 +++-
> > > src/pcm/pcm_misc.c | 4 ++++
> >
> > The new definitions are still missing in include/pcm.h?
> > include/sound/asound.h is a copy from the kernel, and the user-land
> > API is defined rather in include/pcm.h.
> >
> OK, the updates to alsa-lib pcm_misc.c are still valid but do not
> compile without my proposed update to include/sound/asound.h
Yes, we need to change both include/pcm.h and include/sound/asound.h.
In your patch, the necessary change in include/pcm.h is missing, and
that's what I suggested.
Takashi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix DSD formats userland usability
2014-08-11 8:06 ` Takashi Iwai
@ 2014-08-11 9:56 ` Takashi Iwai
0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2014-08-11 9:56 UTC (permalink / raw)
To: Jurgen Kramer; +Cc: alsa-devel
At Mon, 11 Aug 2014 10:06:48 +0200,
Takashi Iwai wrote:
>
> At Sun, 10 Aug 2014 15:38:42 +0200,
> Jurgen Kramer wrote:
> >
> > On Sun, 2014-08-10 at 13:44 +0200, Takashi Iwai wrote:
> > > At Sat, 9 Aug 2014 12:09:21 +0200,
> > > Jurgen Kramer wrote:
> > > >
> > > > Support for DSD sample formats has been added a while ago. This patch makes
> > > > those sample formats beter usable from userland (e.g. aplay).
> > > >
> > > > ---
> > > > include/sound/asound.h | 4 +++-
> > > > src/pcm/pcm_misc.c | 4 ++++
> > >
> > > The new definitions are still missing in include/pcm.h?
> > > include/sound/asound.h is a copy from the kernel, and the user-land
> > > API is defined rather in include/pcm.h.
> > >
> > OK, the updates to alsa-lib pcm_misc.c are still valid but do not
> > compile without my proposed update to include/sound/asound.h
>
> Yes, we need to change both include/pcm.h and include/sound/asound.h.
> In your patch, the necessary change in include/pcm.h is missing, and
> that's what I suggested.
I overlooked that include/pcm.h had already the definition of DTD
things. So now the patch was applied as is with a couple of more
additional fixes.
Takashi
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-08-11 9:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-09 10:09 [PATCH] Fix DSD formats userland usability Jurgen Kramer
2014-08-10 11:44 ` Takashi Iwai
2014-08-10 13:38 ` Jurgen Kramer
2014-08-11 8:06 ` Takashi Iwai
2014-08-11 9:56 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.