Commit 380edbae authored by gbazin's avatar gbazin

* ALL: fixed memory leaks.
* modules/demux/mp4/libmp4.c: fixed parsing of the "wave" tag (I'm sure there's a better fix but this one works).
* modules/demux/ogg.c: another seeking fix (We also need to flush the per stream buffer with ogg_stream_reset()).
parent 695943b9
......@@ -2,7 +2,7 @@
* postprocess.c: video postprocessing using the ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: postprocess.c,v 1.5 2003/11/24 00:01:42 gbazin Exp $
* $Id: postprocess.c,v 1.6 2003/11/26 08:18:09 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -81,7 +81,7 @@ void *E_(OpenPostproc)( decoder_t *p_dec, vlc_bool_t *pb_pp )
{
var_Create( p_dec, "ffmpeg-pp-q",
VLC_VAR_INTEGER | VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT );
text.psz_string = _("Post-Processing");
text.psz_string = _("Post processing");
var_Change( p_dec, "ffmpeg-pp-q", VLC_VAR_SETTEXT, &text, NULL );
var_Get( p_dec, "ffmpeg-pp-q", &val_orig );
......@@ -200,6 +200,8 @@ void E_(ClosePostproc)( decoder_t *p_dec, void *p_data )
}
var_DelCallback( p_dec, "ffmpeg-pp-q", PPQCallback, p_sys );
if( p_sys ) free( p_sys );
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.76 2003/11/24 13:40:03 gbazin Exp $
* $Id: avi.c,v 1.77 2003/11/26 08:18:09 gbazin Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -278,15 +278,11 @@ static int Open( vlc_object_t * p_this )
fmt.i_bitrate = p_auds->p_wf->nAvgBytesPerSec*8;
fmt.audio.i_blockalign = p_auds->p_wf->nBlockAlign;
fmt.audio.i_bitspersample = p_auds->p_wf->wBitsPerSample;
if( ( fmt.i_extra = __MIN( p_auds->p_wf->cbSize,
p_auds->i_chunk_size - sizeof(WAVEFORMATEX) ) ) > 0 )
{
fmt.p_extra = malloc( fmt.i_extra );
memcpy( fmt.p_extra, &p_auds->p_wf[1], fmt.i_extra );
}
fmt.i_extra = __MIN( p_auds->p_wf->cbSize,
p_auds->i_chunk_size - sizeof(WAVEFORMATEX) );
fmt.p_extra = &p_auds->p_wf[1];
msg_Dbg( p_input, "stream[%d] audio(0x%x) %d channels %dHz %dbits",
i,
p_auds->p_wf->wFormatTag, p_auds->p_wf->nChannels,
i, p_auds->p_wf->wFormatTag, p_auds->p_wf->nChannels,
p_auds->p_wf->nSamplesPerSec, p_auds->p_wf->wBitsPerSample);
break;
......@@ -298,12 +294,10 @@ static int Open( vlc_object_t * p_this )
tk->i_samplesize = 0;
fmt.video.i_width = p_vids->p_bih->biWidth;
fmt.video.i_height = p_vids->p_bih->biHeight;
if( ( fmt.i_extra = __MIN( p_vids->p_bih->biSize - sizeof( BITMAPINFOHEADER ),
p_vids->i_chunk_size - sizeof(BITMAPINFOHEADER) ) ) > 0 )
{
fmt.p_extra = malloc( fmt.i_extra );
memcpy( fmt.p_extra, &p_vids->p_bih[1], fmt.i_extra );
}
fmt.i_extra =
__MIN( p_vids->p_bih->biSize - sizeof( BITMAPINFOHEADER ),
p_vids->i_chunk_size - sizeof(BITMAPINFOHEADER) );
fmt.p_extra = &p_vids->p_bih[1];
msg_Dbg( p_input, "stream[%d] video(%4.4s) %dx%d %dbpp %ffps",
i,
(char*)&p_vids->p_bih->biCompression,
......
......@@ -2,7 +2,7 @@
* libmp4.c : LibMP4 library for mp4 module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: libmp4.c,v 1.34 2003/10/07 14:59:10 gbazin Exp $
* $Id: libmp4.c,v 1.35 2003/11/26 08:18:09 gbazin Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -1204,6 +1204,14 @@ static int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
MP4_READBOX_ENTER( MP4_Box_data_sample_soun_t );
/* Sanity check needed because the "wave" box does also contain an
* "mp4a" box that we don't understand. */
if( i_read < 28 )
{
i_read -= 30;
MP4_READBOX_EXIT( 0 );
}
for( i = 0; i < 6 ; i++ )
{
MP4_GET1BYTE( p_box->data.p_sample_soun->i_reserved1[i] );
......@@ -1214,19 +1222,9 @@ static int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
/*
* XXX hack -> produce a copy of the nearly complete chunk
*/
if( i_read > 0 )
{
p_box->data.p_sample_soun->i_qt_description = i_read;
p_box->data.p_sample_soun->p_qt_description = malloc( i_read );
memcpy( p_box->data.p_sample_soun->p_qt_description,
p_peek,
i_read );
}
else
{
p_box->data.p_sample_soun->i_qt_description = 0;
p_box->data.p_sample_soun->p_qt_description = NULL;
}
p_box->data.p_sample_soun->i_qt_description = i_read;
p_box->data.p_sample_soun->p_qt_description = malloc( i_read );
memcpy( p_box->data.p_sample_soun->p_qt_description, p_peek, i_read );
MP4_GET2BYTES( p_box->data.p_sample_soun->i_qt_version );
MP4_GET2BYTES( p_box->data.p_sample_soun->i_qt_revision_level );
......
......@@ -2,7 +2,7 @@
* ogg.c : ogg stream input module for vlc
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: ogg.c,v 1.46 2003/11/23 13:15:27 gbazin Exp $
* $Id: ogg.c,v 1.47 2003/11/26 08:18:09 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -78,7 +78,6 @@ struct demux_sys_t
* the sub-streams */
mtime_t i_pcr;
int b_reinit;
int i_prev_sync_state;
/* stream state */
int i_eos;
......@@ -1028,8 +1027,6 @@ static int Activate( vlc_object_t * p_this )
/* Begnning of stream, tell the demux to look for elementary streams. */
p_ogg->i_eos = 0;
p_ogg->i_prev_sync_state = SYNCHRO_REINIT;
return 0;
error:
......@@ -1170,14 +1167,11 @@ static int Demux( input_thread_t * p_input )
p_stream->b_reinit = 1;
p_stream->i_pcr = -1;
p_stream->i_interpolated_pcr = -1;
ogg_stream_reset( &p_stream->os );
}
if( p_ogg->i_prev_sync_state != SYNCHRO_REINIT )
ogg_sync_reset( &p_ogg->oy );
ogg_sync_reset( &p_ogg->oy );
}
p_ogg->i_prev_sync_state =
p_input->stream.p_selected_program->i_synchro_state;
/*
* Demux an ogg page from the stream
*/
......@@ -1225,7 +1219,8 @@ static int Demux( input_thread_t * p_input )
else
{
input_ClockManageRef( p_input,
p_input->stream.p_selected_program, p_ogg->i_pcr );
p_input->stream.p_selected_program,
p_stream->i_pcr );
}
continue;
}
......@@ -1248,7 +1243,7 @@ static int Demux( input_thread_t * p_input )
p_ogg->i_pcr = p_stream->i_interpolated_pcr;
}
if( p_input->stream.p_selected_program->i_synchro_state != SYNCHRO_REINIT )
if( p_ogg->i_pcr >= 0 )
{
input_ClockManageRef( p_input, p_input->stream.p_selected_program,
p_ogg->i_pcr );
......
......@@ -2,7 +2,7 @@
* mpeg4video.c: mpeg 4 video packetizer
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: mpeg4video.c,v 1.16 2003/11/18 20:15:38 fenrir Exp $
* $Id: mpeg4video.c,v 1.17 2003/11/26 08:18:09 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
......@@ -128,8 +128,8 @@ static int Open( vlc_object_t *p_this )
p_sys->i_pts = 0;
p_sys->b_vop = VLC_FALSE;
p_sys->i_buffer = 0;
p_sys->i_buffer_size = 10000;
p_sys->p_buffer = malloc( p_sys->i_buffer_size );
p_sys->i_buffer_size = 0;
p_sys->p_buffer = 0;
/* Setup properties */
p_dec->fmt_out = p_dec->fmt_in;
......@@ -167,6 +167,7 @@ static void Close( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
if( p_dec->p_sys->p_buffer ) free( p_dec->p_sys->p_buffer );
free( p_dec->p_sys );
}
......
......@@ -2,7 +2,7 @@
* input_dec.c: Functions for the management of decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_dec.c,v 1.79 2003/11/24 23:22:01 gbazin Exp $
* $Id: input_dec.c,v 1.80 2003/11/26 08:18:09 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -610,7 +610,13 @@ static void DeleteDecoder( decoder_t * p_dec )
}
if( p_dec->p_owner->p_sout )
{
sout_InputDelete( p_dec->p_owner->p_sout );
if( p_dec->p_owner->sout.i_extra ) free(p_dec->p_owner->sout.p_extra);
}
if( p_dec->fmt_in.i_extra ) free( p_dec->fmt_in.p_extra );
if( p_dec->fmt_out.i_extra ) free( p_dec->fmt_out.p_extra );
free( p_dec->p_owner );
}
......
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.240 2003/11/24 00:39:02 fenrir Exp $
* $Id: video_output.c,v 1.241 2003/11/26 08:18:09 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -438,6 +438,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
if( var_Get( p_vout, "deinterlace-mode", &val ) == VLC_SUCCESS )
{
var_Set( p_vout, "deinterlace", val );
if( val.psz_string ) free( val.psz_string );
}
var_AddCallback( p_vout, "deinterlace", DeinterlaceCallback, NULL );
......@@ -446,9 +447,10 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
text.psz_string = _("Filters");
var_Change( p_vout, "filter", VLC_VAR_SETTEXT, &text, NULL );
var_Change( p_vout, "filter", VLC_VAR_INHERITVALUE, &val, NULL );
if( var_Get( p_vout, "filter", &val ) == VLC_SUCCESS )
if( val.psz_string )
{
var_Set( p_vout, "filter", val );
free( val.psz_string );
}
var_AddCallback( p_vout, "filter", FilterCallback, NULL );
......@@ -498,6 +500,8 @@ void vout_Destroy( vout_thread_t *p_vout )
p_playlist = vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_vout->psz_filter_chain ) free( p_vout->psz_filter_chain );
/* Free structure */
vlc_object_destroy( p_vout );
......
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