[MPlayer-dev-eng] [PATCH] automatic text subtitle alignment

Oskar Liljeblad oskar at osk.mine.nu
Sat Sep 14 21:44:12 CEST 2002


Hello,

This patch fixes the alignment of text subtitles when they
have been moved up a bit (i.e. sub_pos decreased by pressing
the R key). The current behaviour is to top align subtitles
when sub_pos != 100 (i.e. when subtitles are not in the
bottommost, default position).

If you don't understand what I mean by top or bottom alignment,
play a movie with text subtitles that are both one and two rows.
Press R a couple of times to move the subtitles just a bit up
(say 50 pixels). Watch as a two-row subtitle appears. And then
watch when it changes to a single-row subtitle. The text
appears on the top row compared to the two-row subtitles:

 +-------------+   +-------------+
 |             |   |             |
 |             |   |             |
 |  Blah blah  |   |   Okey...   |
 |  Bloh bloh  |   |             |
 +-------------+   +-------------+

This is not normal, unless you intend to display subtitles above
the screen. The simple patch makes it so that when subtitles are
on the bottom half of the screen, they are always bottom-aligned.
Otherwise they are top-aligned. Let me know what you think about
it.

Oskar Liljeblad (oskar at osk.mine.nu)
-------------- next part --------------
--- MPlayer-0.90pre7/libvo/sub.c	2002-08-28 22:45:42.000000000 +0200
+++ MPlayer-0.90pre7-oskar/libvo/sub.c	2002-09-14 21:24:04.000000000 +0200
@@ -391,7 +391,10 @@
 	  }
       }
 
-    if (obj->y >= (dys * sub_pos / 100)){
+    if (sub_pos >= 50){
+    	obj->y -= dys * (100-sub_pos) / 100;
+    }
+    else if (obj->y >= (dys * sub_pos / 100)){   
 	int old=obj->y;
 	obj->y = dys * sub_pos /100;
 	obj->bbox.y2-=old-obj->y;


More information about the MPlayer-dev-eng mailing list