* spu_decoder.c : spu decoder thread
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: spu_decoder.c,v 1.29 2002/06/27 19:46:32 sam Exp $
+ * $Id: spu_decoder.c,v 1.31 2002/07/31 20:56:52 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Rudolf Cornelissen <rag.cornelissen@inter.nl.net>
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int decoder_Probe ( u8 * );
-static int decoder_Run ( decoder_fifo_t * );
+static int OpenDecoder ( vlc_object_t * );
+static int RunDecoder ( decoder_fifo_t * );
static int InitThread ( spudec_thread_t * );
static void EndThread ( spudec_thread_t * );
static int ParseRLE ( spudec_thread_t *, subpicture_t *, u8 * );
static void RenderSPU ( vout_thread_t *, picture_t *,
const subpicture_t * );
-
-/*****************************************************************************
- * Capabilities
- *****************************************************************************/
-void _M( spudec_getfunctions )( function_list_t * p_function_list )
-{
- p_function_list->functions.dec.pf_probe = decoder_Probe;
- p_function_list->functions.dec.pf_run = decoder_Run;
-}
-
/*****************************************************************************
- * Build configuration tree.
+ * Module descriptor.
*****************************************************************************/
-MODULE_CONFIG_START
-MODULE_CONFIG_STOP
-
-MODULE_INIT_START
- SET_DESCRIPTION( _("DVD subtitles decoder module") )
- ADD_CAPABILITY( DECODER, 50 )
-MODULE_INIT_STOP
-
-MODULE_ACTIVATE_START
- _M( spudec_getfunctions )( &p_module->p_functions->dec );
-MODULE_ACTIVATE_STOP
-
-MODULE_DEACTIVATE_START
-MODULE_DEACTIVATE_STOP
+vlc_module_begin();
+ set_description( _("DVD subtitles decoder module") );
+ set_capability( "decoder", 50 );
+ set_callbacks( OpenDecoder, NULL );
+vlc_module_end();
/*****************************************************************************
- * decoder_Probe: probe the decoder and return score
+ * OpenDecoder: probe the decoder and return score
*****************************************************************************
* Tries to launch a decoder and return score so that the interface is able
* to chose.
*****************************************************************************/
-static int decoder_Probe( u8 *pi_type )
+static int OpenDecoder( vlc_object_t *p_this )
{
- return ( *pi_type == DVD_SPU_ES ) ? 0 : -1;
+ decoder_fifo_t *p_fifo = (decoder_fifo_t*) p_this;
+
+ if( p_fifo->i_fourcc == VLC_FOURCC('s','p','u',' ') )
+ {
+ p_fifo->pf_run = RunDecoder;
+ return VLC_SUCCESS;
+ }
+
+ return VLC_EGENERIC;
}
/*****************************************************************************
- * decoder_Run: this function is called just after the thread is created
+ * RunDecoder: this function is called just after the thread is created
*****************************************************************************/
-static int decoder_Run( decoder_fifo_t * p_fifo )
+static int RunDecoder( decoder_fifo_t * p_fifo )
{
spudec_thread_t * p_spudec;
switch( p_vout->output.i_chroma )
{
/* I420 target, no scaling */
- case FOURCC_I420:
- case FOURCC_IYUV:
- case FOURCC_YV12:
+ case VLC_FOURCC('I','4','2','0'):
+ case VLC_FOURCC('I','Y','U','V'):
+ case VLC_FOURCC('Y','V','1','2'):
p_dest = p_pic->Y_PIXELS + p_spu->i_x + p_spu->i_width
+ p_pic->Y_PITCH * ( p_spu->i_y + p_spu->i_height );
break;
/* RV16 target, scaling */
- case FOURCC_RV16:
+ case VLC_FOURCC('R','V','1','6'):
/* XXX: this is a COMPLETE HACK, memcpy is unable to do u16s anyway */
/* FIXME: get this from the DVD */
break;
/* RV32 target, scaling */
- case FOURCC_RV24:
- case FOURCC_RV32:
+ case VLC_FOURCC('R','V','2','4'):
+ case VLC_FOURCC('R','V','3','2'):
/* XXX: this is a COMPLETE HACK, memcpy is unable to do u32s anyway */
/* FIXME: get this from the DVD */
break;
/* NVidia overlay, no scaling */
- case FOURCC_YUY2:
+ case VLC_FOURCC('Y','U','Y','2'):
p_dest = p_pic->p->p_pixels +
(p_spu->i_x + p_spu->i_width +