* src/input/input.c: don't free the ES twice.

* modules/demux/ogg.c: ported to the es_out_*() api and fixed flac support.
* modules/codec/flac.c: couple of fixes.
This commit is contained in:
Gildas Bazin 2003-11-22 12:41:32 +00:00
parent 0b18806cd1
commit 6ae3f4f4d4
3 changed files with 256 additions and 659 deletions

View File

@ -2,7 +2,7 @@
* flac.c: flac decoder/packetizer/encoder module making use of libflac
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: flac.c,v 1.3 2003/11/21 20:49:13 gbazin Exp $
* $Id: flac.c,v 1.4 2003/11/22 12:41:32 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Sigmund Augdal <sigmunau@idi.ntnu.no>
@ -186,6 +186,7 @@ static int OpenDecoder( vlc_object_t *p_this )
aout_DateSet( &p_sys->end_date, 0 );
p_sys->b_packetizer = VLC_FALSE;
p_sys->i_state = STATE_NOSYNC;
p_sys->b_stream_info = VLC_FALSE;
p_sys->bytestream = block_BytestreamInit( p_dec );
@ -217,7 +218,6 @@ static int OpenDecoder( vlc_object_t *p_this )
p_dec->pf_decode_audio = DecodeBlock;
p_dec->pf_packetize = PacketizeBlock;
/* Decode STREAMINFO */
msg_Dbg( p_dec, "decode STREAMINFO" );
p_sys->p_block = block_New( p_dec, p_dec->fmt_in.i_extra );
@ -235,11 +235,11 @@ static int OpenPacketizer( vlc_object_t *p_this )
int i_ret = OpenDecoder( p_this );
if( i_ret == VLC_SUCCESS )
{
p_dec->p_sys->b_packetizer = VLC_TRUE;
es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
}
if( i_ret != VLC_SUCCESS ) return i_ret;
p_dec->p_sys->b_packetizer = VLC_TRUE;
es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
return i_ret;
}
@ -321,6 +321,12 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys->i_state = STATE_NOSYNC;
break;
}
if( p_sys->i_rate != p_dec->fmt_out.audio.i_rate )
{
p_dec->fmt_out.audio.i_rate = p_sys->i_rate;
aout_DateInit( &p_sys->end_date, p_sys->i_rate );
p_dec->fmt_out.audio.i_rate = p_sys->i_rate;
}
p_sys->i_state = STATE_NEXT_SYNC;
p_sys->i_frame_size = 1;
@ -378,7 +384,8 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys->i_state = STATE_NOSYNC;
/* Date management */
p_sout_block->i_pts = aout_DateGet( &p_sys->end_date );
p_sout_block->i_pts =
p_sout_block->i_dts = aout_DateGet( &p_sys->end_date );
p_sout_block->i_length =
aout_DateIncrement( &p_sys->end_date, p_sys->i_frame_length );

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: input.c,v 1.258 2003/11/21 00:38:01 gbazin Exp $
* $Id: input.c,v 1.259 2003/11/22 12:41:31 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
@ -805,9 +805,6 @@ static void EndThread( input_thread_t * p_input )
input_DumpStream( p_input );
/* Free all ES and destroy all decoder threads */
input_EndStream( p_input );
/* Close optional stream output instance */
if ( p_input->stream.p_sout != NULL )
{
@ -849,6 +846,9 @@ static void EndThread( input_thread_t * p_input )
/* Free demultiplexer's data */
module_Unneed( p_input, p_input->p_demux );
/* Free all ES and destroy all decoder threads */
input_EndStream( p_input );
/* Destroy the stream_t facilities */
stream_Release( p_input->s );