to BitstreamNextDataPacket() in GetChunk().
Code using GetChunk() also needs to check fifo->b_die before using the
obtained data.
This fixes frequent crashes you get on win32 with the a52 plugin when you
close a stream.
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: input_ext-dec.h,v 1.58 2002/05/18 17:47:46 sam Exp $
+ * $Id: input_ext-dec.h,v 1.59 2002/05/24 12:42:14 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
p_buffer += i_available;
i_buf_len -= i_available;
BitstreamNextDataPacket( p_bit_stream );
+ if( p_bit_stream->p_decoder_fifo->b_die )
+ return;
}
while( (i_available = p_bit_stream->p_end - p_bit_stream->p_byte)
- <= i_buf_len && !p_bit_stream->p_decoder_fifo->b_die );
+ <= i_buf_len );
if( i_buf_len )
{
* (http://liba52.sf.net/).
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: a52.c,v 1.11 2002/05/20 15:03:32 gbazin Exp $
+ * $Id: a52.c,v 1.12 2002/05/24 12:42:14 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
/* get a52 frame header */
GetChunk( &p_a52_adec->bit_stream, p_a52_adec->p_frame_buffer, 7 );
+ if( p_a52_adec->p_fifo->b_die ) break;
/* check if frame is valid and get frame info */
p_a52_adec->frame_size = a52_syncinfo( p_a52_adec->p_frame_buffer,
continue;
}
- if( DecodeFrame( p_a52_adec ) )
+ if( DecodeFrame( p_a52_adec ) && !p_a52_adec->p_fifo->b_die )
{
DecoderError( p_config->p_decoder_fifo );
free( p_a52_adec );
}
/* Creating the audio output fifo if not created yet */
- if (p_a52_adec->p_aout_fifo == NULL )
+ if( p_a52_adec->p_aout_fifo == NULL )
{
- p_a52_adec->p_aout_fifo = aout_CreateFifo( AOUT_FIFO_PCM,
+ p_a52_adec->p_aout_fifo = aout_CreateFifo( AOUT_FIFO_PCM,
p_a52_adec->i_channels,
p_a52_adec->sample_rate,
AC3DEC_FRAME_SIZE * p_a52_adec->i_channels,
/* Get the complete frame */
GetChunk( &p_a52_adec->bit_stream, p_a52_adec->p_frame_buffer + 7,
p_a52_adec->frame_size - 7 );
+ if( p_a52_adec->p_fifo->b_die ) return( -1 );
/* do the actual decoding now */
a52_frame( p_a52_adec->p_a52_state, p_a52_adec->p_frame_buffer,
* ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: ac3_spdif.c,v 1.24 2002/05/17 18:01:25 stef Exp $
+ * $Id: ac3_spdif.c,v 1.25 2002/05/24 12:42:14 gbazin Exp $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
* Juha Yrjola <jyrjola@cc.hut.fi>
/* Read sync frame */
GetChunk( &p_spdif->bit_stream, p_spdif->p_ac3 + 2,
sizeof(sync_frame_t) - 2 );
+ if( p_spdif->p_fifo->b_die ) return -1;
+
p_sync_frame = (sync_frame_t*)p_spdif->p_ac3;
/* Compute frame rate */
* lpcm_decoder_thread.c: lpcm decoder thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: lpcm_adec.c,v 1.14 2002/04/19 13:56:11 sam Exp $
+ * $Id: lpcm_adec.c,v 1.15 2002/05/24 12:42:14 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Henri Fallon <henri@videolan.org>
}
GetChunk( &p_lpcmdec->bit_stream, p_temp, LPCMDEC_FRAME_SIZE);
-
+ if( p_lpcmdec->p_fifo->b_die ) return;
+
for( i_loop = 0; i_loop < LPCMDEC_FRAME_SIZE/2; i_loop++ )
{
buffer[2*i_loop]=p_temp[2*i_loop+1];
* spu_decoder.c : spu decoder thread
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: spu_decoder.c,v 1.23 2002/05/19 15:50:02 stef Exp $
+ * $Id: spu_decoder.c,v 1.24 2002/05/24 12:42:14 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Rudolf Cornelissen <rag.cornelissen@inter.nl.net>
}
/* Get RLE data */
- for( i_offset = 0;
- i_offset + SPU_CHUNK_SIZE < p_spudec->i_rle_size;
+ for( i_offset = 0; i_offset < p_spudec->i_rle_size;
i_offset += SPU_CHUNK_SIZE )
{
- GetChunk( &p_spudec->bit_stream, p_src + i_offset, SPU_CHUNK_SIZE );
+ GetChunk( &p_spudec->bit_stream, p_src + i_offset,
+ ( i_offset + SPU_CHUNK_SIZE < p_spudec->i_rle_size ) ?
+ SPU_CHUNK_SIZE : p_spudec->i_rle_size - i_offset );
/* Abort subtitle parsing if we were requested to stop */
if( p_spudec->p_fifo->b_die )
}
}
- GetChunk( &p_spudec->bit_stream, p_src + i_offset,
- p_spudec->i_rle_size - i_offset );
-
#if 0
/* Dump the subtitle info */
intf_WarnHexDump( 5, p_spu->p_sys->p_data, p_spudec->i_rle_size );
break;
}
}
-