- /*
- * Initialize the thread properties
- */
- p_spudec->p_vout = NULL;
- p_spudec->p_fifo = p_fifo;
-#if defined(HAVE_ICONV)
- p_spudec->iconv_handle = (iconv_t)-1;
-#endif
-
- /*
- * Initialize thread and free configuration
- */
- p_spudec->p_fifo->b_error = InitThread( p_spudec );
-
- /*
- * Main loop - it is not executed if an error occured during
- * initialization
- */
- if( p_fifo->i_fourcc == VLC_FOURCC('s','u','b','t') )
- {
- /* 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);
- }
-#elif defined(WIN32) && !defined(UNDER_CE)
- 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 = VLC_TRUE;
- }
-#endif
-#if defined(HAVE_ICONV)
- p_spudec->iconv_handle = iconv_open( "UTF-8",
- config_GetPsz( p_spudec->p_fifo, "spudec-encoding" ) );
- if( p_spudec->iconv_handle == (iconv_t)-1 )
- {
- msg_Warn( p_spudec->p_fifo, "Unable to do requested conversion" );
- }
-#endif
- while( (!p_spudec->p_fifo->b_die) && (!p_spudec->p_fifo->b_error) )
- {
- /* Find/Wait for a video output */
- p_spudec->p_vout = FindVout( p_spudec );
-
- if( p_spudec->p_vout )
- {
-#if 0
- if( p_spudec->p_vout != p_vout_backup )
- {
- /* The vout has changed, we need to reload the fonts */
- p_vout_backup = p_spudec->p_vout;
-
- 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 );
- p_spudec->p_fifo->b_error = VLC_TRUE;
-
- vlc_object_release( p_spudec->p_vout );
- break;
- }
- }
-#endif
-
- E_(ParseText)( p_spudec, p_font );
-
- vlc_object_release( p_spudec->p_vout );
- }
- }
-
- if( psz_font ) free( psz_font );
-
- if( p_font )
- {
- /* Find/Wait for a video output */
- p_spudec->p_vout = FindVout( p_spudec );
-
- if( p_spudec->p_vout )
- {
- E_(subtitler_UnloadFont)( p_spudec->p_vout, p_font );
-
- vlc_object_release( p_spudec->p_vout );
- }
- }
- }
- else
- {
- /* Here we are dealing with sub-pictures subtitles*/