[vlc-devel] commit: freetype: don't load/unload xml-module on every RenderHtml call ( Ilkka Ollakka )
git version control
git at videolan.org
Mon Aug 3 23:24:25 CEST 2009
vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Tue Aug 4 00:23:45 2009 +0300| [3c777414c489f7b1e9a62a800f5167cf87ccc70a] | committer: Ilkka Ollakka
freetype: don't load/unload xml-module on every RenderHtml call
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3c777414c489f7b1e9a62a800f5167cf87ccc70a
---
modules/misc/freetype.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/modules/misc/freetype.c b/modules/misc/freetype.c
index 5450bb7..0058a4b 100644
--- a/modules/misc/freetype.c
+++ b/modules/misc/freetype.c
@@ -270,6 +270,7 @@ struct filter_sys_t
char* psz_fontfamily;
bool b_fontconfig_ok;
FcConfig *p_fontconfig;
+ xml_t *p_xml;
#endif
input_attachment_t **pp_font_attachments;
@@ -311,6 +312,7 @@ static int Create( vlc_object_t *p_this )
return VLC_ENOMEM;
#ifdef HAVE_FONTCONFIG
p_sys->psz_fontfamily = NULL;
+ p_sys->p_xml = NULL;
#endif
p_sys->p_face = 0;
p_sys->p_library = 0;
@@ -476,6 +478,7 @@ static void Destroy( vlc_object_t *p_this )
#ifdef HAVE_FONTCONFIG
FontBuilderDetach( p_filter, p_sys->p_fontbuilder );
+ xml_Delete( p_sys->p_xml );
free( p_sys->psz_fontfamily );
#endif
@@ -2286,7 +2289,6 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out,
{
int rv = VLC_SUCCESS;
stream_t *p_sub = NULL;
- xml_t *p_xml = NULL;
xml_reader_t *p_xml_reader = NULL;
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,
true );
if( p_sub )
{
- p_xml = xml_Create( p_filter );
- if( p_xml )
+ if( !p_filter->p_sys->p_xml ) p_filter->p_sys->p_xml = xml_Create( p_filter );
+ if( p_filter->p_sys->p_xml )
{
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 )
{
/* Look for Root Node */
@@ -2330,7 +2332,7 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out,
{
/* Only text and karaoke tags are supported */
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;
rv = VLC_EGENERIC;
}
@@ -2401,9 +2403,8 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out,
}
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 );
}
More information about the vlc-devel
mailing list