changeset 20706:6ae01628975f

Initialize fontconfig in VFCTRL_INIT_EOSD handler. Recent libass api changes moved fontconfig initialization to filter's config() function. It is bad, because cache update can take a long time, resulting in unpleasant sound effects. This change restores the original behaviour.
author eugeni
date Sun, 05 Nov 2006 18:56:31 +0000
parents 06145689880c
children a8d7e977ca8d
files libass/ass_mp.c libass/ass_mp.h libmpcodecs/vf_ass.c libmpcodecs/vf_vo.c
diffstat 4 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libass/ass_mp.c	Sun Nov 05 18:53:21 2006 +0000
+++ b/libass/ass_mp.c	Sun Nov 05 18:56:31 2006 +0000
@@ -211,12 +211,14 @@
 char *get_path(char *);
 
 void ass_configure(ass_renderer_t* priv, int w, int h) {
-	char *dir, *path, *family;
 	ass_set_frame_size(priv, w, h);
 	ass_set_margins(priv, ass_top_margin, ass_bottom_margin, 0, 0);
 	ass_set_use_margins(priv, ass_use_margins);
 	ass_set_font_scale(priv, ass_font_scale);
+}
 
+void ass_configure_fonts(ass_renderer_t* priv) {
+	char *dir, *path, *family;
 	dir = get_path("fonts");
 	if (!font_fontconfig && font_name) path = strdup(font_name);
 	else path = get_path("subfont.ttf");
--- a/libass/ass_mp.h	Sun Nov 05 18:53:21 2006 +0000
+++ b/libass/ass_mp.h	Sun Nov 05 18:56:31 2006 +0000
@@ -41,6 +41,7 @@
 ass_track_t* ass_read_subdata(ass_library_t* library, sub_data* subdata, double fps);
 
 void ass_configure(ass_renderer_t* priv, int w, int h);
+void ass_configure_fonts(ass_renderer_t* priv);
 ass_library_t* ass_init();
 
 #endif
--- a/libmpcodecs/vf_ass.c	Sun Nov 05 18:53:21 2006 +0000
+++ b/libmpcodecs/vf_ass.c	Sun Nov 05 18:56:31 2006 +0000
@@ -350,7 +350,9 @@
 	switch (request) {
 	case VFCTRL_INIT_EOSD:
 		vf->priv->ass_priv = ass_renderer_init((ass_library_t*)data);
-		return vf->priv->ass_priv ? CONTROL_TRUE : CONTROL_FALSE;
+		if (!vf->priv->ass_priv) return CONTROL_FALSE;
+		ass_configure_fonts(vf->priv->ass_priv);
+		return CONTROL_TRUE;
 	case VFCTRL_DRAW_EOSD:
 		if (vf->priv->ass_priv) return CONTROL_TRUE;
 		break;
--- a/libmpcodecs/vf_vo.c	Sun Nov 05 18:53:21 2006 +0000
+++ b/libmpcodecs/vf_vo.c	Sun Nov 05 18:56:31 2006 +0000
@@ -109,6 +109,7 @@
     {
         vf->priv->ass_priv = ass_renderer_init((ass_library_t*)data);
         if (!vf->priv->ass_priv) return CONTROL_FALSE;
+        ass_configure_fonts(vf->priv->ass_priv);
         return CONTROL_TRUE;
     }
     case VFCTRL_DRAW_EOSD: