[vlc-devel] [RFC] access/alsa.c: add new pcm formats from alsa 1.0.27

Janne Grunau janne-vlc at jannau.net
Sun May 19 15:33:54 CEST 2013


---
I'm not sure if using VLC_CODEC_G723_1 is correct. Libavcodec's
decoder seems to expect frames with a header but I suspect that the HW
will deliver just raw samples. Why would it otherwise need 4 different
format IDs for different bitstream formats.

Janne

 include/vlc_fourcc.h  | 3 +++
 modules/access/alsa.c | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/include/vlc_fourcc.h b/include/vlc_fourcc.h
index 782af9e..d185b60 100644
--- a/include/vlc_fourcc.h
+++ b/include/vlc_fourcc.h
@@ -339,6 +339,9 @@
 #define VLC_CODEC_F64L                       VLC_FOURCC('f','6','4','l')
 #define VLC_CODEC_F64B                       VLC_FOURCC('f','6','4','b')
 
+#define VLC_CODEC_DSD_U8                     VLC_FOURCC('d','s','d',0x08)
+#define VLC_CODEC_DSD_U16L                   VLC_FOURCC('d','s','d',0x10)
+
 #define VLC_CODEC_ALAW                       VLC_FOURCC('a','l','a','w')
 #define VLC_CODEC_MULAW                      VLC_FOURCC('m','l','a','w')
 #define VLC_CODEC_DAT12                      VLC_FOURCC('L','P','1','2')
diff --git a/modules/access/alsa.c b/modules/access/alsa.c
index 40f3d03..52f4650 100644
--- a/modules/access/alsa.c
+++ b/modules/access/alsa.c
@@ -289,6 +289,15 @@ static const vlc_fourcc_t formats[] = {
     [SND_PCM_FORMAT_S18_3BE]            = VLC_CODEC_S24B, // ^
     [SND_PCM_FORMAT_U18_3LE]            = VLC_CODEC_U24L, // ^
     [SND_PCM_FORMAT_U18_3BE]            = VLC_CODEC_U24B, // ^
+#if SND_LIB_VERSION >= 1 << 16 | 0 << 8 | 27
+    /* use different codecs for each bitstream format? */
+    [SND_PCM_FORMAT_G723_24]            = VLC_CODEC_G723_1,
+    [SND_PCM_FORMAT_G723_24_1B]         = VLC_CODEC_G723_1,
+    [SND_PCM_FORMAT_G723_40]            = VLC_CODEC_G723_1,
+    [SND_PCM_FORMAT_G723_40_1B]         = VLC_CODEC_G723_1,
+    [SND_PCM_FORMAT_DSD_U8]             = VLC_CODEC_DSD_U8,
+    [SND_PCM_FORMAT_DSD_U16_LE]         = VLC_CODEC_DSD_U16L,
+#endif /* SND_LIB_VERSION >= 1.0.27 */
 };
 
 #ifdef WORDS_BIGENDIAN
-- 
1.8.2.1




More information about the vlc-devel mailing list