Commit 9125323f authored by Laurent Aimar's avatar Laurent Aimar

* adpcm.c: add adpcm decoding support (Now just ms and ima adpcm from

microfsoft, not yet ima4)
 * wav, asf, avi: fix fourcc creation for adpcm. (Nevertheless adpcm
could not work with asf because of asf audio scrambling unsupported in asf
demuxer). Seek will not work, because vlc send garbage and then break stream
alignment.(I will try to fix that).
parent e5daac69
......@@ -620,7 +620,7 @@ PLUGINS="${PLUGINS} aout_file"
#PLUGINS="${PLUGINS} scope"
PLUGINS="${PLUGINS} i420_rgb i420_yuy2 i422_yuy2 i420_ymga"
PLUGINS="${PLUGINS} id3 m3u"
PLUGINS="${PLUGINS} wav araw demuxdump demuxsub"
PLUGINS="${PLUGINS} wav araw demuxdump demuxsub adpcm"
dnl
dnl Network modules
......
......@@ -2,7 +2,7 @@
* codecs.h: codec related structures needed by the demuxers and decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: codecs.h,v 1.2 2002/11/07 19:31:07 gbazin Exp $
* $Id: codecs.h,v 1.3 2002/12/03 17:00:15 fenrir Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -70,6 +70,7 @@ typedef struct {
#define WAVE_FORMAT_ALAW 0x0006 /* Microsoft Corporation */
#define WAVE_FORMAT_MULAW 0x0007 /* Microsoft Corporation */
#define WAVE_FORMAT_DTS 0x0008 /* Microsoft Corporation */
#define WAVE_FORMAT_IMA_ADPCM 0x0011
#define WAVE_FORMAT_MPEG 0x0050 /* Microsoft Corporation */
#define WAVE_FORMAT_MPEGLAYER3 0x0055 /* ISO/MPEG Layer3 Format Tag */
#define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092 /* Sonic Foundry */
......@@ -78,6 +79,7 @@ typedef struct {
#define WAVE_FORMAT_A52 0x2000
#define WAVE_FORMAT_WMA1 0x0160
#define WAVE_FORMAT_WMA2 0x0161
#define WAVE_FORMAT_WMA3 0x0162
#if !defined(WAVE_FORMAT_EXTENSIBLE)
#define WAVE_FORMAT_EXTENSIBLE 0xFFFE /* Microsoft */
......
......@@ -7,3 +7,4 @@ SOURCES_theora = modules/codec/theora.c
SOURCES_tremor = modules/codec/vorbis.c
SOURCES_dv = modules/codec/dv.c
SOURCES_xvid = modules/codec/xvid.c
SOURCES_adpcm = modules/codec/adpcm.c
This diff is collapsed.
......@@ -2,7 +2,7 @@
* asf.c : ASFv01 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: asf.c,v 1.10 2002/11/28 18:35:19 fenrir Exp $
* $Id: asf.c,v 1.11 2002/12/03 17:00:16 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -235,7 +235,7 @@ static int Activate( vlc_object_t * p_this )
break;
default:
p_stream->p_es->i_fourcc =
VLC_FOURCC( 'u','n','d','f' );
VLC_FOURCC( 'm','s',(i_codec >> 8)&0xff,i_codec&0xff );
}
if( p_sp->i_type_specific_data_length > 0 )
{
......
......@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.14 2002/11/17 06:46:56 fenrir Exp $
* $Id: avi.c,v 1.15 2002/12/03 17:00:16 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -228,8 +228,7 @@ vlc_fourcc_t AVI_FourccGetCodec( int i_cat, vlc_fourcc_t i_codec )
return VLC_FOURCC( 'w', 'm', 'a', '2' );
default:
return VLC_FOURCC( 'm', 's',
((uint8_t *)&i_codec)[2],
((uint8_t *)&i_codec)[3] );
( i_codec >> 8 )&0xff, i_codec&0xff );
}
case VIDEO_ES:
// XXX DIV1 <- msmpeg4v1, DIV2 <- msmpeg4v2, DIV3 <- msmpeg4v3, mp4v for mpeg4
......
......@@ -2,7 +2,7 @@
* wav.c : wav file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: wav.c,v 1.4 2002/11/28 16:32:29 fenrir Exp $
* $Id: wav.c,v 1.5 2002/12/03 17:00:16 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -98,7 +98,7 @@ static int SeekAbsolute( input_thread_t *p_input,
if( i_pos >= p_input->stream.p_selected_area->i_size )
{
return( 0 );
// return( 0 );
}
i_filepos = TellAbsolute( p_input );
......@@ -296,6 +296,40 @@ static int PCM_GetFrame( input_thread_t *p_input,
return( ReadPES( p_input, pp_pes, i_bytes ) );
}
static int MS_ADPCM_GetFrame( input_thread_t *p_input,
WAVEFORMATEX *p_wf,
pes_packet_t **pp_pes,
mtime_t *pi_length )
{
int i_samples;
i_samples = 2 + 2 * ( p_wf->nBlockAlign -
7 * p_wf->nChannels ) / p_wf->nChannels;
*pi_length = (mtime_t)1000000 *
(mtime_t)i_samples /
(mtime_t)p_wf->nSamplesPerSec;
return( ReadPES( p_input, pp_pes, p_wf->nBlockAlign ) );
}
static int IMA_ADPCM_GetFrame( input_thread_t *p_input,
WAVEFORMATEX *p_wf,
pes_packet_t **pp_pes,
mtime_t *pi_length )
{
int i_samples;
i_samples = 2 * ( p_wf->nBlockAlign -
4 * p_wf->nChannels ) / p_wf->nChannels;
*pi_length = (mtime_t)1000000 *
(mtime_t)i_samples /
(mtime_t)p_wf->nSamplesPerSec;
return( ReadPES( p_input, pp_pes, p_wf->nBlockAlign ) );
}
/*****************************************************************************
* WAVInit: check file and initializes structures
*****************************************************************************/
......@@ -385,25 +419,37 @@ static int WAVInit( vlc_object_t * p_this )
/* XXX p_demux->psz_demux shouldn't be NULL ! */
switch( p_demux->p_wf->wFormatTag )
{
case( 0x01 ):
case( WAVE_FORMAT_PCM ):
msg_Dbg( p_input,"found raw pcm audio format" );
p_demux->i_fourcc = VLC_FOURCC( 'a', 'r', 'a', 'w' );
p_demux->GetFrame = PCM_GetFrame;
p_demux->psz_demux = strdup( "" );
break;
case( 0x50 ):
case( 0x55 ):
case( WAVE_FORMAT_MPEG ):
case( WAVE_FORMAT_MPEGLAYER3 ):
msg_Dbg( p_input, "found mpeg audio format" );
p_demux->i_fourcc = VLC_FOURCC( 'm', 'p', 'g', 'a' );
p_demux->GetFrame = NULL;
p_demux->psz_demux = strdup( "mpegaudio" );
break;
case( 0x2000 ):
case( WAVE_FORMAT_A52 ):
msg_Dbg( p_input,"found a52 audio format" );
p_demux->i_fourcc = VLC_FOURCC( 'a', '5', '2', ' ' );
p_demux->GetFrame = NULL;
p_demux->psz_demux = strdup( "a52" );
break;
case( WAVE_FORMAT_ADPCM ):
msg_Dbg( p_input, "found ms adpcm audio format" );
p_demux->i_fourcc = VLC_FOURCC( 'm', 's', 0x00, 0x02 );
p_demux->GetFrame = MS_ADPCM_GetFrame;
p_demux->psz_demux = strdup( "" );
break;
case( WAVE_FORMAT_IMA_ADPCM ):
msg_Dbg( p_input, "found ima adpcm audio format" );
p_demux->i_fourcc = VLC_FOURCC( 'm', 's', 0x00, 0x11 );
p_demux->GetFrame = IMA_ADPCM_GetFrame;
p_demux->psz_demux = strdup( "" );
break;
default:
msg_Warn( p_input,"unrecognize audio format(0x%x)",
p_demux->p_wf->wFormatTag );
......@@ -544,15 +590,14 @@ static int WAVDemux( input_thread_t *p_input )
i_offset = TellAbsolute( p_input ) - p_demux->i_data_pos;
if( i_offset < 0 )
{
SeekAbsolute( p_input, p_demux->i_data_pos );
i_offset = 0;
}
else
if( p_demux->p_wf->nBlockAlign != 0 )
{
i_offset = i_offset - i_offset % p_demux->p_wf->nBlockAlign;
SeekAbsolute( p_input, p_demux->i_data_pos + i_offset );
i_offset += p_demux->p_wf->nBlockAlign -
i_offset % p_demux->p_wf->nBlockAlign;
}
SeekAbsolute( p_input, p_demux->i_data_pos + i_offset );
}
input_ClockManageRef( p_input,
......
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