Commit 474126cf authored by Laurent Aimar's avatar Laurent Aimar

* all: some clean up with WAVEFORMATEX and endian issues. Somebody could

test if mp4,asf,avi,wav demuxers and araw,ffmpeg,faad decoders work under
big endian architectures ? (else could you give vlc log )
parent 6da19ad6
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* araw.c: Pseudo audio decoder; for raw pcm data * araw.c: Pseudo audio decoder; for raw pcm data
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -31,25 +31,16 @@ ...@@ -31,25 +31,16 @@
#include <stdlib.h> /* malloc(), free() */ #include <stdlib.h> /* malloc(), free() */
#include <string.h> /* strdup() */ #include <string.h> /* strdup() */
#include "codecs.h"
/***************************************************************************** /*****************************************************************************
* Local prototypes * 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 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 */ /* The bit stream structure handles the PES stream at the bit level */
// bit_stream_t bit_stream; // bit_stream_t bit_stream;
...@@ -171,7 +162,8 @@ static int RunDecoder( decoder_fifo_t *p_fifo ) ...@@ -171,7 +162,8 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
#define GetDWLE( p ) \ #define GetDWLE( p ) \
( *(u8*)(p) + ( *((u8*)(p)+1) << 8 ) + \ ( *(u8*)(p) + ( *((u8*)(p)+1) << 8 ) + \
( *((u8*)(p)+2) << 16 ) + ( *((u8*)(p)+3) << 24 ) ) ( *((u8*)(p)+2) << 16 ) + ( *((u8*)(p)+3) << 24 ) )
#if 0
static void GetWaveFormatEx( waveformatex_t *p_wh, static void GetWaveFormatEx( waveformatex_t *p_wh,
u8 *p_data ) u8 *p_data )
{ {
...@@ -193,6 +185,7 @@ static void GetWaveFormatEx( waveformatex_t *p_wh, ...@@ -193,6 +185,7 @@ static void GetWaveFormatEx( waveformatex_t *p_wh,
} }
} }
} }
#endif
/***************************************************************************** /*****************************************************************************
* InitThread: initialize data before entering main loop * InitThread: initialize data before entering main loop
...@@ -201,31 +194,30 @@ static void GetWaveFormatEx( waveformatex_t *p_wh, ...@@ -201,31 +194,30 @@ static void GetWaveFormatEx( waveformatex_t *p_wh,
static int InitThread( adec_thread_t * p_adec ) static int InitThread( adec_thread_t * p_adec )
{ {
if( p_adec->p_fifo->p_demux_data ) 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
{ {
msg_Err( p_adec->p_fifo, "unknown raw format" ); msg_Err( p_adec->p_fifo, "unknown raw format" );
return( -1 ); 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, msg_Dbg( p_adec->p_fifo,
"raw format: samplerate:%dHz channels:%d bits/sample:%d blockalign:%d", "raw format: samplerate:%dHz channels:%d bits/sample:%d blockalign:%d",
p_adec->format.i_samplespersec, p_adec->p_wf->nSamplesPerSec,
p_adec->format.i_channels, p_adec->p_wf->nChannels,
p_adec->format.i_bitspersample, p_adec->format.i_blockalign ); p_adec->p_wf->wBitsPerSample,
p_adec->p_wf->nBlockAlign );
/* Initialize the thread properties */ /* Initialize the thread properties */
switch( ( p_adec->format.i_bitspersample + 7 ) / 8 ) switch( ( p_adec->p_wf->wBitsPerSample + 7 ) / 8 )
{ {
case( 2 ): case( 2 ):
p_adec->output_format.i_format = VLC_FOURCC('s','1','6','l'); p_adec->output_format.i_format = VLC_FOURCC('s','1','6','l');
...@@ -243,10 +235,10 @@ static int InitThread( adec_thread_t * p_adec ) ...@@ -243,10 +235,10 @@ static int InitThread( adec_thread_t * p_adec )
msg_Err( p_adec->p_fifo, "bad parameters(bits/sample)" ); msg_Err( p_adec->p_fifo, "bad parameters(bits/sample)" );
return( -1 ); 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 || if( p_adec->p_wf->nChannels <= 0 ||
p_adec->format.i_channels > 5 ) p_adec->p_wf->nChannels > 5 )
{ {
msg_Err( p_adec->p_fifo, "bad channels count(1-5)" ); msg_Err( p_adec->p_fifo, "bad channels count(1-5)" );
return( -1 ); return( -1 );
...@@ -254,7 +246,7 @@ static int InitThread( adec_thread_t * p_adec ) ...@@ -254,7 +246,7 @@ static int InitThread( adec_thread_t * p_adec )
p_adec->output_format.i_physical_channels = p_adec->output_format.i_physical_channels =
p_adec->output_format.i_original_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 = NULL;
p_adec->p_aout_input = NULL; p_adec->p_aout_input = NULL;
...@@ -328,11 +320,11 @@ static void DecodeThread( adec_thread_t *p_adec ) ...@@ -328,11 +320,11 @@ static void DecodeThread( adec_thread_t *p_adec )
} }
i_size = p_pes->i_pes_size; 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 ) if( !i_size || !p_pes )
{ {
...@@ -340,8 +332,8 @@ static void DecodeThread( adec_thread_t *p_adec ) ...@@ -340,8 +332,8 @@ static void DecodeThread( adec_thread_t *p_adec )
return; return;
} }
i_samples = i_size / i_samples = i_size /
( ( p_adec->format.i_bitspersample + 7 ) / 8 ) / ( ( p_adec->p_wf->wBitsPerSample + 7 ) / 8 ) /
p_adec->format.i_channels; p_adec->p_wf->nChannels;
// msg_Warn( p_adec->p_fifo, "got %d samples (%d bytes)", i_samples, i_size ); // msg_Warn( p_adec->p_fifo, "got %d samples (%d bytes)", i_samples, i_size );
p_adec->pts = p_pes->i_pts; p_adec->pts = p_pes->i_pts;
...@@ -390,8 +382,6 @@ static void EndThread (adec_thread_t *p_adec) ...@@ -390,8 +382,6 @@ static void EndThread (adec_thread_t *p_adec)
aout_DecDelete( p_adec->p_aout, p_adec->p_aout_input ); 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" ); msg_Dbg( p_adec->p_fifo, "raw audio decoder closed" );
free( p_adec ); free( p_adec );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* decoder.c: AAC decoder using libfaad2 * decoder.c: AAC decoder using libfaad2
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include <string.h> /* strdup() */ #include <string.h> /* strdup() */
#include <faad.h> #include <faad.h>
#include "codecs.h"
#include "decoder.h" #include "decoder.h"
...@@ -141,19 +141,22 @@ static int pi_channels_maps[6] = ...@@ -141,19 +141,22 @@ static int pi_channels_maps[6] =
static void faac_GetWaveFormatEx( waveformatex_t *p_wh, static void faac_GetWaveFormatEx( waveformatex_t *p_wh,
u8 *p_data ) u8 *p_data )
{ {
WAVEFORMATEX *p_wfdata = (WAVEFORMATEX*)p_data;
p_wh->i_formattag = GetWLE( p_data );
p_wh->i_nb_channels = GetWLE( p_data + 2 ); p_wh->i_formattag = p_wfdata->wFormatTag;
p_wh->i_samplespersec = GetDWLE( p_data + 4 ); p_wh->i_nb_channels = p_wfdata->nChannels;
p_wh->i_avgbytespersec= GetDWLE( p_data + 8 ); p_wh->i_samplespersec = p_wfdata->nSamplesPerSec;
p_wh->i_blockalign = GetWLE( p_data + 12 ); p_wh->i_avgbytespersec= p_wfdata->nAvgBytesPerSec;
p_wh->i_bitspersample = GetWLE( p_data + 14 ); p_wh->i_blockalign = p_wfdata->nBlockAlign;
p_wh->i_size = GetWLE( p_data + 16 ); p_wh->i_bitspersample = p_wfdata->wBitsPerSample;
p_wh->i_size = p_wfdata->cbSize;
if( p_wh->i_size ) if( p_wh->i_size )
{ {
p_wh->p_data = malloc( 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 );
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* audio.c: audio decoder using ffmpeg library * audio.c: audio decoder using ffmpeg library
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -42,11 +42,11 @@ ...@@ -42,11 +42,11 @@
#ifdef HAVE_SYS_TIMES_H #ifdef HAVE_SYS_TIMES_H
# include <sys/times.h> # include <sys/times.h>
#endif #endif
#include "codecs.h"
#include "avcodec.h" /* ffmpeg */ #include "avcodec.h" /* ffmpeg */
#include "postprocessing/postprocessing.h" //#include "postprocessing/postprocessing.h"
#include "ffmpeg.h" #include "ffmpeg.h"
#include "audio.h" #include "audio.h"
...@@ -74,18 +74,22 @@ static int pi_channels_maps[6] = ...@@ -74,18 +74,22 @@ static int pi_channels_maps[6] =
static void ffmpeg_GetWaveFormatEx( waveformatex_t *p_wh, static void ffmpeg_GetWaveFormatEx( waveformatex_t *p_wh,
u8 *p_data ) u8 *p_data )
{ {
p_wh->i_formattag = GetWLE( p_data ); WAVEFORMATEX *p_wfdata = (WAVEFORMATEX*)p_data;
p_wh->i_nb_channels = GetWLE( p_data + 2 );
p_wh->i_samplespersec = GetDWLE( p_data + 4 ); p_wh->i_formattag = p_wfdata->wFormatTag;
p_wh->i_avgbytespersec= GetDWLE( p_data + 8 ); p_wh->i_nb_channels = p_wfdata->nChannels;
p_wh->i_blockalign = GetWLE( p_data + 12 ); p_wh->i_samplespersec = p_wfdata->nSamplesPerSec;
p_wh->i_bitspersample = GetWLE( p_data + 14 ); p_wh->i_avgbytespersec= p_wfdata->nAvgBytesPerSec;
p_wh->i_size = GetWLE( p_data + 16 ); 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 ) if( p_wh->i_size )
{ {
p_wh->p_data = malloc( 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 );
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ffmpeg.c: video decoder using ffmpeg library * ffmpeg.c: video decoder using ffmpeg library
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -495,6 +495,7 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t i_fourcc, ...@@ -495,6 +495,7 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t i_fourcc,
case FOURCC_mjpg: case FOURCC_mjpg:
case FOURCC_mjpa: case FOURCC_mjpa:
case FOURCC_jpeg: case FOURCC_jpeg:
case FOURCC_JPEG:
case FOURCC_JFIF: case FOURCC_JFIF:
i_cat = VIDEO_ES; i_cat = VIDEO_ES;
i_codec = CODEC_ID_MJPEG; i_codec = CODEC_ID_MJPEG;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ffmpeg_vdec.h: video decoder using ffmpeg library * ffmpeg_vdec.h: video decoder using ffmpeg library
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -131,6 +131,7 @@ int E_( GetPESData )( u8 *p_buf, int i_max, pes_packet_t *p_pes ); ...@@ -131,6 +131,7 @@ int E_( GetPESData )( u8 *p_buf, int i_max, pes_packet_t *p_pes );
#define FOURCC_mjpb VLC_FOURCC( 'm', 'j', 'p', 'b' ) #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_JPEG VLC_FOURCC( 'J', 'P', 'E', 'G' )
#define FOURCC_JFIF VLC_FOURCC( 'J', 'F', 'I', 'F' ) #define FOURCC_JFIF VLC_FOURCC( 'J', 'F', 'I', 'F' )
/* wmv */ /* wmv */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* asf.c : ASFv01 file input module for vlc * asf.c : ASFv01 file input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -239,11 +239,29 @@ static int Activate( vlc_object_t * p_this ) ...@@ -239,11 +239,29 @@ static int Activate( vlc_object_t * p_this )
} }
if( p_sp->i_type_specific_data_length > 0 ) if( p_sp->i_type_specific_data_length > 0 )
{ {
p_stream->p_es->p_demux_data = WAVEFORMATEX *p_wf;
malloc( p_sp->i_type_specific_data_length ); int i_size;
memcpy( p_stream->p_es->p_demux_data, uint8_t *p_data;
p_sp->p_type_specific_data,
p_sp->i_type_specific_data_length ); 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 ) );
}
} }
} }
...@@ -257,7 +275,10 @@ static int Activate( vlc_object_t * p_this ) ...@@ -257,7 +275,10 @@ static int Activate( vlc_object_t * p_this )
if( p_sp->p_type_specific_data ) if( p_sp->p_type_specific_data )
{ {
p_stream->p_es->i_fourcc = 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 else
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mp4.c : MP4 file input module for vlc * mp4.c : MP4 file input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -90,7 +90,6 @@ static int MP4Init( vlc_object_t * p_this ) ...@@ -90,7 +90,6 @@ static int MP4Init( vlc_object_t * p_this )
{ {
input_thread_t *p_input = (input_thread_t *)p_this; input_thread_t *p_input = (input_thread_t *)p_this;
uint8_t *p_peek; uint8_t *p_peek;
uint32_t i_type;
demux_sys_t *p_demux; demux_sys_t *p_demux;
...@@ -123,9 +122,9 @@ static int MP4Init( vlc_object_t * p_this ) ...@@ -123,9 +122,9 @@ static int MP4Init( vlc_object_t * p_this )
msg_Warn( p_input, "MP4 plugin discarded (cannot peek)" ); msg_Warn( p_input, "MP4 plugin discarded (cannot peek)" );
return( -1 ); 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_ftyp ):
case( FOURCC_moov ): case( FOURCC_moov ):
...@@ -910,6 +909,7 @@ static void MP4_StartDecoder( input_thread_t *p_input, ...@@ -910,6 +909,7 @@ static void MP4_StartDecoder( input_thread_t *p_input,
uint8_t *p_init; uint8_t *p_init;
BITMAPINFOHEADER *p_bih; BITMAPINFOHEADER *p_bih;
WAVEFORMATEX *p_wf;
MP4_Box_t *p_esds; MP4_Box_t *p_esds;
...@@ -1090,24 +1090,22 @@ static void MP4_StartDecoder( input_thread_t *p_input, ...@@ -1090,24 +1090,22 @@ static void MP4_StartDecoder( input_thread_t *p_input,
break; break;
case( AUDIO_ES ): case( AUDIO_ES ):
p_init = malloc( 18 + i_decoder_specific_info_len); p_init = malloc( sizeof( WAVEFORMATEX ) + i_decoder_specific_info_len);
memset( p_init, 0, 18 + i_decoder_specific_info_len); p_wf = (WAVEFORMATEX*)p_init;
MP4_Set2BytesLE( p_init + 2, /* i_channel */
p_sample->data.p_sample_soun->i_channelcount ); p_wf->wFormatTag = 0;
MP4_Set4BytesLE( p_init + 4, /* samplepersec */ p_wf->nChannels = p_sample->data.p_sample_soun->i_channelcount;
p_sample->data.p_sample_soun->i_sampleratehi ); p_wf->nSamplesPerSec = p_sample->data.p_sample_soun->i_sampleratehi;
MP4_Set4BytesLE( p_init + 8, /* avgbytespersec */ p_wf->nAvgBytesPerSec = p_sample->data.p_sample_soun->i_channelcount *
p_sample->data.p_sample_soun->i_channelcount * p_sample->data.p_sample_soun->i_sampleratehi *
p_sample->data.p_sample_soun->i_sampleratehi * p_sample->data.p_sample_soun->i_samplesize / 8;
(p_sample->data.p_sample_soun->i_samplesize/8) ); p_wf->nBlockAlign = 0;
MP4_Set2BytesLE( p_init + 14, /* bits/sample */ p_wf->wBitsPerSample = p_sample->data.p_sample_soun->i_samplesize;
p_sample->data.p_sample_soun->i_samplesize ); p_wf->cbSize = i_decoder_specific_info_len;
MP4_Set2BytesLE( p_init + 16, /* i_size, specific info len*/
i_decoder_specific_info_len );
if( i_decoder_specific_info_len ) if( i_decoder_specific_info_len )
{ {
memcpy( p_init + 18, memcpy( p_init + sizeof( WAVEFORMATEX ),
p_decoder_specific_info, p_decoder_specific_info,
i_decoder_specific_info_len); i_decoder_specific_info_len);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wav.c : wav file input module for vlc * wav.c : wav file input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/input.h> #include <vlc/input.h>
#include <codecs.h>
#include "wav.h" #include "wav.h"
/***************************************************************************** /*****************************************************************************
...@@ -227,7 +228,9 @@ static int LoadTag_fmt( input_thread_t *p_input, ...@@ -227,7 +228,9 @@ static int LoadTag_fmt( input_thread_t *p_input,
{ {
u8 *p_peek; u8 *p_peek;
u32 i_size; u32 i_size;
WAVEFORMATEX *p_wf;
if( input_Peek( p_input, &p_peek , 8 ) < 8 ) if( input_Peek( p_input, &p_peek , 8 ) < 8 )
{ {
return( 0 ); return( 0 );
...@@ -240,26 +243,22 @@ static int LoadTag_fmt( input_thread_t *p_input, ...@@ -240,26 +243,22 @@ static int LoadTag_fmt( input_thread_t *p_input,
SkipBytes( p_input, i_size ); SkipBytes( p_input, i_size );
return( 0 ); return( 0 );
} }
p_demux->p_wf = malloc( i_size );