From 268b2c1a0f689af9ea58336368286c1f5e1f3f72 Mon Sep 17 00:00:00 2001 From: arpi Date: Thu, 5 Dec 2002 00:03:35 +0000 Subject: overlapping subtitles support is now optional, can be disabled (-nooverlapsub) patch by Salvatore Falco git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8362 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/sub.c | 22 +++++++++++++++++++++- libvo/sub.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'libvo') diff --git a/libvo/sub.c b/libvo/sub.c index 67003cf9a1..075431df5e 100644 --- a/libvo/sub.c +++ b/libvo/sub.c @@ -351,7 +351,20 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ lastk=k; lastStripPosition=j; lastxsize=xsize; - } else if ((font=vo_font->font[c])>=0){ + } else if ((!suboverlap_enabled) && ((font = vo_font->font[c]) >= 0)) { + /* + With overlapping subtitles, we need to comment this out, + beacuse that part of the code creates subtitles with the + last line blank (" "): in this case previous 'if' statement + is false an following 'if' is not executed. When, instead, + a subtitle with a non-blank last line arrives, the following + code is executed, and the result is a small 'jump' of the + subtiles. We can not simply delete the following, unless + having the last subtitle line partly drawn outside the + screen, so, some lines forward, we introduce an increment + which affects both blank and non-blank lines. + *sfalco* + */ if (vo_font->pic_a[font]->h > h){ h=vo_font->pic_a[font]->h; } @@ -396,6 +409,13 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ } } + /* + Here is the little increment we talked about before. '40' is the + ASCII code for '(', which, hopefully, is the highest char of the + font. + *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; diff --git a/libvo/sub.h b/libvo/sub.h index 5646535f42..ead5a131ff 100644 --- a/libvo/sub.h +++ b/libvo/sub.h @@ -98,6 +98,7 @@ extern char *sub_cp; #endif extern int sub_pos; extern int sub_visibility; +extern int suboverlap_enabled; //extern void vo_draw_text_osd(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); //extern void vo_draw_text_progbar(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); -- cgit v1.2.3