[MPlayer-cvslog] r32512 - in trunk: ass_mp.c eosd.c eosd.h

cigaes subversion at mplayerhq.hu
Mon Oct 18 22:27:07 CEST 2010


Author: cigaes
Date: Mon Oct 18 22:27:07 2010
New Revision: 32512

Log:
Add a flag "initialized" to the mp_eosd_source structure.
Use it to always init the ASS source on new files.

Modified:
   trunk/ass_mp.c
   trunk/eosd.c
   trunk/eosd.h

Modified: trunk/ass_mp.c
==============================================================================
--- trunk/ass_mp.c	Mon Oct 18 17:00:17 2010	(r32511)
+++ trunk/ass_mp.c	Mon Oct 18 22:27:07 2010	(r32512)
@@ -327,11 +327,12 @@ static void eosd_ass_update(struct mp_eo
 	long long ts_ms = (ts + sub_delay) * 1000 + .5;
 	ASS_Image *aimg;
 	struct mp_eosd_image *img;
-	if (res->changed) {
+	if (res->changed || !src->initialized) {
 		double dar = (double) (res->w - res->ml - res->mr) / (res->h - res->mt - res->mb);
 		ass_configure(ass_renderer, res->w, res->h, res->unscaled);
 		ass_set_margins(ass_renderer, res->mt, res->mb, res->ml, res->mr);
 		ass_set_aspect_ratio(ass_renderer, dar, (double)res->srcw / res->srch);
+		src->initialized = 1;
 	}
 	aimg = sub_visibility && ass_track && ts != MP_NOPTS_VALUE ?
 		ass_mp_render_frame(ass_renderer, ass_track, ts_ms, &src->changed) :

Modified: trunk/eosd.c
==============================================================================
--- trunk/eosd.c	Mon Oct 18 17:00:17 2010	(r32511)
+++ trunk/eosd.c	Mon Oct 18 22:27:07 2010	(r32512)
@@ -42,6 +42,7 @@ void eosd_register(struct mp_eosd_source
         prev = &p->priv_next;
     src->priv_next = p;
     *prev          = src;
+    src->initialized = 0;
 }
 
 int eosd_registered(struct mp_eosd_source *source)
@@ -87,9 +88,12 @@ void eosd_render_frame(double ts, struct
 void eosd_uninit(void)
 {
     struct mp_eosd_source *src;
-    for (src = sources; src; src = src->priv_next)
+    for (src = sources; src; src = src->priv_next) {
+        // TODO: maybe only call if src->initialized is set.
         if (src->uninit)
             src->uninit(src);
+        src->initialized = 0;
+    }
 }
 
 struct mp_eosd_image *eosd_image_alloc(void)

Modified: trunk/eosd.h
==============================================================================
--- trunk/eosd.h	Mon Oct 18 17:00:17 2010	(r32511)
+++ trunk/eosd.h	Mon Oct 18 22:27:07 2010	(r32512)
@@ -91,6 +91,13 @@ struct mp_eosd_source {
      */
     int z_index;
 
+    /**
+     * Initialized flag of the source.
+     * Set by the source, automatically cleared when a source is added,
+     * removed or reinitialized.
+     */
+    int initialized;
+
     struct mp_eosd_source *priv_next;
 };
 


More information about the MPlayer-cvslog mailing list