changeset 25813:ba7bd4f7e322

Add global ass_force_reload flag. If it is set, renderer is reconfigured before the next frame.
author eugeni
date Wed, 23 Jan 2008 21:18:30 +0000
parents 04773888ae2a
children 4ba9b9bdf123
files libass/ass_mp.c libass/ass_mp.h libmpcodecs/vf_ass.c libmpcodecs/vf_vo.c
diffstat 4 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libass/ass_mp.c	Wed Jan 23 21:10:15 2008 +0000
+++ b/libass/ass_mp.c	Wed Jan 23 21:18:30 2008 +0000
@@ -259,3 +259,15 @@
 	free(path);
 	return priv;
 }
+
+int ass_force_reload = 0; // flag set if global ass-related settings were changed
+
+ass_image_t* ass_mp_render_frame(ass_renderer_t *priv, ass_track_t* track, long long now, int* detect_change) {
+	if (ass_force_reload) {
+		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);
+		ass_force_reload = 0;
+	}
+	return ass_render_frame(priv, track, now, detect_change);
+}
--- a/libass/ass_mp.h	Wed Jan 23 21:10:15 2008 +0000
+++ b/libass/ass_mp.h	Wed Jan 23 21:18:30 2008 +0000
@@ -50,4 +50,7 @@
 	int changed;
 } mp_eosd_images_t;
 
+extern int ass_force_reload;
+ass_image_t* ass_mp_render_frame(ass_renderer_t *priv, ass_track_t* track, long long now, int* detect_change);
+
 #endif /* ASS_MP_H */
--- a/libmpcodecs/vf_ass.c	Wed Jan 23 21:10:15 2008 +0000
+++ b/libmpcodecs/vf_ass.c	Wed Jan 23 21:18:30 2008 +0000
@@ -326,7 +326,7 @@
 {
 	ass_image_t* images = 0;
 	if (sub_visibility && vf->priv->ass_priv && ass_track && (pts != MP_NOPTS_VALUE))
-		images = ass_render_frame(vf->priv->ass_priv, ass_track, (pts+sub_delay) * 1000 + .5, NULL);
+		images = ass_mp_render_frame(vf->priv->ass_priv, ass_track, (pts+sub_delay) * 1000 + .5, NULL);
 	
 	prepare_image(vf, mpi);
 	if (images) render_frame(vf, mpi, images);
--- a/libmpcodecs/vf_vo.c	Wed Jan 23 21:10:15 2008 +0000
+++ b/libmpcodecs/vf_vo.c	Wed Jan 23 21:18:30 2008 +0000
@@ -134,7 +134,7 @@
                 ass_set_aspect_ratio(vf->priv->ass_priv, (double)res.w / res.h);
             }
 
-            images.imgs = ass_render_frame(vf->priv->ass_priv, ass_track, (pts+sub_delay) * 1000 + .5, &images.changed);
+            images.imgs = ass_mp_render_frame(vf->priv->ass_priv, ass_track, (pts+sub_delay) * 1000 + .5, &images.changed);
             if (!vf->priv->prev_visibility)
                 images.changed = 2;
             vf->priv->prev_visibility = 1;