Commit 22d851e1 authored by Laurent Aimar's avatar Laurent Aimar

* all : fixed some memory leaks thanks valgrind.

parent 25eea88d
This diff is collapsed.
...@@ -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.17 2003/01/23 15:07:20 fenrir Exp $ * $Id: asf.c,v 1.18 2003/01/25 16:58:34 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
...@@ -858,7 +858,7 @@ static void Deactivate( vlc_object_t * p_this ) ...@@ -858,7 +858,7 @@ static void Deactivate( vlc_object_t * p_this )
} }
#undef p_stream #undef p_stream
} }
FREE( p_input->p_demux_data );
#undef FREE #undef FREE
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc * avi.c : AVI file Stream input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.30 2003/01/25 03:12:20 fenrir Exp $ * $Id: avi.c,v 1.31 2003/01/25 16:58:34 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
...@@ -52,7 +52,7 @@ static int AVIDemux_Seekable ( input_thread_t * ); ...@@ -52,7 +52,7 @@ static int AVIDemux_Seekable ( input_thread_t * );
static int AVIDemux_UnSeekable( input_thread_t *p_input ); static int AVIDemux_UnSeekable( input_thread_t *p_input );
#define AVIEnd(a) __AVIEnd(VLC_OBJECT(a)) #define AVIEnd(a) __AVIEnd(VLC_OBJECT(a))
#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
...@@ -793,6 +793,8 @@ static void __AVIEnd ( vlc_object_t * p_this ) ...@@ -793,6 +793,8 @@ static void __AVIEnd ( vlc_object_t * p_this )
} }
#endif #endif
AVI_ChunkFreeRoot( p_input, &p_avi->ck_root ); AVI_ChunkFreeRoot( p_input, &p_avi->ck_root );
FREE( p_input->p_demux_data );
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libavi.c : * libavi.c :
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: libavi.c,v 1.14 2003/01/20 13:01:53 fenrir Exp $ * $Id: libavi.c,v 1.15 2003/01/25 16:58:34 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
...@@ -520,6 +520,7 @@ static int AVI_ChunkRead_strf( input_thread_t *p_input, ...@@ -520,6 +520,7 @@ static int AVI_ChunkRead_strf( input_thread_t *p_input,
switch( p_strh->strh.i_type ) switch( p_strh->strh.i_type )
{ {
case( AVIFOURCC_auds ): case( AVIFOURCC_auds ):
p_chk->strf.auds.i_cat = AUDIO_ES;
p_chk->strf.auds.p_wf = malloc( p_chk->common.i_chunk_size ); p_chk->strf.auds.p_wf = malloc( p_chk->common.i_chunk_size );
AVI_READ2BYTES( p_chk->strf.auds.p_wf->wFormatTag ); AVI_READ2BYTES( p_chk->strf.auds.p_wf->wFormatTag );
AVI_READ2BYTES( p_chk->strf.auds.p_wf->nChannels ); AVI_READ2BYTES( p_chk->strf.auds.p_wf->nChannels );
...@@ -561,6 +562,7 @@ static int AVI_ChunkRead_strf( input_thread_t *p_input, ...@@ -561,6 +562,7 @@ static int AVI_ChunkRead_strf( input_thread_t *p_input,
break; break;
case( AVIFOURCC_vids ): case( AVIFOURCC_vids ):
p_strh->strh.i_samplesize = 0; // XXX for ffmpeg avi file p_strh->strh.i_samplesize = 0; // XXX for ffmpeg avi file
p_chk->strf.vids.i_cat = VIDEO_ES;
p_chk->strf.vids.p_bih = malloc( p_chk->common.i_chunk_size ); p_chk->strf.vids.p_bih = malloc( p_chk->common.i_chunk_size );
AVI_READ4BYTES( p_chk->strf.vids.p_bih->biSize ); AVI_READ4BYTES( p_chk->strf.vids.p_bih->biSize );
AVI_READ4BYTES( p_chk->strf.vids.p_bih->biWidth ); AVI_READ4BYTES( p_chk->strf.vids.p_bih->biWidth );
...@@ -597,6 +599,7 @@ static int AVI_ChunkRead_strf( input_thread_t *p_input, ...@@ -597,6 +599,7 @@ static int AVI_ChunkRead_strf( input_thread_t *p_input,
break; break;
default: default:
msg_Warn( p_input, "unknown stream type" ); msg_Warn( p_input, "unknown stream type" );
p_chk->strf.common.i_cat = UNKNOWN_ES;
break; break;
} }
AVI_READCHUNK_EXIT( VLC_SUCCESS ); AVI_READCHUNK_EXIT( VLC_SUCCESS );
...@@ -604,7 +607,18 @@ static int AVI_ChunkRead_strf( input_thread_t *p_input, ...@@ -604,7 +607,18 @@ static int AVI_ChunkRead_strf( input_thread_t *p_input,
static void AVI_ChunkFree_strf( input_thread_t *p_input, static void AVI_ChunkFree_strf( input_thread_t *p_input,
avi_chunk_t *p_chk ) avi_chunk_t *p_chk )
{ {
avi_chunk_strf_t *p_strf = (avi_chunk_strf_t*)p_chk;
switch( p_strf->common.i_cat )
{
case AUDIO_ES:
FREE( p_strf->auds.p_wf );
break;
case VIDEO_ES:
FREE( p_strf->vids.p_bih );
break;
default:
break;
}
} }
static int AVI_ChunkRead_strd( input_thread_t *p_input, static int AVI_ChunkRead_strd( input_thread_t *p_input,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libavi.h : LibAVI library * libavi.h : LibAVI library
****************************************************************************** ******************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: libavi.h,v 1.6 2002/12/06 16:34:06 sam Exp $ * $Id: libavi.h,v 1.7 2003/01/25 16:58:34 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
...@@ -237,12 +237,14 @@ typedef struct avi_chunk_strh_s ...@@ -237,12 +237,14 @@ typedef struct avi_chunk_strh_s
typedef struct avi_chunk_strf_auds_s typedef struct avi_chunk_strf_auds_s
{ {
AVI_CHUNK_COMMON AVI_CHUNK_COMMON
int i_cat;
WAVEFORMATEX *p_wf; WAVEFORMATEX *p_wf;
} avi_chunk_strf_auds_t; } avi_chunk_strf_auds_t;
typedef struct avi_chunk_strf_vids_s typedef struct avi_chunk_strf_vids_s
{ {
AVI_CHUNK_COMMON AVI_CHUNK_COMMON
int i_cat;
BITMAPINFOHEADER *p_bih; BITMAPINFOHEADER *p_bih;
} avi_chunk_strf_vids_t; } avi_chunk_strf_vids_t;
...@@ -250,6 +252,11 @@ typedef union avi_chunk_strf_u ...@@ -250,6 +252,11 @@ typedef union avi_chunk_strf_u
{ {
avi_chunk_strf_auds_t auds; avi_chunk_strf_auds_t auds;
avi_chunk_strf_vids_t vids; avi_chunk_strf_vids_t vids;
struct
{
AVI_CHUNK_COMMON
int i_cat;
} common;
} avi_chunk_strf_t; } avi_chunk_strf_t;
typedef struct avi_chunk_strd_s typedef struct avi_chunk_strd_s
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* demuxdump.c : Pseudo demux module for vlc (dump raw stream) * demuxdump.c : Pseudo demux module for vlc (dump raw stream)
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: demuxdump.c,v 1.2 2002/12/18 14:17:10 sam Exp $ * $Id: demuxdump.c,v 1.3 2003/01/25 16:58:34 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -113,7 +113,7 @@ static int Activate( vlc_object_t * p_this ) ...@@ -113,7 +113,7 @@ static int Activate( vlc_object_t * p_this )
psz_name ); psz_name );
p_demux->psz_name = psz_name; p_demux->psz_name = psz_name;
} }
p_demux->i_write = 0; p_demux->i_write = 0;
p_demux->p_demux_data_sav = p_input->p_demux_data; p_demux->p_demux_data_sav = p_input->p_demux_data;
...@@ -124,7 +124,7 @@ static int Activate( vlc_object_t * p_this ) ...@@ -124,7 +124,7 @@ static int Activate( vlc_object_t * p_this )
} }
else else
{ {
if( input_InitStream( p_input, 0 ) == -1 ) if( input_InitStream( p_input, 0 ) == -1 )
{ {
fclose( p_demux->p_file ); fclose( p_demux->p_file );
...@@ -133,7 +133,7 @@ static int Activate( vlc_object_t * p_this ) ...@@ -133,7 +133,7 @@ static int Activate( vlc_object_t * p_this )
} }
input_AddProgram( p_input, 0, 0 ); input_AddProgram( p_input, 0, 0 );
p_input->stream.p_selected_program = p_input->stream.pp_programs[0]; p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.p_selected_area->i_tell = 0; p_input->stream.p_selected_area->i_tell = 0;
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
...@@ -155,12 +155,12 @@ static void Desactivate ( vlc_object_t *p_this ) ...@@ -155,12 +155,12 @@ static void Desactivate ( 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;
demux_sys_t *p_demux = (demux_sys_t*)p_input->p_demux_data; demux_sys_t *p_demux = (demux_sys_t*)p_input->p_demux_data;
msg_Info( p_input, msg_Info( p_input,
"closing %s ("I64Fd" Kbytes dumped)", "closing %s ("I64Fd" Kbytes dumped)",
p_demux->psz_name, p_demux->psz_name,
p_demux->i_write / 1024 ); p_demux->i_write / 1024 );
if( p_demux->p_file ) if( p_demux->p_file )
{ {
fclose( p_demux->p_file ); fclose( p_demux->p_file );
...@@ -168,7 +168,7 @@ static void Desactivate ( vlc_object_t *p_this ) ...@@ -168,7 +168,7 @@ static void Desactivate ( vlc_object_t *p_this )
} }
if( p_demux->psz_name ) if( p_demux->psz_name )
{ {
free( p_demux->psz_name ); free( p_demux->psz_name );
} }
p_input->p_demux_data = p_demux->p_demux_data_sav; p_input->p_demux_data = p_demux->p_demux_data_sav;
free( p_demux ); free( p_demux );
......
This diff is collapsed.
...@@ -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.12 2003/01/08 10:46:30 fenrir Exp $ * $Id: mp4.c,v 1.13 2003/01/25 16:58:34 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
...@@ -441,6 +441,7 @@ static void __MP4End ( vlc_object_t * p_this ) ...@@ -441,6 +441,7 @@ static void __MP4End ( vlc_object_t * p_this )
FREE(p_demux->track[i_track].chunk[i_chunk].p_sample_delta_dts ); FREE(p_demux->track[i_track].chunk[i_chunk].p_sample_delta_dts );
} }
} }
FREE( p_demux->track[i_track].chunk );
if( !p_demux->track[i_track].i_sample_size ) if( !p_demux->track[i_track].i_sample_size )
{ {
...@@ -448,6 +449,8 @@ static void __MP4End ( vlc_object_t * p_this ) ...@@ -448,6 +449,8 @@ static void __MP4End ( vlc_object_t * p_this )
} }
} }
FREE( p_demux->track ); FREE( p_demux->track );
FREE( p_input->p_demux_data );
#undef FREE #undef FREE
} }
...@@ -1057,7 +1060,8 @@ static void MP4_StartDecoder( input_thread_t *p_input, ...@@ -1057,7 +1060,8 @@ static void MP4_StartDecoder( input_thread_t *p_input,
case( VIDEO_ES ): case( VIDEO_ES ):
/* now create a bitmapinfoheader_t for decoder and /* now create a bitmapinfoheader_t for decoder and
add information found in p_esds */ add information found in p_esds */
p_init = malloc( sizeof( BITMAPINFOHEADER ) + i_decoder_specific_info_len ); /* XXX XXX + 16 are for avoid segfault when ffmpeg access beyong the data */
p_init = malloc( sizeof( BITMAPINFOHEADER ) + i_decoder_specific_info_len + 16 );
p_bih = (BITMAPINFOHEADER*)p_init; p_bih = (BITMAPINFOHEADER*)p_init;
p_bih->biSize = sizeof( BITMAPINFOHEADER ) + i_decoder_specific_info_len; p_bih->biSize = sizeof( BITMAPINFOHEADER ) + i_decoder_specific_info_len;
...@@ -1117,7 +1121,7 @@ static void MP4_StartDecoder( input_thread_t *p_input, ...@@ -1117,7 +1121,7 @@ static void MP4_StartDecoder( input_thread_t *p_input,
break; break;
case( AUDIO_ES ): case( AUDIO_ES ):
p_init = malloc( sizeof( WAVEFORMATEX ) + i_decoder_specific_info_len); p_init = malloc( sizeof( WAVEFORMATEX ) + i_decoder_specific_info_len + 16 );
p_wf = (WAVEFORMATEX*)p_init; p_wf = (WAVEFORMATEX*)p_init;
p_wf->wFormatTag = 0; p_wf->wFormatTag = 0;
......
...@@ -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.9 2003/01/07 21:49:01 fenrir Exp $ * $Id: wav.c,v 1.10 2003/01/25 16:58:35 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
...@@ -60,18 +60,18 @@ vlc_module_end(); ...@@ -60,18 +60,18 @@ vlc_module_end();
#define __EVEN( x ) ( (x)%2 != 0 ) ? ((x)+1) : (x) #define __EVEN( x ) ( (x)%2 != 0 ) ? ((x)+1) : (x)
/* Some functions to manipulate memory */ /* Some functions to manipulate memory */
static u16 GetWLE( u8 *p_buff ) static uint16_t GetWLE( uint8_t *p_buff )
{ {
return( (p_buff[0]) + ( p_buff[1] <<8 ) ); return( (p_buff[0]) + ( p_buff[1] <<8 ) );
} }
static u32 GetDWLE( u8 *p_buff ) static uint32_t GetDWLE( uint8_t *p_buff )
{ {
return( p_buff[0] + ( p_buff[1] <<8 ) + return( p_buff[0] + ( p_buff[1] <<8 ) +
( p_buff[2] <<16 ) + ( p_buff[3] <<24 ) ); ( p_buff[2] <<16 ) + ( p_buff[3] <<24 ) );
} }
static u32 CreateDWLE( int a, int b, int c, int d ) static uint32_t CreateDWLE( int a, int b, int c, int d )
{ {
return( a + ( b << 8 ) + ( c << 16 ) + ( d << 24 ) ); return( a + ( b << 8 ) + ( c << 16 ) + ( d << 24 ) );
} }
...@@ -116,13 +116,13 @@ static int SkipBytes( input_thread_t *p_input, int i_skip ) ...@@ -116,13 +116,13 @@ static int SkipBytes( input_thread_t *p_input, int i_skip )
} }
/* return 1 if success, 0 if fail */ /* return 1 if success, 0 if fail */
static int ReadData( input_thread_t *p_input, u8 *p_buff, int i_size ) static int ReadData( input_thread_t *p_input, uint8_t *p_buff, int i_size )
{ {
data_packet_t *p_data; data_packet_t *p_data;
int i_read; int i_read;
if( !i_size ) if( !i_size )
{ {
return( 1 ); return( 1 );
...@@ -137,12 +137,12 @@ static int ReadData( input_thread_t *p_input, u8 *p_buff, int i_size ) ...@@ -137,12 +137,12 @@ static int ReadData( input_thread_t *p_input, u8 *p_buff, int i_size )
} }
memcpy( p_buff, p_data->p_payload_start, i_read ); memcpy( p_buff, p_data->p_payload_start, i_read );
input_DeletePacket( p_input->p_method_data, p_data ); input_DeletePacket( p_input->p_method_data, p_data );
p_buff += i_read; p_buff += i_read;
i_size -= i_read; i_size -= i_read;
} while( i_size ); } while( i_size );
return( 1 ); return( 1 );
} }
...@@ -154,7 +154,7 @@ static int ReadPES( input_thread_t *p_input, ...@@ -154,7 +154,7 @@ static int ReadPES( input_thread_t *p_input,
pes_packet_t *p_pes; pes_packet_t *p_pes;
*pp_pes = NULL; *pp_pes = NULL;
if( !(p_pes = input_NewPES( p_input->p_method_data )) ) if( !(p_pes = input_NewPES( p_input->p_method_data )) )
{ {
msg_Err( p_input, "cannot allocate new PES" ); msg_Err( p_input, "cannot allocate new PES" );
...@@ -192,11 +192,11 @@ static int ReadPES( input_thread_t *p_input, ...@@ -192,11 +192,11 @@ static int ReadPES( input_thread_t *p_input,
return( 1 ); return( 1 );
} }
static int FindTag( input_thread_t *p_input, u32 i_tag ) static int FindTag( input_thread_t *p_input, uint32_t i_tag )
{ {
u32 i_id; uint32_t i_id;
u32 i_size; uint32_t i_size;
u8 *p_peek; uint8_t *p_peek;
for( ;; ) for( ;; )
{ {
...@@ -226,10 +226,10 @@ static int FindTag( input_thread_t *p_input, u32 i_tag ) ...@@ -226,10 +226,10 @@ static int FindTag( input_thread_t *p_input, u32 i_tag )
static int LoadTag_fmt( input_thread_t *p_input, static int LoadTag_fmt( input_thread_t *p_input,
demux_sys_t *p_demux ) demux_sys_t *p_demux )
{ {
u8 *p_peek; uint8_t *p_peek;
u32 i_size; uint32_t i_size;
WAVEFORMATEX *p_wf; WAVEFORMATEX *p_wf;
if( input_Peek( p_input, &p_peek , 8 ) < 8 ) if( input_Peek( p_input, &p_peek , 8 ) < 8 )
{ {
...@@ -277,14 +277,14 @@ static int PCM_GetFrame( input_thread_t *p_input, ...@@ -277,14 +277,14 @@ static int PCM_GetFrame( input_thread_t *p_input,
/* read samples for 50ms of */ /* read samples for 50ms of */
i_samples = __MAX( p_wf->nSamplesPerSec / 20, 1 ); i_samples = __MAX( p_wf->nSamplesPerSec / 20, 1 );
*pi_length = (mtime_t)1000000 * *pi_length = (mtime_t)1000000 *
(mtime_t)i_samples / (mtime_t)i_samples /
(mtime_t)p_wf->nSamplesPerSec; (mtime_t)p_wf->nSamplesPerSec;
i_bytes = i_samples * p_wf->nChannels * ( (p_wf->wBitsPerSample + 7) / 8 ); i_bytes = i_samples * p_wf->nChannels * ( (p_wf->wBitsPerSample + 7) / 8 );
if( p_wf->nBlockAlign > 0 ) if( p_wf->nBlockAlign > 0 )
{ {
if( ( i_modulo = i_bytes % p_wf->nBlockAlign ) != 0 ) if( ( i_modulo = i_bytes % p_wf->nBlockAlign ) != 0 )
...@@ -305,7 +305,7 @@ static int MS_ADPCM_GetFrame( input_thread_t *p_input, ...@@ -305,7 +305,7 @@ static int MS_ADPCM_GetFrame( input_thread_t *p_input,
i_samples = 2 + 2 * ( p_wf->nBlockAlign - i_samples = 2 + 2 * ( p_wf->nBlockAlign -
7 * p_wf->nChannels ) / p_wf->nChannels; 7 * p_wf->nChannels ) / p_wf->nChannels;
*pi_length = (mtime_t)1000000 * *pi_length = (mtime_t)1000000 *
(mtime_t)i_samples / (mtime_t)i_samples /
(mtime_t)p_wf->nSamplesPerSec; (mtime_t)p_wf->nSamplesPerSec;
...@@ -336,8 +336,8 @@ static int IMA_ADPCM_GetFrame( input_thread_t *p_input, ...@@ -336,8 +336,8 @@ static int IMA_ADPCM_GetFrame( input_thread_t *p_input,
static int WAVInit( vlc_object_t * p_this ) static int WAVInit( 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;
u8 *p_peek; uint8_t *p_peek;
u32 i_size; uint32_t i_size;
demux_sys_t *p_demux; demux_sys_t *p_demux;
...@@ -380,7 +380,7 @@ static int WAVInit( vlc_object_t * p_this ) ...@@ -380,7 +380,7 @@ static int WAVInit( vlc_object_t * p_this )
return( -1 ); return( -1 );
} }
memset( p_demux, 0, sizeof( demux_sys_t ) ); memset( p_demux, 0, sizeof( demux_sys_t ) );
/* Load WAVEFORMATEX header */ /* Load WAVEFORMATEX header */
if( !LoadTag_fmt( p_input, p_demux ) ) if( !LoadTag_fmt( p_input, p_demux ) )
{ {
...@@ -396,7 +396,7 @@ static int WAVInit( vlc_object_t * p_this ) ...@@ -396,7 +396,7 @@ static int WAVInit( vlc_object_t * p_this )
p_demux->p_wf->nBlockAlign, p_demux->p_wf->nBlockAlign,
p_demux->p_wf->wBitsPerSample, p_demux->p_wf->wBitsPerSample,
p_demux->p_wf->cbSize ); p_demux->p_wf->cbSize );
if( !FindTag( p_input, CreateDWLE( 'd', 'a', 't', 'a' ) ) ) if( !FindTag( p_input, CreateDWLE( 'd', 'a', 't', 'a' ) ) )
{ {
msg_Err( p_input, "cannot find \"data\" tag" ); msg_Err( p_input, "cannot find \"data\" tag" );
...@@ -593,12 +593,12 @@ static int WAVDemux( input_thread_t *p_input ) ...@@ -593,12 +593,12 @@ static int WAVDemux( input_thread_t *p_input )
} }
if( p_demux->p_wf->nBlockAlign != 0 ) if( p_demux->p_wf->nBlockAlign != 0 )
{ {
i_offset += p_demux->p_wf->nBlockAlign - i_offset += p_demux->p_wf->nBlockAlign -
i_offset % p_demux->p_wf->nBlockAlign; i_offset % p_demux->p_wf->nBlockAlign;
} }
SeekAbsolute( p_input, p_demux->i_data_pos + i_offset ); SeekAbsolute( p_input, p_demux->i_data_pos + i_offset );
} }
input_ClockManageRef( p_input, input_ClockManageRef( p_input,
p_input->stream.p_selected_program, p_input->stream.p_selected_program,
p_demux->i_pcr ); p_demux->i_pcr );
...@@ -615,11 +615,11 @@ static int WAVDemux( input_thread_t *p_input ) ...@@ -615,11 +615,11 @@ static int WAVDemux( input_thread_t *p_input )
return( 0 ); return( 0 );
} }
p_pes->i_dts = p_pes->i_dts =
p_pes->i_pts = input_ClockGetTS( p_input, p_pes->i_pts = input_ClockGetTS( p_input,
p_input->stream.p_selected_program, p_input->stream.p_selected_program,
p_demux->i_pcr ); p_demux->i_pcr );
if( !p_demux->p_es->p_decoder_fifo ) if( !p_demux->p_es->p_decoder_fifo )
{ {
msg_Err( p_input, "no audio decoder" ); msg_Err( p_input, "no audio decoder" );
...@@ -630,7 +630,7 @@ static int WAVDemux( input_thread_t *p_input ) ...@@ -630,7 +630,7 @@ static int WAVDemux( input_thread_t *p_input )
{ {
input_DecodePES( p_demux->p_es->p_decoder_fifo, p_pes ); input_DecodePES( p_demux->p_es->p_decoder_fifo, p_pes );
} }
p_demux->i_pcr += i_length * 9 / 100; p_demux->i_pcr += i_length * 9 / 100;
return( 1 ); return( 1 );
} }
...@@ -639,17 +639,33 @@ static int WAVDemux( input_thread_t *p_input ) ...@@ -639,17 +639,33 @@ static int WAVDemux( input_thread_t *p_input )
* WAVEnd: frees unused data * WAVEnd: frees unused data
*****************************************************************************/ *****************************************************************************/
static void __WAVEnd ( vlc_object_t * p_this ) static void __WAVEnd ( 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;
demux_sys_t *p_demux = p_input->p_demux_data; demux_sys_t *p_demux = p_input->p_demux_data;
FREE( p_demux->p_wf ); FREE( p_demux->p_wf );
FREE( p_demux->psz_demux ); FREE( p_demux->psz_demux );
if( p_demux->p_demux ) if( p_demux->p_demux )
{ {
char *psz_sav;
/* save context */
psz_sav = p_input->psz_demux;
/* switch context */
p_input->pf_demux = p_demux->pf_demux;
p_input->p_demux_data = p_demux->p_demux_data;
p_input->psz_demux = p_demux->psz_demux;
/* unload module */
module_Unneed( p_input, p_demux->p_demux ); module_Unneed( p_input, p_demux->p_demux );
/* switch back */
p_input->psz_demux = psz_sav;
p_input->p_demux_data = p_demux;
} }
FREE( p_input->p_demux_data );
} }
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