Commit 3c777414 authored by Ilkka Ollakka's avatar Ilkka Ollakka

freetype: don't load/unload xml-module on every RenderHtml call

parent 09e36329
...@@ -270,6 +270,7 @@ struct filter_sys_t ...@@ -270,6 +270,7 @@ struct filter_sys_t
char* psz_fontfamily; char* psz_fontfamily;
bool b_fontconfig_ok; bool b_fontconfig_ok;
FcConfig *p_fontconfig; FcConfig *p_fontconfig;
xml_t *p_xml;
#endif #endif
input_attachment_t **pp_font_attachments; input_attachment_t **pp_font_attachments;
...@@ -311,6 +312,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -311,6 +312,7 @@ static int Create( vlc_object_t *p_this )
return VLC_ENOMEM; return VLC_ENOMEM;
#ifdef HAVE_FONTCONFIG #ifdef HAVE_FONTCONFIG
p_sys->psz_fontfamily = NULL; p_sys->psz_fontfamily = NULL;
p_sys->p_xml = NULL;
#endif #endif
p_sys->p_face = 0; p_sys->p_face = 0;
p_sys->p_library = 0; p_sys->p_library = 0;
...@@ -476,6 +478,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -476,6 +478,7 @@ static void Destroy( vlc_object_t *p_this )
#ifdef HAVE_FONTCONFIG #ifdef HAVE_FONTCONFIG
FontBuilderDetach( p_filter, p_sys->p_fontbuilder ); FontBuilderDetach( p_filter, p_sys->p_fontbuilder );
xml_Delete( p_sys->p_xml );
free( p_sys->psz_fontfamily ); free( p_sys->psz_fontfamily );
#endif #endif
...@@ -2286,7 +2289,6 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out, ...@@ -2286,7 +2289,6 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out,
{ {
int rv = VLC_SUCCESS; int rv = VLC_SUCCESS;
stream_t *p_sub = NULL; stream_t *p_sub = NULL;
xml_t *p_xml = NULL;
xml_reader_t *p_xml_reader = NULL; xml_reader_t *p_xml_reader = NULL;
if( !p_region_in || !p_region_in->psz_html ) if( !p_region_in || !p_region_in->psz_html )
...@@ -2301,12 +2303,12 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out, ...@@ -2301,12 +2303,12 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out,
true ); true );
if( p_sub ) if( p_sub )
{ {
p_xml = xml_Create( p_filter ); if( !p_filter->p_sys->p_xml ) p_filter->p_sys->p_xml = xml_Create( p_filter );
if( p_xml ) if( p_filter->p_sys->p_xml )
{ {
bool b_karaoke = false; bool b_karaoke = false;
p_xml_reader = xml_ReaderCreate( p_xml, p_sub ); p_xml_reader = xml_ReaderCreate( p_filter->p_sys->p_xml, p_sub );
if( p_xml_reader ) if( p_xml_reader )
{ {
/* Look for Root Node */ /* Look for Root Node */
...@@ -2330,7 +2332,7 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out, ...@@ -2330,7 +2332,7 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out,
{ {
/* Only text and karaoke tags are supported */ /* Only text and karaoke tags are supported */
msg_Dbg( p_filter, "Unsupported top-level tag '%s' ignored.", psz_node ); msg_Dbg( p_filter, "Unsupported top-level tag '%s' ignored.", psz_node );
xml_ReaderDelete( p_xml, p_xml_reader ); xml_ReaderDelete( p_filter->p_sys->p_xml, p_xml_reader );
p_xml_reader = NULL; p_xml_reader = NULL;
rv = VLC_EGENERIC; rv = VLC_EGENERIC;
} }
...@@ -2401,9 +2403,8 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out, ...@@ -2401,9 +2403,8 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out,
} }
FreeLines( p_lines ); FreeLines( p_lines );
xml_ReaderDelete( p_xml, p_xml_reader ); xml_ReaderDelete( p_filter->p_sys->p_xml, p_xml_reader );
} }
xml_Delete( p_xml );
} }
stream_Delete( p_sub ); stream_Delete( p_sub );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment