[MPlayer-cvslog] r35217 - in trunk/sub: ass_mp.c ass_mp.h

reimar subversion at mplayerhq.hu
Wed Sep 26 22:16:38 CEST 2012


Author: reimar
Date: Wed Sep 26 22:16:38 2012
New Revision: 35217

Log:
Set ass margins only from one single locations.

This fixes the different settings from e.g. vo and -ass-margin options
fighting against each other.
To allow this to work, apply the global option values on top of
the vo values.
If this is the most desirable behaviour is up to discussion,
but it seems reasonable and is the easiest way to solve this.

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

Modified: trunk/sub/ass_mp.c
==============================================================================
--- trunk/sub/ass_mp.c	Wed Sep 26 22:05:00 2012	(r35216)
+++ trunk/sub/ass_mp.c	Wed Sep 26 22:16:38 2012	(r35217)
@@ -260,7 +260,6 @@ ASS_Track* ass_read_stream(ASS_Library* 
 static void ass_configure(ASS_Renderer* priv, int w, int h, int unscaled) {
 	int hinting;
 	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);
 	if (!unscaled && (ass_hinting & 4))
@@ -325,16 +324,6 @@ ASS_Library* ass_init(void) {
 
 int ass_force_reload = 0; // flag set if global ass-related settings were changed
 
-ASS_Image* ass_mp_render_frame(ASS_Renderer *priv, ASS_Track* 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);
-}
-
 /* EOSD source for ASS subtitles. */
 
 static ASS_Renderer *ass_renderer;
@@ -345,15 +334,16 @@ 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 || !src->initialized) {
+	if (res->changed || !src->initialized || ass_force_reload) {
 		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_margins(ass_renderer, res->mt + ass_top_margin, res->mb + ass_bottom_margin, res->ml, res->mr);
 		ass_set_aspect_ratio(ass_renderer, dar, (double)res->srcw / res->srch);
 		src->initialized = 1;
+		ass_force_reload = 0;
 	}
 	aimg = sub_visibility && ass_track && ts != MP_NOPTS_VALUE ?
-		ass_mp_render_frame(ass_renderer, ass_track, ts_ms, &src->changed) :
+		ass_render_frame(ass_renderer, ass_track, ts_ms, &src->changed) :
 		NULL;
 	if (!aimg != !src->images)
 		src->changed = 2;

Modified: trunk/sub/ass_mp.h
==============================================================================
--- trunk/sub/ass_mp.h	Wed Sep 26 22:05:00 2012	(r35216)
+++ trunk/sub/ass_mp.h	Wed Sep 26 22:16:38 2012	(r35217)
@@ -59,7 +59,6 @@ typedef struct {
 } EOSD_ImageList;
 
 extern int ass_force_reload;
-ASS_Image* ass_mp_render_frame(ASS_Renderer *priv, ASS_Track* track, long long now, int* detect_change);
 
 /**
  * Initialize the use of EOSD for ASS subtitles rendering.


More information about the MPlayer-cvslog mailing list