* video_parser.c : video parser thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: video_parser.c,v 1.10 2001/12/30 07:09:56 sam Exp $
+ * $Id: video_parser.c,v 1.20 2002/05/19 12:57:32 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
/*
* Local prototypes
*/
-static int decoder_Probe ( probedata_t * );
+static int decoder_Probe ( u8 * );
static int decoder_Run ( decoder_config_t * );
static int InitThread ( vpar_thread_t * );
static void EndThread ( vpar_thread_t * );
*****************************************************************************/
void _M( vdec_getfunctions )( function_list_t * p_function_list )
{
- p_function_list->pf_probe = decoder_Probe;
- p_function_list->functions.dec.pf_run = decoder_Run;
+ p_function_list->functions.dec.pf_probe = decoder_Probe;
+ p_function_list->functions.dec.pf_run = decoder_Run;
}
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
+#define VDEC_IDCT_TEXT N_("IDCT module")
+#define VDEC_IDCT_LONGTEXT N_( \
+ "This option allows you to select the IDCT module used by this video " \
+ "decoder.\n" \
+ "Note that the default behavior is to automatically select the best " \
+ "module available.")
+
+#define VDEC_MOTION_TEXT N_("motion compensation module")
+#define VDEC_MOTION_LONGTEXT N_( \
+ "This option allows you to select the motion compensation module used by "\
+ "this video decoder.\n" \
+ "Note that the default behavior is to automatically select the best " \
+ "module available.")
+
+#define VDEC_SMP_TEXT N_("use additional processors")
+#define VDEC_SMP_LONGTEXT N_( \
+ "This video decoder can benefit from a multiprocessor computer. If you " \
+ "have one, you can specify the number of processors here.")
+
+#define VPAR_SYNCHRO_TEXT N_("force synchro algorithm {I|I+|IP|IP+|IPB}")
+#define VPAR_SYNCHRO_LONGTEXT N_( \
+ "This allows you to force the synchro algorithm, by directly selecting " \
+ "the types of picture you want to decode. Please bear in mind that if " \
+ "you select more pictures than what your CPU is capable to decode, " \
+ "you won't get anything.")
+
MODULE_CONFIG_START
+ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL)
+ADD_MODULE ( "mpeg-idct", MODULE_CAPABILITY_IDCT, NULL, NULL,
+ VDEC_IDCT_TEXT, VDEC_IDCT_LONGTEXT )
+ADD_MODULE ( "mpeg-motion", MODULE_CAPABILITY_MOTION, NULL, NULL,
+ VDEC_MOTION_TEXT, VDEC_IDCT_LONGTEXT )
+ADD_INTEGER ( "vdec-smp", 0, NULL, VDEC_SMP_TEXT, VDEC_SMP_LONGTEXT )
+ADD_STRING ( "vpar-synchro", NULL, NULL, VPAR_SYNCHRO_TEXT,
+ VPAR_SYNCHRO_LONGTEXT )
MODULE_CONFIG_STOP
MODULE_INIT_START
- SET_DESCRIPTION( "MPEG I/II video decoder module" )
+ SET_DESCRIPTION( _("MPEG I/II video decoder module") )
ADD_CAPABILITY( DECODER, 50 )
MODULE_INIT_STOP
* Tries to launch a decoder and return score so that the interface is able
* to chose.
*****************************************************************************/
-static int decoder_Probe( probedata_t *p_data )
+static int decoder_Probe( u8 *pi_type )
{
- return( ( p_data->i_type == MPEG1_VIDEO_ES
- || p_data->i_type == MPEG2_VIDEO_ES ) ? 50 : 0 );
+ return( ( *pi_type == MPEG1_VIDEO_ES
+ || *pi_type == MPEG2_VIDEO_ES ) ? 0 : -1 );
}
/*****************************************************************************
vpar_thread_t * p_vpar;
boolean_t b_error;
- intf_DbgMsg( "vpar debug: video parser thread created. Initializing..." );
-
/* Allocate the memory needed to store the thread's structure */
if ( (p_vpar = (vpar_thread_t *)malloc( sizeof(vpar_thread_t) )) == NULL )
{
*****************************************************************************/
static int InitThread( vpar_thread_t *p_vpar )
{
+ char *psz_name;
+
/*
* Choose the best motion compensation module
*/
- p_vpar->p_motion_module = module_Need( MODULE_CAPABILITY_MOTION,
- main_GetPszVariable( MOTION_METHOD_VAR, NULL ),
- NULL );
+ psz_name = config_GetPszVariable( "mpeg-motion" );
+ p_vpar->p_motion_module = module_Need( MODULE_CAPABILITY_MOTION, psz_name,
+ NULL );
+ if( psz_name ) free( psz_name );
if( p_vpar->p_motion_module == NULL )
{
/*
* Choose the best IDCT module
*/
- p_vpar->p_idct_module = module_Need( MODULE_CAPABILITY_IDCT,
- main_GetPszVariable( IDCT_METHOD_VAR, NULL ),
- NULL );
+ psz_name = config_GetPszVariable( "mpeg-idct" );
+ p_vpar->p_idct_module = module_Need( MODULE_CAPABILITY_IDCT, psz_name,
+ NULL );
+ if( psz_name ) free( psz_name );
if( p_vpar->p_idct_module == NULL )
{
#undef f
/* Initialize input bitstream */
- p_vpar->p_config->pf_init_bit_stream( &p_vpar->bit_stream,
- p_vpar->p_config->p_decoder_fifo, BitstreamCallback,
- (void *)p_vpar );
+ InitBitstream( &p_vpar->bit_stream, p_vpar->p_config->p_decoder_fifo,
+ BitstreamCallback, (void *)p_vpar );
/* Initialize parsing data */
p_vpar->sequence.p_forward = NULL;
vpar_InitPool( p_vpar );
/* Mark thread as running and return */
- intf_DbgMsg("vpar debug: InitThread(%p) succeeded", p_vpar);
return( 0 );
}
*****************************************************************************/
static void EndThread( vpar_thread_t *p_vpar )
{
- intf_DbgMsg("vpar debug: destroying video parser thread %p", p_vpar);
-
/* Release used video buffers. */
if( p_vpar->sequence.p_forward != NULL )
{
module_Unneed( p_vpar->p_motion_module );
free( p_vpar );
-
- intf_DbgMsg("vpar debug: EndThread(%p)", p_vpar);
}
/*****************************************************************************
if( b_new_pes )
{
- p_vpar->sequence.next_pts =
- p_bit_stream->p_decoder_fifo->p_first->i_pts;
- p_vpar->sequence.next_dts =
- p_bit_stream->p_decoder_fifo->p_first->i_dts;
p_vpar->sequence.i_current_rate =
p_bit_stream->p_decoder_fifo->p_first->i_rate;
if( p_bit_stream->p_decoder_fifo->p_first->b_discontinuity )
{
-#ifdef TRACE_VPAR
- intf_DbgMsg( "Discontinuity in BitstreamCallback" );
-#endif
/* Escape the current picture and reset the picture predictors. */
p_vpar->sequence.b_expect_discontinuity = 1;
p_vpar->picture.b_error = 1;
if( p_bit_stream->p_data->b_discard_payload )
{
-#ifdef TRACE_VPAR
- intf_DbgMsg( "Discard payload in BitstreamCallback" );
-#endif
/* 1 packet messed up, trash the slice. */
p_vpar->picture.b_error = 1;
}