[Mplayer-cvslog] CVS: main/libvo sub.c,1.60,1.61 sub.h,1.22,1.23
Arpi of Ize
arpi at mplayerhq.hu
Mon Dec 23 02:37:46 CET 2002
- Previous message: [Mplayer-cvslog] CVS: main/input input.c,1.64,1.65 input.h,1.28,1.29
- Next message: [Mplayer-cvslog] CVS: main mplayer.c,1.630,1.631 vobsub.c,1.24,1.25 vobsub.h,1.8,1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv15998/libvo
Modified Files:
sub.c sub.h
Log Message:
This patch adds support for vertical subtitle alignment
control. Possible values are top, center, and bottom,
with bottom being the default. Alignment is relevant when
it comes to positioning subtitles with one line (or fewer
lines) of text relative to multi-line subtitles.
It is implemented as a new command (sub_alignment) that
without an argument cycles the alignment (between top,
center, and bottom), or with an argument sets the
alignment (0 for top, 1 for center, 2 for bottom).
The key 'i' is bound to this command.
patch by Oskar Liljeblad (oskar at osk.mine.nu)
Index: sub.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/sub.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- sub.c 14 Dec 2002 17:56:14 -0000 1.60
+++ sub.c 23 Dec 2002 01:37:43 -0000 1.61
@@ -37,6 +37,7 @@
int sub_unicode=0;
int sub_utf8=0;
int sub_pos=100;
+int sub_alignment=2; /* 0=top, 1=center, 2=bottom */
int sub_visibility=1;
// return the real height of a char:
@@ -418,12 +419,22 @@
*sfalco*
*/
if(suboverlap_enabled) obj->y -= vo_font->pic_a[vo_font->font[40]]->h - vo_font->height;
- if (obj->y >= (dys * sub_pos / 100)){
- int old=obj->y;
- obj->y = dys * sub_pos /100;
- obj->bbox.y2-=old-obj->y;
- }
-
+
+ h = dys - obj->y;
+ if (sub_alignment == 2)
+ obj->y = dys * sub_pos / 100 - h;
+ else if (sub_alignment == 1)
+ obj->y = dys * sub_pos / 100 - h / 2;
+ else
+ obj->y = dys * sub_pos / 100;
+
+ if (obj->y < 0)
+ obj->y = 0;
+ if (obj->y > dys - h)
+ obj->y = dys - h;
+
+ obj->bbox.y2 = obj->y + h;
+
// calculate bbox:
obj->bbox.x1=xmin;
obj->bbox.x2=xmax;
Index: sub.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/sub.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- sub.h 5 Dec 2002 00:03:35 -0000 1.22
+++ sub.h 23 Dec 2002 01:37:43 -0000 1.23
@@ -97,6 +97,7 @@
extern char *sub_cp;
#endif
extern int sub_pos;
+extern int sub_alignment;
extern int sub_visibility;
extern int suboverlap_enabled;
- Previous message: [Mplayer-cvslog] CVS: main/input input.c,1.64,1.65 input.h,1.28,1.29
- Next message: [Mplayer-cvslog] CVS: main mplayer.c,1.630,1.631 vobsub.c,1.24,1.25 vobsub.h,1.8,1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the MPlayer-cvslog
mailing list