changeset 19517:2f5e66e7bdcc

Simplify vf_ass initialization.
author eugeni
date Thu, 24 Aug 2006 15:36:20 +0000
parents 9df2338c33f1
children 4440aa9939dc
files libass/ass_render.c libmpcodecs/vf_ass.c
diffstat 2 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libass/ass_render.c	Thu Aug 24 01:01:37 2006 +0000
+++ b/libass/ass_render.c	Thu Aug 24 15:36:20 2006 +0000
@@ -178,20 +178,20 @@
 	if (family) free(family);
 
 	if (!fc_priv)
-		return 0;
+		goto ass_init_exit;
 	
 	error = FT_Init_FreeType( &ft );
 	if ( error ) { 
 		mp_msg(MSGT_GLOBAL, MSGL_FATAL, "FT_Init_FreeType failed\n");
 		fontconfig_done(fc_priv);
-		return 0;
+		goto ass_init_exit;
 	}
 
 	priv = calloc(1, sizeof(ass_instance_t));
 	if (!priv) {
 		FT_Done_FreeType(ft);
 		fontconfig_done(fc_priv);
-		return 0;
+		goto ass_init_exit;
 	}
 	priv->library = ft;
 	priv->fontconfig_priv = fc_priv;
@@ -202,6 +202,10 @@
 
 	text_info.glyphs = calloc(MAX_GLYPHS, sizeof(glyph_info_t));
 	
+ass_init_exit:
+	if (priv) mp_msg(MSGT_GLOBAL, MSGL_INFO, "[ass] Init\n");
+	else mp_msg(MSGT_GLOBAL, MSGL_ERR, "[ass] Init failed\n");
+
 	return priv;
 }
 
--- a/libmpcodecs/vf_ass.c	Thu Aug 24 01:01:37 2006 +0000
+++ b/libmpcodecs/vf_ass.c	Thu Aug 24 15:36:20 2006 +0000
@@ -357,12 +357,7 @@
 {
 	if (request == VFCTRL_EOSD) {
 		vf->priv->ass_priv = ass_init();
-		if (!vf->priv->ass_priv) {
-			mp_msg(MSGT_VFILTER, MSGL_ERR, "[ass] Init failed\n");
-			return 0;
-		} else
-			mp_msg(MSGT_VFILTER, MSGL_INFO, "[ass] Init\n");
-		return CONTROL_TRUE;
+		return vf->priv->ass_priv ? CONTROL_TRUE : CONTROL_FALSE;
 	}
 	return vf_next_control(vf, request, data);
 }