* spudec.c : SPU decoder thread
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: spudec.c,v 1.8 2002/11/06 21:48:24 gbazin Exp $
+ * $Id: spudec.c,v 1.13 2003/01/28 22:03:21 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int OpenDecoder ( vlc_object_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 * );
/*****************************************************************************
* Module descriptor.
*****************************************************************************/
-#define FONT_TEXT N_("Font used by the text subtitler")
+#define FONT_TEXT N_("font used by the text subtitler")
#define FONT_LONGTEXT N_(\
"When the subtitles are coded in text form then, you can choose " \
"which font will be used to display them.")
+#define DEFAULT_FONT "font-eutopiabold36.rle"
+
vlc_module_begin();
add_category_hint( N_("subtitles"), NULL );
- add_file( "spudec-font", "./share/font-eutopiabold36.rle", NULL,
+#if defined(SYS_DARWIN) || defined(SYS_BEOS)
+ add_file( "spudec-font", NULL, NULL,
FONT_TEXT, FONT_LONGTEXT );
+#else
+ add_file( "spudec-font", "./share/" DEFAULT_FONT, NULL,
+ FONT_TEXT, FONT_LONGTEXT );
+#endif
set_description( _("subtitles decoder module") );
set_capability( "decoder", 50 );
set_callbacks( OpenDecoder, NULL );
/*****************************************************************************
* OpenDecoder: probe the decoder and return score
*****************************************************************************
- * Tries to launch a decoder and return score so that the interface is able
+ * Tries to launch a decoder and return score so that the interface is able
* to chose.
*****************************************************************************/
static int OpenDecoder( vlc_object_t *p_this )
DecoderError( p_fifo );
return( -1 );
}
-
+
/*
* Initialize the thread properties
*/
{
/* Here we are dealing with text subtitles */
+#if defined(SYS_DARWIN) || defined(SYS_BEOS)
+ if ( (psz_font = config_GetPsz( p_fifo, "spudec-font" )) == NULL )
+ {
+ char * psz_vlcpath = p_fifo->p_libvlc->psz_vlcpath;
+ psz_font = malloc( strlen(psz_vlcpath) + strlen("/share/")
+ + strlen(DEFAULT_FONT) + 1 );
+ sprintf(psz_font, "%s/share/" DEFAULT_FONT, psz_vlcpath);
+ }
+#else
if( (psz_font = config_GetPsz( p_fifo, "spudec-font" )) == NULL )
{
msg_Err( p_fifo, "no default font selected" );
p_spudec->p_fifo->b_error;
}
else
+#endif
{
- p_font = subtitler_LoadFont( p_spudec->p_vout, psz_font );
+ p_font = E_(subtitler_LoadFont)( p_spudec->p_vout, psz_font );
if ( p_font == NULL )
{
msg_Err( p_fifo, "unable to load font: %s", psz_font );
E_(ParseText)( p_spudec, p_font );
}
- if( p_font ) subtitler_UnloadFont( p_spudec->p_vout, p_font );
+ if( p_font ) E_(subtitler_UnloadFont)( p_spudec->p_vout, p_font );
}
else
*****************************************************************************/
static void EndThread( spudec_thread_t *p_spudec )
{
- if( p_spudec->p_vout != NULL
+ if( p_spudec->p_vout != NULL
&& p_spudec->p_vout->p_subpicture != NULL )
{
subpicture_t * p_subpic;
int i_subpic;
-
+
for( i_subpic = 0; i_subpic < VOUT_MAX_SUBPICTURES; i_subpic++ )
{
p_subpic = &p_spudec->p_vout->p_subpicture[i_subpic];
vlc_object_release( p_spudec->p_vout );
}
-
+
CloseBitstream( &p_spudec->bit_stream );
free( p_spudec );
}