* araw.c: Pseudo audio decoder; for raw pcm data
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
- * $Id: araw.c,v 1.7 2002/11/14 22:38:47 massiot Exp $
+ * $Id: araw.c,v 1.8 2002/11/28 16:32:29 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
#include <stdlib.h> /* malloc(), free() */
#include <string.h> /* strdup() */
-
+#include "codecs.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-typedef struct waveformatex_s
-{
- u16 i_formattag;
- u16 i_channels;
- u32 i_samplespersec;
- u32 i_avgbytespersec;
- u16 i_blockalign;
- u16 i_bitspersample;
- u16 i_size; /* the extra size in bytes */
- u8 *p_data; /* The extra data */
-} waveformatex_t;
typedef struct adec_thread_s
{
- waveformatex_t format;
+ WAVEFORMATEX *p_wf;
+
+ //waveformatex_t format;
/* The bit stream structure handles the PES stream at the bit level */
// bit_stream_t bit_stream;
#define GetDWLE( p ) \
( *(u8*)(p) + ( *((u8*)(p)+1) << 8 ) + \
( *((u8*)(p)+2) << 16 ) + ( *((u8*)(p)+3) << 24 ) )
-
+
+#if 0
static void GetWaveFormatEx( waveformatex_t *p_wh,
u8 *p_data )
{
}
}
}
+#endif
/*****************************************************************************
* InitThread: initialize data before entering main loop
static int InitThread( adec_thread_t * p_adec )
{
- if( p_adec->p_fifo->p_demux_data )
- {
- GetWaveFormatEx( &p_adec->format,
- (u8*)p_adec->p_fifo->p_demux_data );
- /* fixing some values */
- if( p_adec->format.i_formattag == 1 && !p_adec->format.i_blockalign )
- {
- p_adec->format.i_blockalign = p_adec->format.i_channels *
- ( ( p_adec->format.i_bitspersample + 7 ) / 8 );
- }
- }
- else
+ if( !p_adec->p_fifo->p_demux_data )
{
msg_Err( p_adec->p_fifo, "unknown raw format" );
return( -1 );
}
+ p_adec->p_wf = (WAVEFORMATEX*)p_adec->p_fifo->p_demux_data;
+ /* fixing some values */
+ if( p_adec->p_wf->wFormatTag == WAVE_FORMAT_PCM &&
+ !p_adec->p_wf->nBlockAlign )
+ {
+ p_adec->p_wf->nBlockAlign =
+ p_adec->p_wf->nChannels *
+ ( ( p_adec->p_wf->wBitsPerSample + 7 ) / 8 );
+ }
msg_Dbg( p_adec->p_fifo,
"raw format: samplerate:%dHz channels:%d bits/sample:%d blockalign:%d",
- p_adec->format.i_samplespersec,
- p_adec->format.i_channels,
- p_adec->format.i_bitspersample, p_adec->format.i_blockalign );
+ p_adec->p_wf->nSamplesPerSec,
+ p_adec->p_wf->nChannels,
+ p_adec->p_wf->wBitsPerSample,
+ p_adec->p_wf->nBlockAlign );
/* Initialize the thread properties */
- switch( ( p_adec->format.i_bitspersample + 7 ) / 8 )
+ switch( ( p_adec->p_wf->wBitsPerSample + 7 ) / 8 )
{
case( 2 ):
p_adec->output_format.i_format = VLC_FOURCC('s','1','6','l');
msg_Err( p_adec->p_fifo, "bad parameters(bits/sample)" );
return( -1 );
}
- p_adec->output_format.i_rate = p_adec->format.i_samplespersec;
+ p_adec->output_format.i_rate = p_adec->p_wf->nSamplesPerSec;
- if( p_adec->format.i_channels <= 0 ||
- p_adec->format.i_channels > 5 )
+ if( p_adec->p_wf->nChannels <= 0 ||
+ p_adec->p_wf->nChannels > 5 )
{
msg_Err( p_adec->p_fifo, "bad channels count(1-5)" );
return( -1 );
p_adec->output_format.i_physical_channels =
p_adec->output_format.i_original_channels =
- pi_channels_maps[p_adec->format.i_channels];
+ pi_channels_maps[p_adec->p_wf->nChannels];
p_adec->p_aout = NULL;
p_adec->p_aout_input = NULL;
}
i_size = p_pes->i_pes_size;
- if( p_adec->format.i_blockalign > 0 )
+ if( p_adec->p_wf->nBlockAlign > 0 )
{
- i_size -= i_size % p_adec->format.i_blockalign;
+ i_size -= i_size % p_adec->p_wf->nBlockAlign;
}
- i_size = __MAX( i_size, p_adec->format.i_blockalign );
+ i_size = __MAX( i_size, p_adec->p_wf->nBlockAlign );
if( !i_size || !p_pes )
{
return;
}
i_samples = i_size /
- ( ( p_adec->format.i_bitspersample + 7 ) / 8 ) /
- p_adec->format.i_channels;
+ ( ( p_adec->p_wf->wBitsPerSample + 7 ) / 8 ) /
+ p_adec->p_wf->nChannels;
// msg_Warn( p_adec->p_fifo, "got %d samples (%d bytes)", i_samples, i_size );
p_adec->pts = p_pes->i_pts;
aout_DecDelete( p_adec->p_aout, p_adec->p_aout_input );
}
- FREE( p_adec->format.p_data );
-
msg_Dbg( p_adec->p_fifo, "raw audio decoder closed" );
free( p_adec );
* decoder.c: AAC decoder using libfaad2
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
- * $Id: decoder.c,v 1.13 2002/11/15 01:17:08 fenrir Exp $
+ * $Id: decoder.c,v 1.14 2002/11/28 16:32:29 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
#include <string.h> /* strdup() */
#include <faad.h>
-
+#include "codecs.h"
#include "decoder.h"
static void faac_GetWaveFormatEx( waveformatex_t *p_wh,
u8 *p_data )
{
-
- p_wh->i_formattag = GetWLE( p_data );
- p_wh->i_nb_channels = GetWLE( p_data + 2 );
- p_wh->i_samplespersec = GetDWLE( p_data + 4 );
- p_wh->i_avgbytespersec= GetDWLE( p_data + 8 );
- p_wh->i_blockalign = GetWLE( p_data + 12 );
- p_wh->i_bitspersample = GetWLE( p_data + 14 );
- p_wh->i_size = GetWLE( p_data + 16 );
+ WAVEFORMATEX *p_wfdata = (WAVEFORMATEX*)p_data;
+
+ p_wh->i_formattag = p_wfdata->wFormatTag;
+ p_wh->i_nb_channels = p_wfdata->nChannels;
+ p_wh->i_samplespersec = p_wfdata->nSamplesPerSec;
+ p_wh->i_avgbytespersec= p_wfdata->nAvgBytesPerSec;
+ p_wh->i_blockalign = p_wfdata->nBlockAlign;
+ p_wh->i_bitspersample = p_wfdata->wBitsPerSample;
+ p_wh->i_size = p_wfdata->cbSize;
if( p_wh->i_size )
{
p_wh->p_data = malloc( p_wh->i_size );
- memcpy( p_wh->p_data, p_data + 18, p_wh->i_size );
+ memcpy( p_wh->p_data,
+ p_data + sizeof(WAVEFORMATEX) ,
+ p_wh->i_size );
}
}
* audio.c: audio decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: audio.c,v 1.4 2002/11/27 12:41:45 fenrir Exp $
+ * $Id: audio.c,v 1.5 2002/11/28 16:32:29 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
#ifdef HAVE_SYS_TIMES_H
# include <sys/times.h>
#endif
+#include "codecs.h"
#include "avcodec.h" /* ffmpeg */
-#include "postprocessing/postprocessing.h"
-
+//#include "postprocessing/postprocessing.h"
#include "ffmpeg.h"
#include "audio.h"
static void ffmpeg_GetWaveFormatEx( waveformatex_t *p_wh,
u8 *p_data )
{
- p_wh->i_formattag = GetWLE( p_data );
- p_wh->i_nb_channels = GetWLE( p_data + 2 );
- p_wh->i_samplespersec = GetDWLE( p_data + 4 );
- p_wh->i_avgbytespersec= GetDWLE( p_data + 8 );
- p_wh->i_blockalign = GetWLE( p_data + 12 );
- p_wh->i_bitspersample = GetWLE( p_data + 14 );
- p_wh->i_size = GetWLE( p_data + 16 );
+ WAVEFORMATEX *p_wfdata = (WAVEFORMATEX*)p_data;
+
+ p_wh->i_formattag = p_wfdata->wFormatTag;
+ p_wh->i_nb_channels = p_wfdata->nChannels;
+ p_wh->i_samplespersec = p_wfdata->nSamplesPerSec;
+ p_wh->i_avgbytespersec= p_wfdata->nAvgBytesPerSec;
+ p_wh->i_blockalign = p_wfdata->nBlockAlign;
+ p_wh->i_bitspersample = p_wfdata->wBitsPerSample;
+ p_wh->i_size = p_wfdata->cbSize;
if( p_wh->i_size )
{
p_wh->p_data = malloc( p_wh->i_size );
- memcpy( p_wh->p_data, p_data + 18, p_wh->i_size );
+ memcpy( p_wh->p_data,
+ p_data + sizeof(WAVEFORMATEX) ,
+ p_wh->i_size );
}
}
* ffmpeg.c: video decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: ffmpeg.c,v 1.19 2002/11/27 14:44:06 fenrir Exp $
+ * $Id: ffmpeg.c,v 1.20 2002/11/28 16:32:29 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
case FOURCC_mjpg:
case FOURCC_mjpa:
case FOURCC_jpeg:
+ case FOURCC_JPEG:
case FOURCC_JFIF:
i_cat = VIDEO_ES;
i_codec = CODEC_ID_MJPEG;
* ffmpeg_vdec.h: video decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: ffmpeg.h,v 1.9 2002/11/27 12:41:45 fenrir Exp $
+ * $Id: ffmpeg.h,v 1.10 2002/11/28 16:32:29 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
#define FOURCC_mjpb VLC_FOURCC( 'm', 'j', 'p', 'b' )
#define FOURCC_jpeg VLC_FOURCC( 'j', 'p', 'e', 'g' )
+#define FOURCC_JPEG VLC_FOURCC( 'J', 'P', 'E', 'G' )
#define FOURCC_JFIF VLC_FOURCC( 'J', 'F', 'I', 'F' )
/* wmv */
* asf.c : ASFv01 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: asf.c,v 1.8 2002/11/25 15:08:34 fenrir Exp $
+ * $Id: asf.c,v 1.9 2002/11/28 16:32:29 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
}
if( p_sp->i_type_specific_data_length > 0 )
{
- p_stream->p_es->p_demux_data =
- malloc( p_sp->i_type_specific_data_length );
- memcpy( p_stream->p_es->p_demux_data,
- p_sp->p_type_specific_data,
- p_sp->i_type_specific_data_length );
+ WAVEFORMATEX *p_wf;
+ int i_size;
+ uint8_t *p_data;
+
+ i_size = p_sp->i_type_specific_data_length;
+
+ p_wf = malloc( i_size );
+ p_stream->p_es->p_demux_data = (void*)p_wf;
+ p_data = p_sp->p_type_specific_data;
+
+ p_wf->wFormatTag = GetWLE( p_data );
+ p_wf->nChannels = GetWLE( p_data + 2 );
+ p_wf->nSamplesPerSec = GetDWLE( p_data + 4 );
+ p_wf->nAvgBytesPerSec = GetDWLE( p_data + 8 );
+ p_wf->nBlockAlign = GetWLE( p_data + 12 );
+ p_wf->wBitsPerSample = GetWLE( p_data + 14 );
+ p_wf->cbSize = i_size - sizeof( WAVEFORMATEX );
+ if( i_size > sizeof( WAVEFORMATEX ) )
+ {
+ memcpy( (uint8_t*)p_stream->p_es->p_demux_data + sizeof( WAVEFORMATEX ),
+ p_data + sizeof( WAVEFORMATEX ),
+ i_size - sizeof( WAVEFORMATEX ) );
+ }
}
}
if( p_sp->p_type_specific_data )
{
p_stream->p_es->i_fourcc =
- GetDWLE( p_sp->p_type_specific_data + 27 );
+ VLC_FOURCC( p_sp->p_type_specific_data + 27,
+ p_sp->p_type_specific_data + 28,
+ p_sp->p_type_specific_data + 29,
+ p_sp->p_type_specific_data + 30 );
}
else
{
* mp4.c : MP4 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: mp4.c,v 1.7 2002/11/26 17:28:22 fenrir Exp $
+ * $Id: mp4.c,v 1.8 2002/11/28 16:32:29 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
{
input_thread_t *p_input = (input_thread_t *)p_this;
uint8_t *p_peek;
- uint32_t i_type;
demux_sys_t *p_demux;
msg_Warn( p_input, "MP4 plugin discarded (cannot peek)" );
return( -1 );
}
- i_type = ( p_peek[4] ) + ( p_peek[5] << 8 ) +
- ( p_peek[6] << 16 ) + ( p_peek[7] << 24);
- switch( i_type )
+
+
+ switch( VLC_FOURCC( p_peek[4], p_peek[5], p_peek[6], p_peek[7] ) )
{
case( FOURCC_ftyp ):
case( FOURCC_moov ):
uint8_t *p_init;
BITMAPINFOHEADER *p_bih;
+ WAVEFORMATEX *p_wf;
MP4_Box_t *p_esds;
break;
case( AUDIO_ES ):
- p_init = malloc( 18 + i_decoder_specific_info_len);
- memset( p_init, 0, 18 + i_decoder_specific_info_len);
- MP4_Set2BytesLE( p_init + 2, /* i_channel */
- p_sample->data.p_sample_soun->i_channelcount );
- MP4_Set4BytesLE( p_init + 4, /* samplepersec */
- p_sample->data.p_sample_soun->i_sampleratehi );
- MP4_Set4BytesLE( p_init + 8, /* avgbytespersec */
- p_sample->data.p_sample_soun->i_channelcount *
- p_sample->data.p_sample_soun->i_sampleratehi *
- (p_sample->data.p_sample_soun->i_samplesize/8) );
- MP4_Set2BytesLE( p_init + 14, /* bits/sample */
- p_sample->data.p_sample_soun->i_samplesize );
-
- MP4_Set2BytesLE( p_init + 16, /* i_size, specific info len*/
- i_decoder_specific_info_len );
+ p_init = malloc( sizeof( WAVEFORMATEX ) + i_decoder_specific_info_len);
+ p_wf = (WAVEFORMATEX*)p_init;
+
+ p_wf->wFormatTag = 0;
+ p_wf->nChannels = p_sample->data.p_sample_soun->i_channelcount;
+ p_wf->nSamplesPerSec = p_sample->data.p_sample_soun->i_sampleratehi;
+ p_wf->nAvgBytesPerSec = p_sample->data.p_sample_soun->i_channelcount *
+ p_sample->data.p_sample_soun->i_sampleratehi *
+ p_sample->data.p_sample_soun->i_samplesize / 8;
+ p_wf->nBlockAlign = 0;
+ p_wf->wBitsPerSample = p_sample->data.p_sample_soun->i_samplesize;
+ p_wf->cbSize = i_decoder_specific_info_len;
+
if( i_decoder_specific_info_len )
{
- memcpy( p_init + 18,
+ memcpy( p_init + sizeof( WAVEFORMATEX ),
p_decoder_specific_info,
i_decoder_specific_info_len);
}
* wav.c : wav file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: wav.c,v 1.3 2002/11/21 13:53:32 sam Exp $
+ * $Id: wav.c,v 1.4 2002/11/28 16:32:29 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
#include <vlc/vlc.h>
#include <vlc/input.h>
+#include <codecs.h>
#include "wav.h"
/*****************************************************************************
{
u8 *p_peek;
u32 i_size;
-
+ WAVEFORMATEX *p_wf;
+
+
if( input_Peek( p_input, &p_peek , 8 ) < 8 )
{
return( 0 );
SkipBytes( p_input, i_size );
return( 0 );
}
- p_demux->p_wf = malloc( i_size );
- ReadData( p_input, p_demux->p_wf, __EVEN( i_size ) );
- p_demux->format.i_format = GetWLE( p_demux->p_wf );
- p_demux->format.i_channels = GetWLE( p_demux->p_wf + 2 );
- p_demux->format.i_samplepersec = GetDWLE( p_demux->p_wf + 4 );
- p_demux->format.i_avgbytespersec = GetDWLE( p_demux->p_wf + 8);
- p_demux->format.i_blockalign = GetWLE( p_demux->p_wf + 12 );
- p_demux->format.i_bitspersample = GetWLE( p_demux->p_wf + 14);
- if( i_size > 18 )
+ p_wf = p_demux->p_wf = malloc( __MAX( i_size, sizeof( WAVEFORMATEX) ) );
+ ReadData( p_input, (uint8_t*)p_wf, __EVEN( i_size ) );
+
+ p_wf->wFormatTag = GetWLE( (uint8_t*)&p_demux->p_wf->wFormatTag );
+ p_wf->nChannels = GetWLE( (uint8_t*)&p_demux->p_wf->nChannels );
+ p_wf->nSamplesPerSec = GetWLE( (uint8_t*)&p_demux->p_wf->nSamplesPerSec );
+ p_wf->nAvgBytesPerSec = GetWLE( (uint8_t*)&p_demux->p_wf->nAvgBytesPerSec );
+ p_wf->nBlockAlign = GetWLE( (uint8_t*)&p_demux->p_wf->nBlockAlign );
+ p_wf->wBitsPerSample = GetWLE( (uint8_t*)&p_demux->p_wf->wBitsPerSample );
+ if( i_size >= sizeof( WAVEFORMATEX) )
{
- p_demux->format.i_size = GetWLE( p_demux->p_wf + 16 );
- p_demux->format.p_data = malloc( p_demux->format.i_size );
- memcpy( p_demux->format.p_data,
- p_demux->p_wf + 18,
- p_demux->format.i_size );
+ p_wf->cbSize = GetWLE( (uint8_t*)&p_demux->p_wf->cbSize );
}
else
{
- p_demux->format.i_size = 0;
- p_demux->format.p_data = NULL;
+ p_wf->cbSize = 0;
}
msg_Dbg( p_input, "loaded \"fmt \" chunk" );
}
static int PCM_GetFrame( input_thread_t *p_input,
- waveformatex_t *p_wf,
- pes_packet_t **pp_pes,
- mtime_t *pi_length )
+ WAVEFORMATEX *p_wf,
+ pes_packet_t **pp_pes,
+ mtime_t *pi_length )
{
int i_samples;
int i_modulo;
/* read samples for 50ms of */
- i_samples = __MAX( p_wf->i_samplepersec / 20, 1 );
+ i_samples = __MAX( p_wf->nSamplesPerSec / 20, 1 );
*pi_length = (mtime_t)1000000 *
(mtime_t)i_samples /
- (mtime_t)p_wf->i_samplepersec;
+ (mtime_t)p_wf->nSamplesPerSec;
- i_bytes = i_samples * p_wf->i_channels * ( p_wf->i_bitspersample + 7 ) / 8;
+ i_bytes = i_samples * p_wf->nChannels * ( p_wf->wBitsPerSample + 7 ) / 8;
- if( p_wf->i_blockalign > 0 )
+ if( p_wf->nBlockAlign > 0 )
{
- if( ( i_modulo = i_bytes % p_wf->i_blockalign ) != 0 )
+ if( ( i_modulo = i_bytes % p_wf->nBlockAlign ) != 0 )
{
- i_bytes += p_wf->i_blockalign - i_modulo;
+ i_bytes += p_wf->nBlockAlign - i_modulo;
}
}
}
memset( p_demux, 0, sizeof( demux_sys_t ) );
- /* Load waveformatex_t header */
+ /* Load WAVEFORMATEX header */
if( !LoadTag_fmt( p_input, p_demux ) )
{
msg_Err( p_input, "cannot load \"fmt \" tag" );
return( -1 );
}
msg_Dbg( p_input, "format:0x%4.4x channels:%d %dHz %dKo/s blockalign:%d bits/samples:%d extra size:%d",
- p_demux->format.i_format,
- p_demux->format.i_channels,
- p_demux->format.i_samplepersec,
- p_demux->format.i_avgbytespersec/1024,
- p_demux->format.i_blockalign,
- p_demux->format.i_bitspersample,
- p_demux->format.i_size );
-
+ p_demux->p_wf->wFormatTag,
+ p_demux->p_wf->nChannels,
+ p_demux->p_wf->nSamplesPerSec,
+ p_demux->p_wf->nAvgBytesPerSec / 1024,
+ p_demux->p_wf->nBlockAlign,
+ p_demux->p_wf->wBitsPerSample,
+ p_demux->p_wf->cbSize );
+
if( !FindTag( p_input, CreateDWLE( 'd', 'a', 't', 'a' ) ) )
{
msg_Err( p_input, "cannot find \"data\" tag" );
FREE( p_demux->p_wf );
- FREE( p_demux->format.p_data );
FREE( p_demux );
return( -1 );
}
{
msg_Warn( p_input, "WAV plugin discarded (cannot peek)" );
FREE( p_demux->p_wf );
- FREE( p_demux->format.p_data );
FREE( p_demux );
return( -1 );
}
SkipBytes( p_input, 8 );
/* XXX p_demux->psz_demux shouldn't be NULL ! */
- switch( p_demux->format.i_format )
+ switch( p_demux->p_wf->wFormatTag )
{
case( 0x01 ):
msg_Dbg( p_input,"found raw pcm audio format" );
break;
default:
msg_Warn( p_input,"unrecognize audio format(0x%x)",
- p_demux->format.i_format );
+ p_demux->p_wf->wFormatTag );
p_demux->i_fourcc =
VLC_FOURCC( 'm', 's',
- (p_demux->format.i_format >> 8)&0xff,
- (p_demux->format.i_format )&0xff);
+ (p_demux->p_wf->wFormatTag >> 8)&0xff,
+ (p_demux->p_wf->wFormatTag )&0xff);
p_demux->GetFrame = NULL;
p_demux->psz_demux = strdup( "" );
break;
p_demux->p_es->i_stream_id = 1;
p_demux->p_es->i_fourcc = p_demux->i_fourcc;
p_demux->p_es->i_cat = AUDIO_ES;
- if( p_demux->i_wf > 0 && p_demux->p_wf )
- {
- memcpy( p_demux->p_es->p_demux_data,
- p_demux->p_wf,
- p_demux->i_wf );
- }
+ memcpy( p_demux->p_es->p_demux_data,
+ p_demux->p_wf,
+ p_demux->i_wf );
input_SelectES( p_input, p_demux->p_es );
{
msg_Err( p_input,
"cannot get external demux for formattag 0x%x",
- p_demux->format.i_format );
+ p_demux->p_wf->wFormatTag );
FREE( p_demux->psz_demux );
FREE( p_demux->p_wf );
- FREE( p_demux->format.p_data );
FREE( p_demux );
return( -1 );
}
}
-
return( 0 );
}
SeekAbsolute( p_input, p_demux->i_data_pos );
}
else
- if( p_demux->format.i_blockalign != 0 )
+ if( p_demux->p_wf->nBlockAlign != 0 )
{
- i_offset = i_offset - i_offset % p_demux->format.i_blockalign;
+ i_offset = i_offset - i_offset % p_demux->p_wf->nBlockAlign;
SeekAbsolute( p_input, p_demux->i_data_pos + i_offset );
}
}
return( 0 ); // EOF
}
- if( !p_demux->GetFrame( p_input, &p_demux->format, &p_pes, &i_length ) )
+ if( !p_demux->GetFrame( p_input, p_demux->p_wf, &p_pes, &i_length ) )
{
msg_Warn( p_input, "failed to get one frame" );
return( 0 );
demux_sys_t *p_demux = p_input->p_demux_data;
FREE( p_demux->p_wf );
- FREE( p_demux->format.p_data );
FREE( p_demux->psz_demux );
if( p_demux->p_demux )
* wav.h : wav file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: wav.h,v 1.1 2002/10/14 21:59:44 fenrir Exp $
+ * $Id: wav.h,v 1.2 2002/11/28 16:32:29 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
/*****************************************************************************
* Structure needed for decoder
*****************************************************************************/
-typedef struct waveformatex_s
-{
- u16 i_format;
- u16 i_channels;
- u32 i_samplepersec;
- u32 i_avgbytespersec;
- u16 i_blockalign;
- u16 i_bitspersample;
- u16 i_size; /* This give size of data
- imediatly following this header. */
- u8 *p_data;
-} waveformatex_t;
-
-
-/*****************************************************************************
- *
- *****************************************************************************/
struct demux_sys_t
{
vlc_fourcc_t i_fourcc;
es_descriptor_t *p_es;
- waveformatex_t format;
-
int i_wf; /* taille de p_wf */
- u8 *p_wf; /* waveformatex_t as store in file */
+ WAVEFORMATEX *p_wf;
off_t i_data_pos;
u64 i_data_size;
/* getframe for internal demux */
int (*GetFrame)( input_thread_t *p_input,
- waveformatex_t *p_wf,
+ WAVEFORMATEX *p_wf,
pes_packet_t **pp_pes,
mtime_t *pi_length );