From: Gildas Bazin Date: Thu, 31 Oct 2002 09:40:26 +0000 (+0000) Subject: * modules/codec/spudec/spudec.c, modules/codec/spudec/parse.c: fixed a couple X-Git-Tag: 0.5.0~788 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=cae5489acfe2338f5c341f6067f68ea987bfa06a;p=vlc * modules/codec/spudec/spudec.c, modules/codec/spudec/parse.c: fixed a couple of problems introduced with the recent changes to the bitstream facility. * src/audio_output/output.c: fixed a quite annoying bug in aout3 that was triggering unnecessary trashing of audio frames. --- diff --git a/modules/codec/spudec/parse.c b/modules/codec/spudec/parse.c index 0b6c2320ab..742058da61 100644 --- a/modules/codec/spudec/parse.c +++ b/modules/codec/spudec/parse.c @@ -2,7 +2,7 @@ * parse.c: SPU parser ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: parse.c,v 1.2 2002/10/17 08:24:12 sam Exp $ + * $Id: parse.c,v 1.3 2002/10/31 09:40:26 gbazin Exp $ * * Authors: Samuel Hocevar * @@ -103,12 +103,14 @@ void E_(ParsePacket)( spudec_thread_t *p_spudec ) subpicture_t * p_spu; u8 * p_src; unsigned int i_offset; + mtime_t i_pts; msg_Dbg( p_spudec->p_fifo, "trying to gather a 0x%.2x long subtitle", p_spudec->i_spu_size ); /* We cannot display a subpicture with no date */ - if( p_spudec->p_fifo->p_first->i_pts == 0 ) + NextPTS( &p_spudec->bit_stream, &i_pts, NULL ); + if( i_pts == 0 ) { msg_Warn( p_spudec->p_fifo, "subtitle without a date" ); return; @@ -139,7 +141,7 @@ void E_(ParsePacket)( spudec_thread_t *p_spudec ) p_spu->p_sys->pi_alpha[3] = 0x0f; /* Get display time now. If we do it later, we may miss the PTS. */ - p_spu->p_sys->i_pts = p_spudec->p_fifo->p_first->i_pts; + p_spu->p_sys->i_pts = i_pts; /* Allocate the temporary buffer we will parse */ p_src = malloc( p_spudec->i_rle_size ); diff --git a/modules/codec/spudec/spudec.c b/modules/codec/spudec/spudec.c index 264d222656..12617c24a2 100644 --- a/modules/codec/spudec/spudec.c +++ b/modules/codec/spudec/spudec.c @@ -2,7 +2,7 @@ * spudec.c : SPU decoder thread ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: spudec.c,v 1.5 2002/10/27 16:58:13 gbazin Exp $ + * $Id: spudec.c,v 1.6 2002/10/31 09:40:26 gbazin Exp $ * * Authors: Samuel Hocevar * @@ -151,6 +151,10 @@ static int InitThread( spudec_thread_t *p_spudec ) { if( p_spudec->p_fifo->b_die || p_spudec->p_fifo->b_error ) { + /* Call InitBitstream anyway so p_spudec is in a known state + * before calling CloseBitstream */ + InitBitstream( &p_spudec->bit_stream, p_spudec->p_fifo, + NULL, NULL ); return -1; } diff --git a/src/audio_output/output.c b/src/audio_output/output.c index 4bcba4c61b..75dc8c505e 100644 --- a/src/audio_output/output.c +++ b/src/audio_output/output.c @@ -2,7 +2,7 @@ * output.c : internal management of output streams for the audio output ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: output.c,v 1.19 2002/10/21 20:00:10 massiot Exp $ + * $Id: output.c,v 1.20 2002/10/31 09:40:26 gbazin Exp $ * * Authors: Christophe Massiot * @@ -181,10 +181,10 @@ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout, vlc_mutex_lock( &p_aout->output_fifo_lock ); p_buffer = p_aout->output.fifo.p_first; - while ( p_buffer && p_buffer->start_date < start_date ) + while ( p_buffer && p_buffer->start_date < mdate() ) { msg_Dbg( p_aout, "audio output is too slow (%lld), trashing %lldus", - start_date - p_buffer->start_date, + mdate() - p_buffer->start_date, p_buffer->end_date - p_buffer->start_date ); p_buffer = p_buffer->p_next; }