[vlc-commits] demux: avi: add support for creative adpcm
Francois Cartegnie
git at videolan.org
Wed Apr 15 14:22:42 CEST 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Apr 15 13:39:30 2015 +0200| [0bdface8cba98d3c4bf8009c82ec8529b0d0c8e7] | committer: Francois Cartegnie
demux: avi: add support for creative adpcm
refs samples/A-codecs/Creative/
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0bdface8cba98d3c4bf8009c82ec8529b0d0c8e7
---
NEWS | 1 +
include/vlc_codecs.h | 3 +++
include/vlc_fourcc.h | 1 +
modules/codec/avcodec/fourcc.c | 2 +-
modules/demux/wav.c | 19 +++++++++++++++++++
5 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index 3b116ba..3701346 100644
--- a/NEWS
+++ b/NEWS
@@ -51,6 +51,7 @@ Demuxers:
* Fixes for DTS detection in WAV and MKV files
* Basic support for MPEG4-SL in TS and T-DMB
* Support for Creative ADPCM/alaw/ulaw/S16L in VOC files
+ * Support for Creative ADPCM in AVI
Stream filter:
* Added ARIB STD-B25 TS streams decoder
diff --git a/include/vlc_codecs.h b/include/vlc_codecs.h
index 2c0a726..c1fe6a2 100644
--- a/include/vlc_codecs.h
+++ b/include/vlc_codecs.h
@@ -252,6 +252,8 @@ ATTR_PACKED
#define WAVE_FORMAT_WMAP 0x0162 /* WMA 9 Professional */
#define WAVE_FORMAT_WMAL 0x0163 /* WMA 9 Lossless */
+#define WAVE_FORMAT_CREATIVE_ADPCM 0x0200 /* Creative */
+
#define WAVE_FORMAT_ULEAD_DV_AUDIO_NTSC 0x0215 /* Ulead */
#define WAVE_FORMAT_ULEAD_DV_AUDIO_PAL 0x0216 /* Ulead */
@@ -369,6 +371,7 @@ wave_format_tag_to_fourcc[] =
{ WAVE_FORMAT_ALAW, VLC_CODEC_ALAW, "A-Law" },
{ WAVE_FORMAT_MULAW, VLC_CODEC_MULAW, "Mu-Law" },
{ WAVE_FORMAT_IMA_ADPCM, VLC_CODEC_ADPCM_IMA_WAV, "Ima-ADPCM" },
+ { WAVE_FORMAT_CREATIVE_ADPCM, VLC_CODEC_ADPCM_CREATIVE, "Creative ADPCM" },
{ WAVE_FORMAT_YAMAHA_ADPCM, VLC_CODEC_ADPCM_YAMAHA, "Yamaha ADPCM" },
{ WAVE_FORMAT_TRUESPEECH, VLC_CODEC_TRUESPEECH, "Truespeech" },
{ WAVE_FORMAT_GSM610, VLC_CODEC_GSM_MS, "Microsoft WAV GSM" },
diff --git a/include/vlc_fourcc.h b/include/vlc_fourcc.h
index 2d25095..321329d 100644
--- a/include/vlc_fourcc.h
+++ b/include/vlc_fourcc.h
@@ -395,6 +395,7 @@
#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_ADPCM_CREATIVE VLC_FOURCC('m','s',0x00,0xC0)
#define VLC_CODEC_ADPCM_SBPRO_2 VLC_FOURCC('m','s',0x00,0xC2)
#define VLC_CODEC_ADPCM_SBPRO_3 VLC_FOURCC('m','s',0x00,0xC3)
#define VLC_CODEC_ADPCM_SBPRO_4 VLC_FOURCC('m','s',0x00,0xC4)
diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c
index 6bfa7eb..daf71e3 100644
--- a/modules/codec/avcodec/fourcc.c
+++ b/modules/codec/avcodec/fourcc.c
@@ -344,7 +344,7 @@ static const struct
{ VLC_CODEC_ADPCM_ADX, AV_CODEC_ID_ADPCM_ADX, AUDIO_ES },
{ VLC_CODEC_ADPCM_EA, AV_CODEC_ID_ADPCM_EA, AUDIO_ES },
{ VLC_CODEC_ADPCM_G726, AV_CODEC_ID_ADPCM_G726, AUDIO_ES },
- /* AV_CODEC_ID_ADPCM_CT */
+ { VLC_CODEC_ADPCM_CREATIVE, AV_CODEC_ID_ADPCM_CT, AUDIO_ES },
{ VLC_CODEC_ADPCM_SWF, AV_CODEC_ID_ADPCM_SWF, AUDIO_ES },
{ VLC_CODEC_ADPCM_YAMAHA, AV_CODEC_ID_ADPCM_YAMAHA, AUDIO_ES },
{ VLC_CODEC_ADPCM_SBPRO_4, AV_CODEC_ID_ADPCM_SBPRO_4, AUDIO_ES },
diff --git a/modules/demux/wav.c b/modules/demux/wav.c
index 0ac9d5e..328bafd 100644
--- a/modules/demux/wav.c
+++ b/modules/demux/wav.c
@@ -79,6 +79,7 @@ static int ChunkFind( demux_t *, const char *, unsigned int * );
static int FrameInfo_IMA_ADPCM( unsigned int *, int *, const es_format_t * );
static int FrameInfo_MS_ADPCM ( unsigned int *, int *, const es_format_t * );
+static int FrameInfo_Creative_ADPCM( unsigned int *, int *, const es_format_t * );
static int FrameInfo_PCM ( unsigned int *, int *, const es_format_t * );
static int FrameInfo_MSGSM ( unsigned int *, int *, const es_format_t * );
@@ -345,6 +346,11 @@ static int Open( vlc_object_t * p_this )
&p_sys->fmt ) )
goto error;
break;
+ case VLC_CODEC_ADPCM_CREATIVE:
+ if( FrameInfo_Creative_ADPCM( &p_sys->i_frame_size, &p_sys->i_frame_samples,
+ &p_sys->fmt ) )
+ goto error;
+ break;
case VLC_CODEC_MPGA:
case VLC_CODEC_A52:
/* FIXME set end of area FIXME */
@@ -572,6 +578,19 @@ static int FrameInfo_IMA_ADPCM( unsigned int *pi_size, int *pi_samples,
return VLC_SUCCESS;
}
+static int FrameInfo_Creative_ADPCM( unsigned int *pi_size, int *pi_samples,
+ const es_format_t *p_fmt )
+{
+ if( p_fmt->audio.i_channels <= 0 )
+ return VLC_EGENERIC;
+
+ /* 4 bits / sample */
+ *pi_samples = p_fmt->audio.i_blockalign * 2 / p_fmt->audio.i_channels;
+ *pi_size = p_fmt->audio.i_blockalign;
+
+ return VLC_SUCCESS;
+}
+
static int FrameInfo_MSGSM( unsigned int *pi_size, int *pi_samples,
const es_format_t *p_fmt )
{
More information about the vlc-commits
mailing list