Commit 0bdface8 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: avi: add support for creative adpcm

refs samples/A-codecs/Creative/
parent e4f45b40
......@@ -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
......
......@@ -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" },
......
......@@ -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)
......
......@@ -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 },
......
......@@ -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 )
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment