[vlc-devel] commit: libass: move attachments processing before the ass_set_fonts_dir() option which enables those fonts. (Derk-Jan Hartman )
git version control
git at videolan.org
Sat Aug 9 02:21:06 CEST 2008
vlc | branch: master | Derk-Jan Hartman <hartman at videolan.org> | Tue Aug 5 01:57:23 2008 +0200| [d1546c2e83159d97d48310a54a6b501de4109b89] | committer: Derk-Jan Hartman
libass: move attachments processing before the ass_set_fonts_dir() option which enables those fonts.
Set a fonts_dir for OSX. We might wanna fix that later on.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d1546c2e83159d97d48310a54a6b501de4109b89
---
modules/codec/libass.c | 56 ++++++++++++++++++++++++++---------------------
1 files changed, 31 insertions(+), 25 deletions(-)
diff --git a/modules/codec/libass.c b/modules/codec/libass.c
index ddd871e..b1bf84f 100644
--- a/modules/codec/libass.c
+++ b/modules/codec/libass.c
@@ -149,31 +149,6 @@ static int Create( vlc_object_t *p_this )
vlc_mutex_init( &p_sys->lock );
p_sys->i_refcount = 1;
- /* load attachments */
- input_attachment_t **pp_attachments;
- int i_attachments;
-
- if( decoder_GetInputAttachments( p_dec, &pp_attachments, &i_attachments ))
- {
- i_attachments = 0;
- pp_attachments = NULL;
- }
- for( int k = 0; k < i_attachments; k++ )
- {
- input_attachment_t *p_attach = pp_attachments[k];
-
- if( !strcasecmp( p_attach->psz_mime, "application/x-truetype-font" ) )
- {
- msg_Dbg( p_dec, "adding embedded font %s\n", p_attach->psz_name );
-
- vlc_mutex_lock( p_sys->p_ass->p_lock );
- ass_add_font( p_sys->p_ass->p_library, p_attach->psz_name, p_attach->p_data, p_attach->i_data );
- vlc_mutex_unlock( p_sys->p_ass->p_lock );
- }
- vlc_input_attachment_Delete( p_attach );
- }
- free( pp_attachments );
-
/* Add a track */
vlc_mutex_lock( p_sys->p_ass->p_lock );
p_sys->p_track = p_track = ass_new_track( p_sys->p_ass->p_library );
@@ -706,7 +681,38 @@ static ass_handle_t *AssHandleYield( decoder_t *p_dec )
if( !p_library )
goto error;
+ /* load attachments */
+ input_attachment_t **pp_attachments;
+ int i_attachments;
+
+ if( decoder_GetInputAttachments( p_dec, &pp_attachments, &i_attachments ))
+ {
+ i_attachments = 0;
+ pp_attachments = NULL;
+ }
+ for( int k = 0; k < i_attachments; k++ )
+ {
+ input_attachment_t *p_attach = pp_attachments[k];
+
+ if( !strcasecmp( p_attach->psz_mime, "application/x-truetype-font" ) )
+ {
+ msg_Dbg( p_dec, "adding embedded font %s\n", p_attach->psz_name );
+
+ ass_add_font( p_ass->p_library, p_attach->psz_name, p_attach->p_data, p_attach->i_data );
+ }
+ vlc_input_attachment_Delete( p_attach );
+ }
+ free( pp_attachments );
+
+#ifdef __APPLE__
+ char * psz_font_dir;
+ if( asprintf( &psz_font_dir, "%s/Library/Fonts", config_GetHomeDir() ) != -1 ) {
+ ass_set_fonts_dir( p_library, psz_font_dir );
+ free( psz_font_dir );
+ }
+#else
ass_set_fonts_dir( p_library, "/usr/share/fonts" ); // FIXME
+#endif
ass_set_extract_fonts( p_library, true );
ass_set_style_overrides( p_library, NULL );
More information about the vlc-devel
mailing list