/*****************************************************************************
* SSA/ASS subtitle decoder using libass.
*****************************************************************************
- * Copyright (C) 2008 the VideoLAN team
+ * Copyright (C) 2008-2009 the VideoLAN team
* $Id$
*
* Authors: Laurent Aimar <fenrir@videolan.org>
#include <ass/ass.h>
+#if defined(WIN32)
+# include <vlc_charset.h>
+#endif
+
/*****************************************************************************
* Module descriptor
*****************************************************************************/
static int Create ( vlc_object_t * );
static void Destroy( vlc_object_t * );
-vlc_module_begin();
- set_shortname( N_("Subtitles (advanced)"));
- set_description( N_("Subtitle renderers using libass") );
- set_capability( "decoder", 100 );
- set_category( CAT_INPUT );
- set_subcategory( SUBCAT_INPUT_SCODEC );
- set_callbacks( Create, Destroy );
-vlc_module_end();
+vlc_module_begin ()
+ set_shortname( N_("Subtitles (advanced)"))
+ set_description( N_("Subtitle renderers using libass") )
+ set_capability( "decoder", 100 )
+ set_category( CAT_INPUT )
+ set_subcategory( SUBCAT_INPUT_SCODEC )
+ set_callbacks( Create, Destroy )
+vlc_module_end ()
/*****************************************************************************
* Local prototypes
ass_process_codec_private( p_track, p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra );
vlc_mutex_unlock( &libass_lock );
+ p_dec->fmt_out.i_cat = SPU_ES;
+ p_dec->fmt_out.i_codec = VLC_FOURCC('R','G','B','A');
+
return VLC_SUCCESS;
}
return NULL;
}
- p_spu = p_dec->pf_spu_buffer_new( p_dec );
+ p_spu = decoder_NewSubpicture( p_dec );
if( !p_spu )
{
msg_Warn( p_dec, "can't get spu buffer" );
p_spu->p_sys = malloc( sizeof( subpicture_sys_t ));
if( !p_spu->p_sys )
{
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
block_Release( p_block );
return NULL;
}
if( !p_spu->p_sys->p_subs_data )
{
free( p_spu->p_sys );
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
block_Release( p_block );
return NULL;
}
static void SubpictureReleaseRegions( spu_t *p_spu, subpicture_t *p_subpic )
{
+ VLC_UNUSED( p_spu );
subpicture_region_ChainDelete( p_subpic->p_region );
p_subpic->p_region = NULL;
}
}
free( pp_attachments );
- char *psz_font_dir = config_GetCacheDir();
+ char *psz_font_dir = NULL;
+
+#if defined(WIN32)
+ /* This makes Windows build of VLC hang */
+ const UINT uPath = GetSystemWindowsDirectoryW( NULL, 0 );
+ if( uPath > 0 )
+ {
+ wchar_t *psw_path = calloc( uPath + 1, sizeof(wchar_t) );
+ if( psw_path )
+ {
+ if( GetSystemWindowsDirectoryW( psw_path, uPath + 1 ) > 0 )
+ {
+ char *psz_tmp = FromWide( psw_path );
+ if( psz_tmp &&
+ asprintf( &psz_font_dir, "%s\\Fonts", psz_tmp ) < 0 )
+ psz_font_dir = NULL;
+ free( psz_tmp );
+ }
+ free( psw_path );
+ }
+ }
+#endif
+
+ if( !psz_font_dir )
+ psz_font_dir = config_GetCacheDir();
+
if( !psz_font_dir )
goto error;
+ msg_Dbg( p_dec, "Setting libass fontdir: %s", psz_font_dir );
ass_set_fonts_dir( p_library, psz_font_dir );
free( psz_font_dir );
if( p_library )
ass_library_done( p_library );
+ msg_Warn( p_dec, "Libass creation failed" );
+
free( p_ass );
vlc_mutex_unlock( &libass_lock );
return NULL;