[vlc-devel] [PATCH v2] Fix Duck DK3/DK4 ADPCM mappings

Daniel Verkamp daniel at drv.nu
Sat Nov 9 06:38:22 CET 2013


Also give them VLC_CODEC_ names and use them in the adpcm decoder.

v2: Add codec description strings
---
 include/vlc_codecs.h  | 9 ++++-----
 include/vlc_fourcc.h  | 2 ++
 modules/codec/adpcm.c | 8 ++++----
 src/misc/fourcc.c     | 6 ++++++
 4 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/include/vlc_codecs.h b/include/vlc_codecs.h
index 15f350b..4461374 100644
--- a/include/vlc_codecs.h
+++ b/include/vlc_codecs.h
@@ -271,9 +271,8 @@ ATTR_PACKED
 #define WAVE_FORMAT_GSM_AMR_FIXED       0x7A21 /* Fixed bitrate, no SID */
 #define WAVE_FORMAT_GSM_AMR             0x7A22 /* Variable bitrate, including SID */
 
-/* Need to check these */
-#define WAVE_FORMAT_DK3                 0x0061
-#define WAVE_FORMAT_DK4                 0x0062
+#define WAVE_FORMAT_DK3                 0x0062
+#define WAVE_FORMAT_DK4                 0x0061
 
 /* At least libavformat use that ID: from libavformat/riff.c ('Vo' == 0x566f)
  * { CODEC_ID_VORBIS, ('V'<<8)+'o' }, //HACK/FIXME, does vorbis in WAV/AVI have an (in)official id?
@@ -387,8 +386,8 @@ wave_format_tag_to_fourcc[] =
     { WAVE_FORMAT_WMAS,       VLC_CODEC_WMAS,                   "Window Media Audio 9 Speech" },
     { WAVE_FORMAT_ATRAC3,     VLC_CODEC_ATRAC3,                 "Sony Atrac3" },
     { WAVE_FORMAT_SONY_ATRAC3,VLC_CODEC_ATRAC3,                 "Sony Atrac3" },
-    { WAVE_FORMAT_DK3,        VLC_FOURCC( 'm', 's', 0x00,0x61), "Duck DK3" },
-    { WAVE_FORMAT_DK4,        VLC_FOURCC( 'm', 's', 0x00,0x62), "Duck DK4" },
+    { WAVE_FORMAT_DK3,        VLC_CODEC_ADPCM_DK3,              "Duck DK3" },
+    { WAVE_FORMAT_DK4,        VLC_CODEC_ADPCM_DK4,              "Duck DK4" },
     { WAVE_FORMAT_DTS,        VLC_CODEC_DTS,                    "DTS Coherent Acoustics" },
     { WAVE_FORMAT_DTS_MS,     VLC_CODEC_DTS,                    "DTS Coherent Acoustics" },
     { WAVE_FORMAT_DIVIO_AAC,  VLC_CODEC_MP4A,                   "MPEG-4 Audio (Divio)" },
diff --git a/include/vlc_fourcc.h b/include/vlc_fourcc.h
index c878d8a..abbfb12 100644
--- a/include/vlc_fourcc.h
+++ b/include/vlc_fourcc.h
@@ -306,6 +306,8 @@
 #define VLC_CODEC_ADPCM_IMA_AMV              VLC_FOURCC('i','m','a','v')
 #define VLC_CODEC_ADPCM_IMA_QT               VLC_FOURCC('i','m','a','4')
 #define VLC_CODEC_ADPCM_YAMAHA               VLC_FOURCC('m','s',0x00,0x20)
+#define VLC_CODEC_ADPCM_DK3                  VLC_FOURCC('m','s',0x00,0x62)
+#define VLC_CODEC_ADPCM_DK4                  VLC_FOURCC('m','s',0x00,0x61)
 #define VLC_CODEC_G723_1                     VLC_FOURCC('g','7','2', 0x31)
 #define VLC_CODEC_G729                       VLC_FOURCC('g','7','2','9')
 #define VLC_CODEC_VMDAUDIO                   VLC_FOURCC('v','m','d','a')
diff --git a/modules/codec/adpcm.c b/modules/codec/adpcm.c
index cdeb5b0..f3bfffd 100644
--- a/modules/codec/adpcm.c
+++ b/modules/codec/adpcm.c
@@ -141,8 +141,8 @@ static int OpenDecoder( vlc_object_t *p_this )
         case VLC_FOURCC('i','m','a', '4'): /* IMA ADPCM */
         case VLC_FOURCC('m','s',0x00,0x02): /* MS ADPCM */
         case VLC_FOURCC('m','s',0x00,0x11): /* IMA ADPCM */
-        case VLC_FOURCC('m','s',0x00,0x61): /* Duck DK4 ADPCM */
-        case VLC_FOURCC('m','s',0x00,0x62): /* Duck DK3 ADPCM */
+        case VLC_CODEC_ADPCM_DK3:
+        case VLC_CODEC_ADPCM_DK4:
         case VLC_FOURCC('X','A','J', 0): /* EA ADPCM */
             break;
         default:
@@ -179,10 +179,10 @@ static int OpenDecoder( vlc_object_t *p_this )
         case VLC_CODEC_ADPCM_MS: /* MS ADPCM */
             p_sys->codec = ADPCM_MS;
             break;
-        case VLC_FOURCC('m','s',0x00,0x61): /* Duck DK4 ADPCM */
+        case VLC_CODEC_ADPCM_DK4: /* Duck DK4 ADPCM */
             p_sys->codec = ADPCM_DK4;
             break;
-        case VLC_FOURCC('m','s',0x00,0x62): /* Duck DK3 ADPCM */
+        case VLC_CODEC_ADPCM_DK3: /* Duck DK3 ADPCM */
             p_sys->codec = ADPCM_DK3;
             break;
         case VLC_FOURCC('X','A','J', 0): /* EA ADPCM */
diff --git a/src/misc/fourcc.c b/src/misc/fourcc.c
index 2ef4372..5cd04fd 100644
--- a/src/misc/fourcc.c
+++ b/src/misc/fourcc.c
@@ -1169,6 +1169,12 @@ static const staticentry_t p_list_audio[] = {
     B(VLC_CODEC_ADPCM_YAMAHA, "Yamaha ADPCM Audio" ),
         A("ms\x00\x20"),
 
+    B(VLC_CODEC_ADPCM_DK3, "Duck DK3 ADPCM"),
+        A("ms\x00\x62"),
+
+    B(VLC_CODEC_ADPCM_DK4, "Duck DK4 ADPCM"),
+        A("ms\x00\x61"),
+
     /* AMR */
     B(VLC_CODEC_AMR_NB, "AMR narrow band"),
         A("samr"),
-- 
1.8.4.2




More information about the vlc-devel mailing list