Commit cc50abf7 authored by Christophe Massiot's avatar Christophe Massiot

* Removed b_die and b_error from all decoders (obsoleted by decoder_fifo_t).

All decoders should now exit cleanly (if it's not the case, it should be
referenced as a bug).
parent 3bf927ec
...@@ -65,6 +65,7 @@ typedef struct decoder_fifo_s ...@@ -65,6 +65,7 @@ typedef struct decoder_fifo_s
/* Communication interface between input and decoders */ /* Communication interface between input and decoders */
boolean_t b_die; /* the decoder should return now */ boolean_t b_die; /* the decoder should return now */
boolean_t b_error; /* the decoder is in an error loop */
void * p_packets_mgt; /* packets management services void * p_packets_mgt; /* packets management services
* data (netlist...) */ * data (netlist...) */
void (* pf_delete_pes)( void *, pes_packet_t * ); void (* pf_delete_pes)( void *, pes_packet_t * );
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* video_parser.h : video parser thread * video_parser.h : video parser thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: video_parser.h,v 1.32 2000/12/21 13:25:50 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -83,10 +84,6 @@ typedef struct video_buffer_s ...@@ -83,10 +84,6 @@ typedef struct video_buffer_s
typedef struct vpar_thread_s typedef struct vpar_thread_s
{ {
/* Thread properties and locks */ /* Thread properties and locks */
boolean_t b_die; /* `die' flag */
boolean_t b_run; /* `run' flag */
boolean_t b_error; /* `error' flag */
boolean_t b_active; /* `active' flag */
vlc_thread_t thread_id; /* id for thread functions */ vlc_thread_t thread_id; /* id for thread functions */
/* Thread configuration */ /* Thread configuration */
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* ac3_decoder_thread.c: ac3 decoder thread * ac3_decoder_thread.c: ac3 decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_decoder_thread.c,v 1.19 2000/12/21 13:25:50 massiot Exp $
* *
* Authors: * Authors:
* *
...@@ -88,8 +89,6 @@ vlc_thread_t ac3dec_CreateThread( adec_config_t * p_config ) ...@@ -88,8 +89,6 @@ vlc_thread_t ac3dec_CreateThread( adec_config_t * p_config )
/* /*
* Initialize the thread properties * Initialize the thread properties
*/ */
p_ac3dec->b_die = 0;
p_ac3dec->b_error = 0;
p_ac3dec->p_config = p_config; p_ac3dec->p_config = p_config;
p_ac3dec->p_fifo = p_config->decoder_config.p_decoder_fifo; p_ac3dec->p_fifo = p_config->decoder_config.p_decoder_fifo;
...@@ -175,7 +174,7 @@ static void RunThread (ac3dec_thread_t * p_ac3dec) ...@@ -175,7 +174,7 @@ static void RunThread (ac3dec_thread_t * p_ac3dec)
/* Initializing the ac3 decoder thread */ /* Initializing the ac3 decoder thread */
if (InitThread (p_ac3dec)) /* XXX?? */ if (InitThread (p_ac3dec)) /* XXX?? */
{ {
p_ac3dec->b_error = 1; p_ac3dec->p_fifo->b_error = 1;
} }
sync = 0; sync = 0;
...@@ -183,7 +182,7 @@ static void RunThread (ac3dec_thread_t * p_ac3dec) ...@@ -183,7 +182,7 @@ static void RunThread (ac3dec_thread_t * p_ac3dec)
/* ac3 decoder thread's main loop */ /* ac3 decoder thread's main loop */
/* FIXME : do we have enough room to store the decoded frames ?? */ /* FIXME : do we have enough room to store the decoded frames ?? */
while ((!p_ac3dec->b_die) && (!p_ac3dec->b_error)) while ((!p_ac3dec->p_fifo->b_die) && (!p_ac3dec->p_fifo->b_error))
{ {
s16 * buffer; s16 * buffer;
ac3_sync_info_t sync_info; ac3_sync_info_t sync_info;
...@@ -201,17 +200,17 @@ static void RunThread (ac3dec_thread_t * p_ac3dec) ...@@ -201,17 +200,17 @@ static void RunThread (ac3dec_thread_t * p_ac3dec)
{ {
ac3_byte_stream_next (p_byte_stream); ac3_byte_stream_next (p_byte_stream);
} while ((!p_ac3dec->sync_ptr) && } while ((!p_ac3dec->sync_ptr) &&
(!p_ac3dec->b_die) && (!p_ac3dec->p_fifo->b_die) &&
(!p_ac3dec->b_error)); (!p_ac3dec->p_fifo->b_error));
/* skip the specified number of bytes */ /* skip the specified number of bytes */
if( p_ac3dec->b_die || p_ac3dec->b_error ) if( p_ac3dec->p_fifo->b_die || p_ac3dec->p_fifo->b_error )
{ {
goto bad_frame; goto bad_frame;
} }
ptr = p_ac3dec->sync_ptr; ptr = p_ac3dec->sync_ptr;
while (--ptr && (!p_ac3dec->b_die) && (!p_ac3dec->b_error)) while (--ptr && (!p_ac3dec->p_fifo->b_die) && (!p_ac3dec->p_fifo->b_error))
{ {
if (p_byte_stream->p_byte >= p_byte_stream->p_end) if (p_byte_stream->p_byte >= p_byte_stream->p_end)
{ {
...@@ -220,7 +219,7 @@ static void RunThread (ac3dec_thread_t * p_ac3dec) ...@@ -220,7 +219,7 @@ static void RunThread (ac3dec_thread_t * p_ac3dec)
p_byte_stream->p_byte++; p_byte_stream->p_byte++;
} }
if( p_ac3dec->b_die || p_ac3dec->b_error ) if( p_ac3dec->p_fifo->b_die || p_ac3dec->p_fifo->b_error )
{ {
goto bad_frame; goto bad_frame;
} }
...@@ -265,7 +264,7 @@ static void RunThread (ac3dec_thread_t * p_ac3dec) ...@@ -265,7 +264,7 @@ static void RunThread (ac3dec_thread_t * p_ac3dec)
} }
/* If b_error is set, the ac3 decoder thread enters the error loop */ /* If b_error is set, the ac3 decoder thread enters the error loop */
if (p_ac3dec->b_error) if (p_ac3dec->p_fifo->b_error)
{ {
ErrorThread (p_ac3dec); ErrorThread (p_ac3dec);
} }
...@@ -284,7 +283,7 @@ static void ErrorThread (ac3dec_thread_t * p_ac3dec) ...@@ -284,7 +283,7 @@ static void ErrorThread (ac3dec_thread_t * p_ac3dec)
vlc_mutex_lock (&p_ac3dec->p_fifo->data_lock); vlc_mutex_lock (&p_ac3dec->p_fifo->data_lock);
/* Wait until a `die' order is sent */ /* Wait until a `die' order is sent */
while (!p_ac3dec->b_die) while (!p_ac3dec->p_fifo->b_die)
{ {
/* Trash all received PES packets */ /* Trash all received PES packets */
while (!DECODER_FIFO_ISEMPTY(*p_ac3dec->p_fifo)) while (!DECODER_FIFO_ISEMPTY(*p_ac3dec->p_fifo))
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* ac3_decoder_thread.h : ac3 decoder thread interface * ac3_decoder_thread.h : ac3 decoder thread interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_decoder_thread.h,v 1.2 2000/12/21 13:25:50 massiot Exp $
* *
* Authors: * Authors:
* Michel Kaempf <maxx@via.ecp.fr> * Michel Kaempf <maxx@via.ecp.fr>
...@@ -30,8 +31,6 @@ typedef struct ac3dec_thread_s ...@@ -30,8 +31,6 @@ typedef struct ac3dec_thread_s
* Thread properties * Thread properties
*/ */
vlc_thread_t thread_id; /* id for thread functions */ vlc_thread_t thread_id; /* id for thread functions */
boolean_t b_die; /* `die' flag */
boolean_t b_error; /* `error' flag */
/* /*
* Input properties * Input properties
......
...@@ -2,8 +2,11 @@ ...@@ -2,8 +2,11 @@
* audio_decoder.c: MPEG audio decoder thread * audio_decoder.c: MPEG audio decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: audio_decoder.c,v 1.40 2000/12/21 13:25:50 massiot Exp $
* *
* Authors: * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
* Samuel Hocevar <sam@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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -91,8 +94,6 @@ vlc_thread_t adec_CreateThread ( adec_config_t * p_config ) ...@@ -91,8 +94,6 @@ vlc_thread_t adec_CreateThread ( adec_config_t * p_config )
/* /*
* Initialize the thread properties * Initialize the thread properties
*/ */
p_adec->b_die = 0;
p_adec->b_error = 0;
p_adec->p_config = p_config; p_adec->p_config = p_config;
p_adec->p_fifo = p_config->decoder_config.p_decoder_fifo; p_adec->p_fifo = p_config->decoder_config.p_decoder_fifo;
...@@ -138,7 +139,7 @@ static int InitThread (adec_thread_t * p_adec) ...@@ -138,7 +139,7 @@ static int InitThread (adec_thread_t * p_adec)
vlc_mutex_lock ( &p_adec->p_fifo->data_lock ); vlc_mutex_lock ( &p_adec->p_fifo->data_lock );
while ( DECODER_FIFO_ISEMPTY(*p_adec->p_fifo) ) while ( DECODER_FIFO_ISEMPTY(*p_adec->p_fifo) )
{ {
if (p_adec->b_die) if (p_adec->p_fifo->b_die)
{ {
vlc_mutex_unlock ( &p_adec->p_fifo->data_lock ); vlc_mutex_unlock ( &p_adec->p_fifo->data_lock );
return -1; return -1;
...@@ -185,13 +186,13 @@ static void RunThread (adec_thread_t * p_adec) ...@@ -185,13 +186,13 @@ static void RunThread (adec_thread_t * p_adec)
/* Initializing the audio decoder thread */ /* Initializing the audio decoder thread */
if( InitThread (p_adec) ) if( InitThread (p_adec) )
{ {
p_adec->b_error = 1; p_adec->p_fifo->b_error = 1;
} }
sync = 0; sync = 0;
/* Audio decoder thread's main loop */ /* Audio decoder thread's main loop */
while( (!p_adec->b_die) && (!p_adec->b_error) ) while( (!p_adec->p_fifo->b_die) && (!p_adec->p_fifo->b_error) )
{ {
s16 * buffer; s16 * buffer;
adec_sync_info_t sync_info; adec_sync_info_t sync_info;
...@@ -209,7 +210,7 @@ static void RunThread (adec_thread_t * p_adec) ...@@ -209,7 +210,7 @@ static void RunThread (adec_thread_t * p_adec)
/* FIXME: is this really needed ? /* FIXME: is this really needed ?
adec_byte_stream_next ( p_byte_stream ); */ adec_byte_stream_next ( p_byte_stream ); */
if( p_adec->b_die || p_adec->b_error ) if( p_adec->p_fifo->b_die || p_adec->p_fifo->b_error )
{ {
goto bad_frame; goto bad_frame;
} }
...@@ -257,7 +258,7 @@ static void RunThread (adec_thread_t * p_adec) ...@@ -257,7 +258,7 @@ static void RunThread (adec_thread_t * p_adec)
} }
/* If b_error is set, the audio decoder thread enters the error loop */ /* If b_error is set, the audio decoder thread enters the error loop */
if( p_adec->b_error ) if( p_adec->p_fifo->b_error )
{ {
ErrorThread( p_adec ); ErrorThread( p_adec );
} }
...@@ -280,7 +281,7 @@ static void ErrorThread ( adec_thread_t *p_adec ) ...@@ -280,7 +281,7 @@ static void ErrorThread ( adec_thread_t *p_adec )
vlc_mutex_lock ( &p_adec->p_fifo->data_lock ); vlc_mutex_lock ( &p_adec->p_fifo->data_lock );
/* Wait until a `die' order is sent */ /* Wait until a `die' order is sent */
while ( !p_adec->b_die ) while ( !p_adec->p_fifo->b_die )
{ {
/* Trash all received PES packets */ /* Trash all received PES packets */
while ( !DECODER_FIFO_ISEMPTY(*p_adec->p_fifo) ) while ( !DECODER_FIFO_ISEMPTY(*p_adec->p_fifo) )
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* audio_decoder.h : audio decoder thread interface * audio_decoder.h : audio decoder thread interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: audio_decoder.h,v 1.3 2000/12/21 13:25:50 massiot Exp $
* *
* Authors: * Authors:
* Michel Kaempf <maxx@via.ecp.fr> * Michel Kaempf <maxx@via.ecp.fr>
...@@ -30,8 +31,6 @@ typedef struct adec_thread_s ...@@ -30,8 +31,6 @@ typedef struct adec_thread_s
* Thread properties * Thread properties
*/ */
vlc_thread_t thread_id; /* id for thread functions */ vlc_thread_t thread_id; /* id for thread functions */
boolean_t b_die; /* `die' flag */
boolean_t b_error; /* `error' flag */
/* /*
* Input properties * Input properties
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: input_programs.c,v 1.9 2000/12/21 12:38:27 massiot Exp $ * $Id: input_programs.c,v 1.10 2000/12/21 13:25:51 massiot Exp $
* *
* Authors: * Authors:
* *
...@@ -347,7 +347,7 @@ static int InitDecConfig( input_thread_t * p_input, es_descriptor_t * p_es, ...@@ -347,7 +347,7 @@ static int InitDecConfig( input_thread_t * p_input, es_descriptor_t * p_es,
vlc_mutex_init(&p_config->p_decoder_fifo->data_lock); vlc_mutex_init(&p_config->p_decoder_fifo->data_lock);
vlc_cond_init(&p_config->p_decoder_fifo->data_wait); vlc_cond_init(&p_config->p_decoder_fifo->data_wait);
p_config->p_decoder_fifo->i_start = p_config->p_decoder_fifo->i_end = 0; p_config->p_decoder_fifo->i_start = p_config->p_decoder_fifo->i_end = 0;
p_config->p_decoder_fifo->b_die = 0; p_config->p_decoder_fifo->b_die = p_config->p_decoder_fifo->b_error = 0;
p_config->p_decoder_fifo->p_packets_mgt = p_input->p_method_data; p_config->p_decoder_fifo->p_packets_mgt = p_input->p_method_data;
p_config->p_decoder_fifo->pf_delete_pes = p_config->p_decoder_fifo->pf_delete_pes =
p_input->p_plugin->pf_delete_pes; p_input->p_plugin->pf_delete_pes;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* lpcm_decoder_thread.c: lpcm decoder thread * lpcm_decoder_thread.c: lpcm decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: lpcm_decoder_thread.c,v 1.5 2000/12/21 13:25:51 massiot Exp $
* *
* Authors: * Authors:
* *
...@@ -76,8 +77,6 @@ vlc_thread_t lpcmdec_CreateThread (adec_config_t * p_config) ...@@ -76,8 +77,6 @@ vlc_thread_t lpcmdec_CreateThread (adec_config_t * p_config)
/* /*
* Initialize the thread properties * Initialize the thread properties
*/ */
p_lpcmdec->b_die = 0;
p_lpcmdec->b_error = 0;
p_lpcmdec->p_config = p_config; p_lpcmdec->p_config = p_config;
p_lpcmdec->p_fifo = p_config->decoder_config.p_decoder_fifo; p_lpcmdec->p_fifo = p_config->decoder_config.p_decoder_fifo;
...@@ -118,7 +117,7 @@ static int InitThread (lpcmdec_thread_t * p_lpcmdec) ...@@ -118,7 +117,7 @@ static int InitThread (lpcmdec_thread_t * p_lpcmdec)
* beginning of the input stream */ * beginning of the input stream */
vlc_mutex_lock (&p_lpcmdec->p_fifo->data_lock); vlc_mutex_lock (&p_lpcmdec->p_fifo->data_lock);
while (DECODER_FIFO_ISEMPTY(*p_lpcmdec->p_fifo)) { while (DECODER_FIFO_ISEMPTY(*p_lpcmdec->p_fifo)) {
if (p_lpcmdec->b_die) { if (p_lpcmdec->p_fifo->b_die) {
vlc_mutex_unlock (&p_lpcmdec->p_fifo->data_lock); vlc_mutex_unlock (&p_lpcmdec->p_fifo->data_lock);
return -1; return -1;
} }
...@@ -161,7 +160,7 @@ static void RunThread (lpcmdec_thread_t * p_lpcmdec) ...@@ -161,7 +160,7 @@ static void RunThread (lpcmdec_thread_t * p_lpcmdec)
/* Initializing the lpcm decoder thread */ /* Initializing the lpcm decoder thread */
if (InitThread (p_lpcmdec)) if (InitThread (p_lpcmdec))
{ {
p_lpcmdec->b_error = 1; p_lpcmdec->p_fifo->b_error = 1;
} }
sync = 0; sync = 0;
...@@ -170,7 +169,7 @@ static void RunThread (lpcmdec_thread_t * p_lpcmdec) ...@@ -170,7 +169,7 @@ static void RunThread (lpcmdec_thread_t * p_lpcmdec)
/* lpcm decoder thread's main loop */ /* lpcm decoder thread's main loop */
/* FIXME : do we have enough room to store the decoded frames ?? */ /* FIXME : do we have enough room to store the decoded frames ?? */
while ((!p_lpcmdec->b_die) && (!p_lpcmdec->b_error)) while ((!p_lpcmdec->p_fifo->b_die) && (!p_lpcmdec->p_fifo->b_error))
{ {
s16 * buffer; s16 * buffer;
lpcm_sync_info_t sync_info; lpcm_sync_info_t sync_info;
...@@ -210,7 +209,7 @@ static void RunThread (lpcmdec_thread_t * p_lpcmdec) ...@@ -210,7 +209,7 @@ static void RunThread (lpcmdec_thread_t * p_lpcmdec)
} }
/* If b_error is set, the lpcm decoder thread enters the error loop */ /* If b_error is set, the lpcm decoder thread enters the error loop */
if (p_lpcmdec->b_error) if (p_lpcmdec->p_fifo->b_error)
{ {
ErrorThread (p_lpcmdec); ErrorThread (p_lpcmdec);
} }
...@@ -229,7 +228,7 @@ static void ErrorThread (lpcmdec_thread_t * p_lpcmdec) ...@@ -229,7 +228,7 @@ static void ErrorThread (lpcmdec_thread_t * p_lpcmdec)
vlc_mutex_lock (&p_lpcmdec->p_fifo->data_lock); vlc_mutex_lock (&p_lpcmdec->p_fifo->data_lock);
/* Wait until a `die' order is sent */ /* Wait until a `die' order is sent */
while (!p_lpcmdec->b_die) { while (!p_lpcmdec->p_fifo->b_die) {
/* Trash all received PES packets */ /* Trash all received PES packets */
while (!DECODER_FIFO_ISEMPTY(*p_lpcmdec->p_fifo)) { while (!DECODER_FIFO_ISEMPTY(*p_lpcmdec->p_fifo)) {
p_lpcmdec->p_fifo->pf_delete_pes(p_lpcmdec->p_fifo->p_packets_mgt, p_lpcmdec->p_fifo->pf_delete_pes(p_lpcmdec->p_fifo->p_packets_mgt,
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* lpcm_decoder_thread.h : lpcm decoder thread interface * lpcm_decoder_thread.h : lpcm decoder thread interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: lpcm_decoder_thread.h,v 1.2 2000/12/21 13:25:51 massiot Exp $
* *
* Authors: * Authors:
* *
...@@ -30,8 +31,6 @@ typedef struct lpcmdec_thread_s ...@@ -30,8 +31,6 @@ typedef struct lpcmdec_thread_s
* Thread properties * Thread properties
*/ */
vlc_thread_t thread_id; /* id for thread functions */ vlc_thread_t thread_id; /* id for thread functions */
boolean_t b_die; /* `die' flag */
boolean_t b_error; /* `error' flag */
/* /*
* Input properties * Input properties
......
...@@ -82,8 +82,8 @@ vlc_thread_t spudec_CreateThread( vdec_config_t * p_config ) ...@@ -82,8 +82,8 @@ vlc_thread_t spudec_CreateThread( vdec_config_t * p_config )
/* /*
* Initialize the thread properties * Initialize the thread properties
*/ */
p_spudec->b_die = 0; p_spudec->p_fifo->b_die = 0;
p_spudec->b_error = 0; p_spudec->p_fifo->b_error = 0;
p_spudec->p_config = p_config; p_spudec->p_config = p_config;
p_spudec->p_fifo = p_config->decoder_config.p_decoder_fifo; p_spudec->p_fifo = p_config->decoder_config.p_decoder_fifo;
...@@ -138,15 +138,13 @@ static void RunThread( spudec_thread_t *p_spudec ) ...@@ -138,15 +138,13 @@ static void RunThread( spudec_thread_t *p_spudec )
/* /*
* Initialize thread and free configuration * Initialize thread and free configuration
*/ */
p_spudec->b_error = InitThread( p_spudec ); p_spudec->p_fifo->b_error = InitThread( p_spudec );
p_spudec->b_run = 1;
/* /*
* Main loop - it is not executed if an error occured during * Main loop - it is not executed if an error occured during
* initialization * initialization
*/ */
while( (!p_spudec->b_die) && (!p_spudec->b_error) ) while( (!p_spudec->p_fifo->b_die) && (!p_spudec->p_fifo->b_error) )
{ {
int i_packet_size; int i_packet_size;
int i_rle_size; int i_rle_size;
...@@ -168,7 +166,7 @@ static void RunThread( spudec_thread_t *p_spudec ) ...@@ -168,7 +166,7 @@ static void RunThread( spudec_thread_t *p_spudec )
} }
while( i_packet_size == 0xff ); while( i_packet_size == 0xff );
if( p_spudec->b_die ) if( p_spudec->p_fifo->b_die )
break; break;
/* the total size - should equal the sum of the /* the total size - should equal the sum of the
...@@ -316,13 +314,11 @@ static void RunThread( spudec_thread_t *p_spudec ) ...@@ -316,13 +314,11 @@ static void RunThread( spudec_thread_t *p_spudec )
/* /*
* Error loop * Error loop
*/ */
if( p_spudec->b_error ) if( p_spudec->p_fifo->b_error )
{ {
ErrorThread( p_spudec ); ErrorThread( p_spudec );
} }
p_spudec->b_run = 0;
/* End of thread */ /* End of thread */
EndThread( p_spudec ); EndThread( p_spudec );
} }
...@@ -341,7 +337,7 @@ static void ErrorThread( spudec_thread_t *p_spudec ) ...@@ -341,7 +337,7 @@ static void ErrorThread( spudec_thread_t *p_spudec )
vlc_mutex_lock( &p_spudec->p_fifo->data_lock ); vlc_mutex_lock( &p_spudec->p_fifo->data_lock );
/* Wait until a `die' order is sent */ /* Wait until a `die' order is sent */
while( !p_spudec->b_die ) while( !p_spudec->p_fifo->b_die )
{ {
/* Trash all received PES packets */ /* Trash all received PES packets */
while( !DECODER_FIFO_ISEMPTY(*p_spudec->p_fifo) ) while( !DECODER_FIFO_ISEMPTY(*p_spudec->p_fifo) )
......
...@@ -28,10 +28,6 @@ typedef struct spudec_thread_s ...@@ -28,10 +28,6 @@ typedef struct spudec_thread_s
/* /*
* Thread properties and locks * Thread properties and locks
*/ */
boolean_t b_die; /* `die' flag */
boolean_t b_run; /* `run' flag */
boolean_t b_active; /* `active' flag */
boolean_t b_error; /* `error' flag */
vlc_thread_t thread_id; /* id for thread functions */ vlc_thread_t thread_id; /* id for thread functions */
/* /*
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* video_parser.c : video parser thread * video_parser.c : video parser thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: video_parser.c,v 1.55 2000/12/21 13:25:51 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr>
...@@ -97,8 +98,6 @@ vlc_thread_t vpar_CreateThread( vdec_config_t * p_config ) ...@@ -97,8 +98,6 @@ vlc_thread_t vpar_CreateThread( vdec_config_t * p_config )
/* /*
* Initialize the thread properties * Initialize the thread properties
*/ */
p_vpar->b_die = 0;
p_vpar->b_error = 0;
p_vpar->p_fifo = p_config->decoder_config.p_decoder_fifo; p_vpar->p_fifo = p_config->decoder_config.p_decoder_fifo;
p_vpar->p_config = p_config; p_vpar->p_config = p_config;
...@@ -231,20 +230,18 @@ static void RunThread( vpar_thread_t *p_vpar ) ...@@ -231,20 +230,18 @@ static void RunThread( vpar_thread_t *p_vpar )
/* /*
* Initialize thread * Initialize thread
*/ */
p_vpar->b_error = InitThread( p_vpar ); p_vpar->p_fifo->b_error = InitThread( p_vpar );
p_vpar->b_run = 1;
/* /*
* Main loop - it is not executed if an error occured during * Main loop - it is not executed if an error occured during
* initialization * initialization
*/ */
while( (!p_vpar->p_fifo->b_die) && (!p_vpar->b_error) ) while( (!p_vpar->p_fifo->b_die) && (!p_vpar->p_fifo->b_error) )
{ {
/* Find the next sequence header in the stream */ /* Find the next sequence header in the stream */
p_vpar->b_error = vpar_NextSequenceHeader( p_vpar ); p_vpar->p_fifo->b_error = vpar_NextSequenceHeader( p_vpar );
while( (!p_vpar->p_fifo->b_die) && (!p_vpar->b_error) ) while( (!p_vpar->p_fifo->b_die) && (!p_vpar->p_fifo->b_error) )
{ {
#ifdef STATS #ifdef STATS
p_vpar->c_loops++; p_vpar->c_loops++;
...@@ -261,13 +258,11 @@ static void RunThread( vpar_thread_t *p_vpar ) ...@@ -261,13 +258,11 @@ static void RunThread( vpar_thread_t *p_vpar )
/* /*
* Error loop * Error loop
*/ */
if( p_vpar->b_error ) if( p_vpar->p_fifo->b_error )
{ {
ErrorThread( p_vpar ); ErrorThread( p_vpar );
} }
p_vpar->b_run = 0;
/* End of thread */ /* End of thread */
EndThread( p_vpar ); EndThread( p_vpar );
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* vpar_headers.c : headers parsing * vpar_headers.c : headers parsing
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_headers.c,v 1.60 2000/12/21 13:25:51 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -222,7 +223,7 @@ static __inline__ void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_ma ...@@ -222,7 +223,7 @@ static __inline__ void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_ma
if( (p_matrix->pi_matrix = (int *)malloc( 64*sizeof(int) )) == NULL ) if( (p_matrix->pi_matrix = (int *)malloc( 64*sizeof(int) )) == NULL )
{ {
intf_ErrMsg( "vpar error: allocation error in LoadMatrix()\n" ); intf_ErrMsg( "vpar error: allocation error in LoadMatrix()\n" );
p_vpar->b_error = 1; p_vpar->p_fifo->b_error = 1;
return; return;
} }
p_matrix->b_allocated = 1; p_matrix->b_allocated = 1;
...@@ -674,7 +675,7 @@ static void PictureHeader( vpar_thread_t * p_vpar ) ...@@ -674,7 +675,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
== NULL ) == NULL )
{ {
intf_DbgMsg("vpar debug: allocation error in vout_CreatePicture, delaying\n"); intf_DbgMsg("vpar debug: allocation error in vout_CreatePicture, delaying\n");
if( p_vpar->p_fifo->b_die || p_vpar->b_error ) if( p_vpar->p_fifo->b_die || p_vpar->p_fifo->b_error )
{ {
return; return;
} }
...@@ -737,7 +738,7 @@ static void PictureHeader( vpar_thread_t * p_vpar ) ...@@ -737,7 +738,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
vpar_PictureData( p_vpar, i_mb_base ); vpar_PictureData( p_vpar, i_mb_base );
if( p_vpar->p_fifo->b_die || p_vpar->b_error ) if( p_vpar->p_fifo->b_die || p_vpar->p_fifo->b_error )
{ {
return; return;
} }
......
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