[vlc-devel] commit: freetype: don't load/unload xml-module on every RenderHtml call ( Ilkka Ollakka )
git version control
git at videolan.org
Sun Dec 6 19:07:26 CET 2009
vlc | branch: 1.0-bugfix | Ilkka Ollakka <ileoo at videolan.org> | Tue Aug 4 00:23:45 2009 +0300| [e975a9a21a1258b85b7bf7c6c1b2452216c1ced3] | committer: Ilkka Ollakka
freetype: don't load/unload xml-module on every RenderHtml call
hand cherry-picked from 3c777414c489f7b1e9a62a800f5167cf87ccc70a
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e975a9a21a1258b85b7bf7c6c1b2452216c1ced3
---
modules/misc/freetype.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/modules/misc/freetype.c b/modules/misc/freetype.c
index 9a8e74e..899bba2 100644
--- a/modules/misc/freetype.c
+++ b/modules/misc/freetype.c
@@ -265,6 +265,7 @@ struct filter_sys_t
#ifdef HAVE_FONTCONFIG
bool b_fontconfig_ok;
FcConfig *p_fontconfig;
+ xml_t *p_xml;
#endif
input_attachment_t **pp_font_attachments;
@@ -296,6 +297,9 @@ static int Create( vlc_object_t *p_this )
p_filter->p_sys = p_sys = malloc( sizeof( filter_sys_t ) );
if( !p_sys )
return VLC_ENOMEM;
+ #ifdef HAVE_FONTCONFIG
+ p_sys->p_xml = NULL;
+#endif
p_sys->p_face = 0;
p_sys->p_library = 0;
p_sys->i_font_size = 0;
@@ -2230,7 +2234,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 )
@@ -2245,12 +2248,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 */
@@ -2274,7 +2277,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;
}
@@ -2345,9 +2348,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