* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: common.h,v 1.53 2001/12/07 18:33:07 sam Exp $
+ * $Id: common.h,v 1.53.2.1 2001/12/30 06:06:00 sam Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
void ( * ) ( struct bit_stream_s *,
boolean_t ),
void * );
+ void ( * DecoderError ) ( struct decoder_fifo_s * p_fifo );
int ( * input_InitStream ) ( struct input_thread_s *, size_t );
void ( * input_EndStream ) ( struct input_thread_s * );
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ext-dec.h,v 1.41 2001/12/07 18:33:07 sam Exp $
+ * $Id: input_ext-dec.h,v 1.41.2.1 2001/12/30 06:06:00 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
#endif
/*****************************************************************************
- * Protoypes from input_ext-dec.c
+ * Prototypes from input_ext-dec.c
*****************************************************************************/
#ifndef PLUGIN
u32 UnalignedShowBits( struct bit_stream_s *, unsigned int );
void * );
} decoder_config_t;
+/*****************************************************************************
+ * Prototypes from input_dec.c
+ *****************************************************************************/
+#ifndef PLUGIN
+void DecoderError ( struct decoder_fifo_s * p_fifo );
+#else
+# define DecoderError p_symbols->DecoderError
+#endif
+
(p_symbols)->input_AddArea = input_AddArea; \
(p_symbols)->input_DelArea = input_DelArea; \
(p_symbols)->InitBitstream = InitBitstream; \
+ (p_symbols)->DecoderError = DecoderError; \
(p_symbols)->input_InitStream = input_InitStream; \
(p_symbols)->input_EndStream = input_EndStream; \
(p_symbols)->input_ParsePES = input_ParsePES; \
# define input_DelArea p_symbols->input_DelArea
# define InitBitstream p_symbols->InitBitstream
+# define DecoderError p_symbols->DecoderError
# define input_InitStream p_symbols->input_InitStream
# define input_EndStream p_symbols->input_EndStream
* ac3_adec.c: ac3 decoder module main file
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: ac3_adec.c,v 1.5 2001/12/03 16:18:37 sam Exp $
+ * $Id: ac3_adec.c,v 1.5.2.1 2001/12/30 06:06:00 sam Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
*
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int ac3_adec_Probe ( probedata_t * );
-static int ac3_adec_Run ( decoder_config_t * );
-static int ac3_adec_Init (ac3dec_thread_t * p_adec);
-static void ac3_adec_ErrorThread (ac3dec_thread_t * p_adec);
-static void ac3_adec_EndThread (ac3dec_thread_t * p_adec);
-static void BitstreamCallback ( bit_stream_t *p_bit_stream,
- boolean_t b_new_pes );
+static int decoder_Probe ( probedata_t * );
+static int decoder_Run ( decoder_config_t * );
+static int InitThread ( ac3dec_thread_t * p_adec );
+static void EndThread ( ac3dec_thread_t * p_adec );
+static void BitstreamCallback ( bit_stream_t *p_bit_stream,
+ boolean_t b_new_pes );
/*****************************************************************************
* Capabilities
*****************************************************************************/
void _M( adec_getfunctions )( function_list_t * p_function_list )
{
- p_function_list->pf_probe = ac3_adec_Probe;
- p_function_list->functions.dec.pf_run = ac3_adec_Run;
+ p_function_list->pf_probe = decoder_Probe;
+ p_function_list->functions.dec.pf_run = decoder_Run;
}
/*****************************************************************************
/*****************************************************************************
- * ac3_adec_Probe: probe the decoder and return score
+ * decoder_Probe: probe the decoder and return score
*****************************************************************************
* Tries to launch a decoder and return score so that the interface is able
* to chose.
*****************************************************************************/
-static int ac3_adec_Probe( probedata_t *p_data )
+static int decoder_Probe( probedata_t *p_data )
{
return ( p_data->i_type == AC3_AUDIO_ES ) ? 50 : 0;
}
/*****************************************************************************
- * ac3_adec_Run: this function is called just after the thread is created
+ * decoder_Run: this function is called just after the thread is created
*****************************************************************************/
-static int ac3_adec_Run ( decoder_config_t * p_config )
+static int decoder_Run ( decoder_config_t * p_config )
{
ac3dec_thread_t * p_ac3thread;
int sync;
if( p_ac3thread == NULL )
{
intf_ErrMsg ( "ac3_adec error: not enough memory "
- "for ac3_adec_Run() to allocate p_ac3thread" );
+ "for decoder_Run() to allocate p_ac3thread" );
+ DecoderError( p_config->p_decoder_fifo );
return( -1 );
}
* Initialize the thread properties
*/
p_ac3thread->p_config = p_config;
- if( ac3_adec_Init( p_ac3thread ) )
+ if( InitThread( p_ac3thread ) )
{
intf_ErrMsg( "ac3_adec error: could not initialize thread" );
+ DecoderError( p_config->p_decoder_fifo );
free( p_ac3thread );
return( -1 );
}
/* If b_error is set, the ac3 decoder thread enters the error loop */
if (p_ac3thread->p_fifo->b_error)
{
- ac3_adec_ErrorThread (p_ac3thread);
+ DecoderError( p_ac3thread->p_fifo );
}
/* End of the ac3 decoder thread */
- ac3_adec_EndThread (p_ac3thread);
+ EndThread (p_ac3thread);
free( p_ac3thread );
/*****************************************************************************
- * ac3_adec_Init: initialize data before entering main loop
+ * InitThread: initialize data before entering main loop
*****************************************************************************/
-static int ac3_adec_Init( ac3dec_thread_t * p_ac3thread )
+static int InitThread( ac3dec_thread_t * p_ac3thread )
{
/*
* Thread properties
return( 0 );
}
-
-/*****************************************************************************
- * ac3_adec_ErrorThread : ac3 decoder's RunThread() error loop
- *****************************************************************************/
-static void ac3_adec_ErrorThread (ac3dec_thread_t * p_ac3thread)
-{
- /* We take the lock, because we are going to read/write the start/end
- * indexes of the decoder fifo */
- vlc_mutex_lock (&p_ac3thread->p_fifo->data_lock);
-
- /* Wait until a `die' order is sent */
- while (!p_ac3thread->p_fifo->b_die)
- {
- /* Trash all received PES packets */
- while (!DECODER_FIFO_ISEMPTY(*p_ac3thread->p_fifo))
- {
- p_ac3thread->p_fifo->pf_delete_pes(
- p_ac3thread->p_fifo->p_packets_mgt,
- DECODER_FIFO_START(*p_ac3thread->p_fifo));
- DECODER_FIFO_INCSTART (*p_ac3thread->p_fifo);
- }
-
- /* Waiting for the input thread to put new PES packets in the fifo */
- vlc_cond_wait (&p_ac3thread->p_fifo->data_wait,
- &p_ac3thread->p_fifo->data_lock);
- }
-
- /* We can release the lock before leaving */
- vlc_mutex_unlock (&p_ac3thread->p_fifo->data_lock);
-}
-
/*****************************************************************************
- * ac3_adec_EndThread : ac3 decoder thread destruction
+ * EndThread : ac3 decoder thread destruction
*****************************************************************************/
-static void ac3_adec_EndThread (ac3dec_thread_t * p_ac3thread)
+static void EndThread (ac3dec_thread_t * p_ac3thread)
{
intf_DbgMsg ("ac3dec debug: destroying ac3 decoder thread %p", p_ac3thread);
* ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: ac3_spdif.c,v 1.5 2001/12/03 16:18:37 sam Exp $
+ * $Id: ac3_spdif.c,v 1.5.2.1 2001/12/30 06:06:00 sam Exp $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
* Juha Yrjola <jyrjola@cc.hut.fi>
/****************************************************************************
* Local Prototypes
****************************************************************************/
-static int ac3_spdif_Probe ( probedata_t * );
-static int ac3_spdif_Run ( decoder_config_t * );
-static int ac3_spdif_Init ( ac3_spdif_thread_t * );
-static void ac3_spdif_ErrorThread ( ac3_spdif_thread_t * );
-static void ac3_spdif_EndThread ( ac3_spdif_thread_t * );
-static void BitstreamCallback( bit_stream_t *, boolean_t );
+static int decoder_Probe ( probedata_t * );
+static int decoder_Run ( decoder_config_t * );
+static int InitThread ( ac3_spdif_thread_t * );
+static void EndThread ( ac3_spdif_thread_t * );
+static void BitstreamCallback ( bit_stream_t *, boolean_t );
/*****************************************************************************
* Capabilities
*****************************************************************************/
void _M( adec_getfunctions )( function_list_t * p_function_list )
{
- p_function_list->pf_probe = ac3_spdif_Probe;
- p_function_list->functions.dec.pf_run = ac3_spdif_Run;
+ p_function_list->pf_probe = decoder_Probe;
+ p_function_list->functions.dec.pf_run = decoder_Run;
}
/*****************************************************************************
MODULE_DEACTIVATE_STOP
/*****************************************************************************
- * ac3_spdif_Probe: probe the decoder and return score
+ * decoder_Probe: probe the decoder and return score
*****************************************************************************
* Tries to launch a decoder and return score so that the interface is able
* to chose.
*****************************************************************************/
-static int ac3_spdif_Probe( probedata_t *p_data )
+static int decoder_Probe( probedata_t *p_data )
{
if( main_GetIntVariable( AOUT_SPDIF_VAR, 0 ) &&
p_data->i_type == AC3_AUDIO_ES )
/****************************************************************************
- * ac3_spdif_Run: the whole thing
+ * decoder_Run: the whole thing
****************************************************************************
* This function is called just after the thread is launched.
****************************************************************************/
-static int ac3_spdif_Run( decoder_config_t * p_config )
+static int decoder_Run( decoder_config_t * p_config )
{
ac3_spdif_thread_t * p_spdif;
mtime_t i_frame_time;
{
intf_ErrMsg ( "spdif error: not enough memory "
"for spdif_CreateThread() to create the new thread");
+ DecoderError( p_config->p_decoder_fifo );
return( -1 );
}
p_spdif->p_config = p_config;
- if (ac3_spdif_Init( p_spdif ) )
+ if (InitThread( p_spdif ) )
{
intf_ErrMsg( "spdif error: could not initialize thread" );
+ DecoderError( p_config->p_decoder_fifo );
+ free( p_spdif );
return( -1 );
}
/* If b_error is set, the ac3 spdif thread enters the error loop */
if( p_spdif->p_fifo->b_error )
{
- ac3_spdif_ErrorThread( p_spdif );
+ DecoderError( p_spdif->p_fifo );
}
/* End of the ac3 decoder thread */
- ac3_spdif_EndThread( p_spdif );
+ EndThread( p_spdif );
return( 0 );
}
/****************************************************************************
- * ac3_spdif_Init: initialize thread data and create output fifo
+ * InitThread: initialize thread data and create output fifo
****************************************************************************/
-static int ac3_spdif_Init( ac3_spdif_thread_t * p_spdif )
+static int InitThread( ac3_spdif_thread_t * p_spdif )
{
boolean_t b_sync = 0;
return( 0 );
}
-
-/*****************************************************************************
- * ac3_spdif_ErrorThread : ac3 spdif's RunThread() error loop
- *****************************************************************************/
-static void ac3_spdif_ErrorThread( ac3_spdif_thread_t * p_spdif )
-{
- /* We take the lock, because we are going to read/write the start/end
- * indexes of the decoder fifo */
- vlc_mutex_lock (&p_spdif->p_fifo->data_lock);
-
- /* Wait until a `die' order is sent */
- while( !p_spdif->p_fifo->b_die )
- {
- /* Trash all received PES packets */
- while( !DECODER_FIFO_ISEMPTY( *p_spdif->p_fifo ) )
- {
- p_spdif->p_fifo->pf_delete_pes(p_spdif->p_fifo->p_packets_mgt,
- DECODER_FIFO_START( *p_spdif->p_fifo ) );
- DECODER_FIFO_INCSTART( *p_spdif->p_fifo );
- }
-
- /* Waiting for the input thread to put new PES packets in the fifo */
- vlc_cond_wait( &p_spdif->p_fifo->data_wait,
- &p_spdif->p_fifo->data_lock );
- }
-
- /* We can release the lock before leaving */
- vlc_mutex_unlock( &p_spdif->p_fifo->data_lock );
-}
-
/*****************************************************************************
- * ac3_spdif_EndThread : ac3 spdif thread destruction
+ * EndThread : ac3 spdif thread destruction
*****************************************************************************/
-static void ac3_spdif_EndThread( ac3_spdif_thread_t * p_spdif )
+static void EndThread( ac3_spdif_thread_t * p_spdif )
{
intf_DbgMsg( "spdif debug: destroying thread %p", p_spdif );
* lpcm_decoder_thread.c: lpcm decoder thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: lpcm_adec.c,v 1.3 2001/12/03 16:18:37 sam Exp $
+ * $Id: lpcm_adec.c,v 1.3.2.1 2001/12/30 06:06:00 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Henri Fallon <henri@videolan.org>
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int lpcm_adec_Probe ( probedata_t * );
-static int lpcm_adec_Run ( decoder_config_t * );
-void lpcm_adec_DecodeFrame ( lpcmdec_thread_t * );
-static int lpcm_adec_Init ( lpcmdec_thread_t * );
-static void lpcm_adec_ErrorThread ( lpcmdec_thread_t * );
-static void lpcm_adec_EndThread ( lpcmdec_thread_t * );
+static int decoder_Probe ( probedata_t * );
+static int decoder_Run ( decoder_config_t * );
+ void DecodeFrame ( lpcmdec_thread_t * );
+static int InitThread ( lpcmdec_thread_t * );
+static void EndThread ( lpcmdec_thread_t * );
/*****************************************************************************
*****************************************************************************/
void _M( adec_getfunctions )( function_list_t * p_function_list )
{
- p_function_list->pf_probe = lpcm_adec_Probe;
- p_function_list->functions.dec.pf_run = lpcm_adec_Run;
+ p_function_list->pf_probe = decoder_Probe;
+ p_function_list->functions.dec.pf_run = decoder_Run;
}
/*****************************************************************************
MODULE_DEACTIVATE_STOP
/*****************************************************************************
- * lpcm_adec_Probe: probe the decoder and return score
+ * decoder_Probe: probe the decoder and return score
*****************************************************************************/
-static int lpcm_adec_Probe( probedata_t *p_data )
+static int decoder_Probe( probedata_t *p_data )
{
if( p_data->i_type == LPCM_AUDIO_ES )
return( 100 );
}
/*****************************************************************************
- * lpcm_adec_Run: the lpcm decoder
+ * decoder_Run: the lpcm decoder
*****************************************************************************/
-static int lpcm_adec_Run( decoder_config_t * p_config )
+static int decoder_Run( decoder_config_t * p_config )
{
lpcmdec_thread_t * p_lpcmdec;
== NULL)
{
intf_ErrMsg( "LPCM : error : cannot create lpcmdec_thread_t" );
+ DecoderError( p_config->p_decoder_fifo );
return( -1 );
}
p_lpcmdec->p_config = p_config;
p_lpcmdec->p_fifo = p_config->p_decoder_fifo;
- if( lpcm_adec_Init( p_lpcmdec ) )
+ if( InitThread( p_lpcmdec ) )
{
+ DecoderError( p_config->p_decoder_fifo );
+ free( p_lpcmdec );
return( -1 );
}
/* lpcm decoder thread's main loop */
while ((!p_lpcmdec->p_fifo->b_die) && (!p_lpcmdec->p_fifo->b_error))
{
- lpcm_adec_DecodeFrame(p_lpcmdec);
+ DecodeFrame(p_lpcmdec);
}
/* If b_error is set, the lpcm decoder thread enters the error loop */
if (p_lpcmdec->p_fifo->b_error)
{
- lpcm_adec_ErrorThread (p_lpcmdec);
+ DecoderError( p_lpcmdec->p_fifo );
}
/* End of the lpcm decoder thread */
- lpcm_adec_EndThread (p_lpcmdec);
+ EndThread (p_lpcmdec);
return( 0 );
}
/*****************************************************************************
- * lpcm_adec_Init : initialize an lpcm decoder thread
+ * InitThread : initialize an lpcm decoder thread
*****************************************************************************/
-static int lpcm_adec_Init (lpcmdec_thread_t * p_lpcmdec)
+static int InitThread (lpcmdec_thread_t * p_lpcmdec)
{
/* Init the BitStream */
}
/*****************************************************************************
- * lpcm_adec_DecodeFrame: decodes a frame.
+ * DecodeFrame: decodes a frame.
*****************************************************************************/
-void lpcm_adec_DecodeFrame( lpcmdec_thread_t * p_lpcmdec )
+void DecodeFrame( lpcmdec_thread_t * p_lpcmdec )
{
byte_t * buffer,p_temp[LPCMDEC_FRAME_SIZE];
int i_loop;
}
-
-/*****************************************************************************
- * lpcm_adec_ErrorThread : lpcm decoder's RunThread() error loop
- *****************************************************************************/
-static void lpcm_adec_ErrorThread( lpcmdec_thread_t * p_lpcmdec )
-{
- /* We take the lock, because we are going to read/write the start/end
- * indexes of the decoder fifo */
- vlc_mutex_lock( &p_lpcmdec->p_fifo->data_lock );
-
- /* Wait until a `die' order is sent */
- while( !p_lpcmdec->p_fifo->b_die )
- {
- /* Trash all received PES packets */
- while( !DECODER_FIFO_ISEMPTY(*p_lpcmdec->p_fifo) )
- {
- p_lpcmdec->p_fifo->pf_delete_pes( p_lpcmdec->p_fifo->p_packets_mgt,
- DECODER_FIFO_START(*p_lpcmdec->p_fifo ));
- DECODER_FIFO_INCSTART( *p_lpcmdec->p_fifo );
- }
-
- /* Waiting for the input thread to put new PES packets in the fifo */
- vlc_cond_wait ( &p_lpcmdec->p_fifo->data_wait,
- &p_lpcmdec->p_fifo->data_lock );
- }
-
- /* We can release the lock before leaving */
- vlc_mutex_unlock( &p_lpcmdec->p_fifo->data_lock );
-}
-
/*****************************************************************************
- * lpcm_adec_EndThread : lpcm decoder thread destruction
+ * EndThread : lpcm decoder thread destruction
*****************************************************************************/
-static void lpcm_adec_EndThread( lpcmdec_thread_t * p_lpcmdec )
+static void EndThread( lpcmdec_thread_t * p_lpcmdec )
{
intf_DbgMsg( "LPCM Debug: destroying lpcm decoder thread %p", p_lpcmdec );
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int mad_adec_Probe ( probedata_t * );
-static int mad_adec_Run ( decoder_config_t * );
-static int mad_adec_Init (mad_adec_thread_t * p_mad_adec);
-static void mad_adec_ErrorThread (mad_adec_thread_t * p_mad_adec);
-static void mad_adec_EndThread (mad_adec_thread_t * p_mad_adec);
+static int decoder_Probe ( probedata_t * );
+static int decoder_Run ( decoder_config_t * );
+static int InitThread ( mad_adec_thread_t * p_mad_adec );
+static void EndThread ( mad_adec_thread_t * p_mad_adec );
/*****************************************************************************
* Capabilities
*****************************************************************************/
void _M( adec_getfunctions )( function_list_t * p_function_list )
{
- p_function_list->pf_probe = mad_adec_Probe;
- p_function_list->functions.dec.pf_run = mad_adec_Run;
+ p_function_list->pf_probe = decoder_Probe;
+ p_function_list->functions.dec.pf_run = decoder_Run;
}
/*****************************************************************************
MODULE_DEACTIVATE_STOP
/*****************************************************************************
- * mad_adec_Probe: probe the decoder and return score
+ * decoder_Probe: probe the decoder and return score
*****************************************************************************
* Tries to launch a decoder and return score so that the interface is able
* to chose.
*****************************************************************************/
-static int mad_adec_Probe( probedata_t *p_data )
+static int decoder_Probe( probedata_t *p_data )
{
if( p_data->i_type == MPEG1_AUDIO_ES || p_data->i_type == MPEG2_AUDIO_ES )
{
}
/*****************************************************************************
- * mad_adec_Run: this function is called just after the thread is created
+ * decoder_Run: this function is called just after the thread is created
*****************************************************************************/
-static int mad_adec_Run ( decoder_config_t * p_config )
+static int decoder_Run ( decoder_config_t * p_config )
{
mad_adec_thread_t * p_mad_adec;
if (p_mad_adec == NULL)
{
intf_ErrMsg ( "mad_adec error: not enough memory "
- "for mad_adec_Run() to allocate p_mad_adec" );
+ "for decoder_Run() to allocate p_mad_adec" );
+ DecoderError( p_config->p_decoder_fifo );
return( -1 );
}
*/
p_mad_adec->p_config = p_config;
p_mad_adec->p_fifo = p_mad_adec->p_config->p_decoder_fifo;
- if( mad_adec_Init( p_mad_adec ) )
+ if( InitThread( p_mad_adec ) )
{
intf_ErrMsg( "mad_adec error: could not initialize thread" );
+ DecoderError( p_config->p_decoder_fifo );
+ free( p_mad_adec );
return( -1 );
}
if (mad_decoder_run(p_mad_adec->libmad_decoder, MAD_DECODER_MODE_SYNC)==-1)
{
intf_ErrMsg( "mad_adec error: libmad decoder returns abnormally");
- mad_adec_EndThread(p_mad_adec);
+ DecoderError( p_mad_adec->p_fifo );
+ EndThread(p_mad_adec);
return( -1 );
}
}
/* If b_error is set, the mad decoder thread enters the error loop */
if (p_mad_adec->p_fifo->b_error)
{
- mad_adec_ErrorThread (p_mad_adec);
+ DecoderError( p_mad_adec->p_fifo );
}
/* End of the ac3 decoder thread */
- mad_adec_EndThread (p_mad_adec);
+ EndThread (p_mad_adec);
return( 0 );
}
/*****************************************************************************
- * mad_adec_Init: initialize data before entering main loop
+ * InitThread: initialize data before entering main loop
*****************************************************************************/
-static int mad_adec_Init( mad_adec_thread_t * p_mad_adec )
+static int InitThread( mad_adec_thread_t * p_mad_adec )
{
/*
* Properties of audio for libmad
* mpeg_adec.c: MPEG audio decoder thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: mpeg_adec.c,v 1.5 2001/12/04 13:47:46 massiot Exp $
+ * $Id: mpeg_adec.c,v 1.5.2.1 2001/12/30 06:06:00 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
/*****************************************************************************
* Local Prototypes
*****************************************************************************/
-static int adec_Probe( probedata_t * );
-static int adec_RunThread ( decoder_config_t * );
-static void adec_EndThread ( adec_thread_t * );
-static void adec_ErrorThread ( adec_thread_t * );
-static void adec_Decode( adec_thread_t * );
+static int decoder_Probe ( probedata_t * );
+static int decoder_Run ( decoder_config_t * );
+static void EndThread ( adec_thread_t * );
+static void DecodeThread ( adec_thread_t * );
/*****************************************************************************
*****************************************************************************/
void _M( adec_getfunctions )( function_list_t * p_function_list )
{
- p_function_list->pf_probe = adec_Probe;
- p_function_list->functions.dec.pf_run = adec_RunThread;
+ p_function_list->pf_probe = decoder_Probe;
+ p_function_list->functions.dec.pf_run = decoder_Run;
}
/*****************************************************************************
MODULE_DEACTIVATE_STOP
/*****************************************************************************
- * adec_Probe: probe the decoder and return score
+ * decoder_Probe: probe the decoder and return score
*****************************************************************************/
-static int adec_Probe( probedata_t *p_data )
+static int decoder_Probe( probedata_t *p_data )
{
if( p_data->i_type == MPEG1_AUDIO_ES || p_data->i_type == MPEG2_AUDIO_ES )
{
}
/*****************************************************************************
- * adec_RunThread: initialize, go inside main loop, detroy
+ * decoder_Run: initialize, go inside main loop, detroy
*****************************************************************************/
-static int adec_RunThread ( decoder_config_t * p_config )
+static int decoder_Run ( decoder_config_t * p_config )
{
adec_thread_t * p_adec;
{
intf_ErrMsg ( "adec error: not enough memory for"
" adec_CreateThread() to create the new thread" );
+ DecoderError( p_config->p_decoder_fifo );
return 0;
}
/* Audio decoder thread's main loop */
while( (!p_adec->p_fifo->b_die) && (!p_adec->p_fifo->b_error) )
{
- adec_Decode( p_adec );
+ DecodeThread( p_adec );
}
/* If b_error is set, the audio decoder thread enters the error loop */
if( p_adec->p_fifo->b_error )
{
- adec_ErrorThread( p_adec );
+ DecoderError( p_adec->p_fifo );
}
/* End of the audio decoder thread */
- adec_EndThread( p_adec );
+ EndThread( p_adec );
return( 0 );
}
*/
/*****************************************************************************
- * adec_Decode: decodes a mpeg frame
+ * DecodeThread: decodes a mpeg frame
*****************************************************************************/
-static void adec_Decode( adec_thread_t * p_adec )
+static void DecodeThread( adec_thread_t * p_adec )
{
s16 * buffer;
adec_sync_info_t sync_info;
}
/*****************************************************************************
- * adec_ErrorThread : audio decoder's RunThread() error loop
- *****************************************************************************
- * This function is called when an error occured during thread main's loop. The
- * thread can still receive feed, but must be ready to terminate as soon as
- * possible.
- *****************************************************************************/
-static void adec_ErrorThread ( adec_thread_t *p_adec )
-{
- /* We take the lock, because we are going to read/write the start/end
- * indexes of the decoder fifo */
- vlc_mutex_lock ( &p_adec->p_fifo->data_lock );
-
- /* Wait until a `die' order is sent */
- while ( !p_adec->p_fifo->b_die )
- {
- /* Trash all received PES packets */
- while ( !DECODER_FIFO_ISEMPTY(*p_adec->p_fifo) )
- {
- p_adec->p_fifo->pf_delete_pes ( p_adec->p_fifo->p_packets_mgt,
- DECODER_FIFO_START(*p_adec->p_fifo) );
- DECODER_FIFO_INCSTART ( *p_adec->p_fifo );
- }
-
- /* Waiting for the input thread to put new PES packets in the fifo */
- vlc_cond_wait ( &p_adec->p_fifo->data_wait, &p_adec->p_fifo->data_lock );
- }
-
- /* We can release the lock before leaving */
- vlc_mutex_unlock ( &p_adec->p_fifo->data_lock );
-}
-
-
-/*****************************************************************************
- * adec_EndThread : audio decoder thread destruction
+ * EndThread : audio decoder thread destruction
*****************************************************************************
* This function is called when the thread ends after a sucessful
* initialization.
*****************************************************************************/
-static void adec_EndThread ( adec_thread_t *p_adec )
+static void EndThread ( adec_thread_t *p_adec )
{
intf_DbgMsg ( "adec debug: destroying audio decoder thread %p", p_adec );
* mpeg_adec.h : audio decoder thread interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: mpeg_adec.h,v 1.1 2001/11/13 12:09:18 henri Exp $
+ * $Id: mpeg_adec.h,v 1.1.2.1 2001/12/30 06:06:00 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
*/
int adec_SyncFrame( adec_thread_t *, adec_sync_info_t * );
int adec_DecodeFrame( adec_thread_t * , s16 * );
+
* video_parser.c : video parser thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: video_parser.c,v 1.6 2001/12/07 18:33:08 sam Exp $
+ * $Id: video_parser.c,v 1.6.2.1 2001/12/30 06:06:00 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
/*
* Local prototypes
*/
-static int mpeg_vdec_Probe ( probedata_t * );
-static int mpeg_vdec_Run ( decoder_config_t * );
-static int mpeg_vdec_Init ( vpar_thread_t * );
-static void mpeg_vdec_ErrorThread ( vpar_thread_t * );
-static void mpeg_vdec_EndThread ( vpar_thread_t * );
-static void BitstreamCallback ( bit_stream_t *, boolean_t );
+static int decoder_Probe ( probedata_t * );
+static int decoder_Run ( decoder_config_t * );
+static int InitThread ( vpar_thread_t * );
+static void EndThread ( vpar_thread_t * );
+static void BitstreamCallback ( bit_stream_t *, boolean_t );
/*****************************************************************************
* Capabilities
*****************************************************************************/
void _M( vdec_getfunctions )( function_list_t * p_function_list )
{
- p_function_list->pf_probe = mpeg_vdec_Probe;
- p_function_list->functions.dec.pf_run = mpeg_vdec_Run;
+ p_function_list->pf_probe = decoder_Probe;
+ p_function_list->functions.dec.pf_run = decoder_Run;
}
/*****************************************************************************
/*****************************************************************************
- * mpeg_vdec_Probe: probe the decoder and return score
+ * decoder_Probe: probe the decoder and return score
*****************************************************************************
* Tries to launch a decoder and return score so that the interface is able
* to chose.
*****************************************************************************/
-static int mpeg_vdec_Probe( probedata_t *p_data )
+static int decoder_Probe( probedata_t *p_data )
{
if( p_data->i_type == MPEG1_VIDEO_ES || p_data->i_type == MPEG2_VIDEO_ES )
return( 50 );
}
/*****************************************************************************
- * mpeg_vdec_Run: this function is called just after the thread is created
+ * decoder_Run: this function is called just after the thread is created
*****************************************************************************/
-static int mpeg_vdec_Run ( decoder_config_t * p_config )
+static int decoder_Run ( decoder_config_t * p_config )
{
vpar_thread_t * p_vpar;
boolean_t b_error;
{
intf_ErrMsg( "vpar error: not enough memory "
"for vpar_CreateThread() to create the new thread");
+ DecoderError( p_config->p_decoder_fifo );
return( -1 );
}
/*
* Initialize thread
*/
- p_vpar->p_fifo->b_error = mpeg_vdec_Init( p_vpar );
+ p_vpar->p_fifo->b_error = InitThread( p_vpar );
/*
* Main loop - it is not executed if an error occured during
*/
if( ( b_error = p_vpar->p_fifo->b_error ) )
{
- mpeg_vdec_ErrorThread( p_vpar );
+ DecoderError( p_vpar->p_fifo );
}
/* End of thread */
- mpeg_vdec_EndThread( p_vpar );
+ EndThread( p_vpar );
if( b_error )
{
}
/*****************************************************************************
- * mpeg_vdec_Init: initialize vpar output thread
+ * InitThread: initialize vpar output thread
*****************************************************************************
- * This function is called from mpeg_vdec_Run and performs the second step
+ * This function is called from decoder_Run and performs the second step
* of the initialization. It returns 0 on success. Note that the thread's
* flag are not modified inside this function.
*****************************************************************************/
-static int mpeg_vdec_Init( vpar_thread_t *p_vpar )
+static int InitThread( vpar_thread_t *p_vpar )
{
/*
* Choose the best motion compensation module
}
/*****************************************************************************
- * mpeg_vdec_EndThread: thread destruction
+ * EndThread: thread destruction
*****************************************************************************
* This function is called when the thread ends after a sucessful
* initialization.
*****************************************************************************/
-static void mpeg_vdec_EndThread( vpar_thread_t *p_vpar )
+static void EndThread( vpar_thread_t *p_vpar )
{
intf_DbgMsg("vpar debug: destroying video parser thread %p", p_vpar);
* spu_decoder.c : spu decoder thread
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: spu_decoder.c,v 1.5.2.1 2001/12/13 23:56:18 sam Exp $
+ * $Id: spu_decoder.c,v 1.5.2.2 2001/12/30 06:06:00 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
static int spu_dec_Probe ( probedata_t * );
static int spu_dec_Run ( decoder_config_t * );
static int spu_dec_Init ( spudec_thread_t * );
-static void spu_dec_ErrorThread ( spudec_thread_t * );
static void spu_dec_EndThread ( spudec_thread_t * );
static int SyncPacket ( spudec_thread_t * );
{
intf_ErrMsg( "spudec error: not enough memory "
"for spudec_CreateThread() to create the new thread" );
+ DecoderError( p_config->p_decoder_fifo );
return( -1 );
}
*/
if( p_spudec->p_fifo->b_error )
{
- spu_dec_ErrorThread( p_spudec );
+ DecoderError( p_spudec->p_fifo );
}
/* End of thread */
return( 0 );
}
-/*****************************************************************************
- * spu_dec_ErrorThread: spu_dec_Run() error loop
- *****************************************************************************
- * This function is called when an error occured during thread main's loop. The
- * thread can still receive feed, but must be ready to terminate as soon as
- * possible.
- *****************************************************************************/
-static void spu_dec_ErrorThread( spudec_thread_t *p_spudec )
-{
- /* We take the lock, because we are going to read/write the start/end
- * indexes of the decoder fifo */
- vlc_mutex_lock( &p_spudec->p_fifo->data_lock );
-
- /* Wait until a `die' order is sent */
- while( !p_spudec->p_fifo->b_die )
- {
- /* Trash all received PES packets */
- while( !DECODER_FIFO_ISEMPTY(*p_spudec->p_fifo) )
- {
- p_spudec->p_fifo->pf_delete_pes( p_spudec->p_fifo->p_packets_mgt,
- DECODER_FIFO_START(*p_spudec->p_fifo) );
- DECODER_FIFO_INCSTART( *p_spudec->p_fifo );
- }
-
- /* Waiting for the input thread to put new PES packets in the fifo */
- vlc_cond_wait( &p_spudec->p_fifo->data_wait,
- &p_spudec->p_fifo->data_lock );
- }
-
- /* We can release the lock before leaving */
- vlc_mutex_unlock( &p_spudec->p_fifo->data_lock );
-}
-
/*****************************************************************************
* spu_dec_EndThread: thread destruction
*****************************************************************************
* input_ext-dec.c: services to the decoders
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: input_ext-dec.c,v 1.21 2001/11/28 15:08:06 massiot Exp $
+ * $Id: input_ext-dec.c,v 1.21.2.1 2001/12/30 06:06:00 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
}
}
+/*****************************************************************************
+ * DecoderError : an error occured, use this function to empty the fifo
+ *****************************************************************************/
+void DecoderError( decoder_fifo_t * p_fifo )
+{
+ /* We take the lock, because we are going to read/write the start/end
+ * indexes of the decoder fifo */
+ vlc_mutex_lock( &p_fifo->data_lock );
+
+ /* Wait until a `die' order is sent */
+ while( !p_fifo->b_die )
+ {
+ /* Trash all received PES packets */
+ while( !DECODER_FIFO_ISEMPTY(*p_fifo) )
+ {
+ p_fifo->pf_delete_pes( p_fifo->p_packets_mgt,
+ DECODER_FIFO_START(*p_fifo) );
+ DECODER_FIFO_INCSTART( *p_fifo );
+ }
+
+ /* Waiting for the input thread to put new PES packets in the fifo */
+ vlc_cond_wait( &p_fifo->data_wait, &p_fifo->data_lock );
+ }
+
+ /* We can release the lock before leaving */
+ vlc_mutex_unlock( &p_fifo->data_lock );
+}
+
/*****************************************************************************
* NextDataPacket: go to the next data packet
*****************************************************************************/