Mercurial > mplayer.hg
changeset 8361:2202c00001e3
overlapping subtitles support is now optional, can be disabled (-nooverlapsub)
patch by Salvatore Falco <sfalco@studenti.ing.uniroma1.it>
author | arpi |
---|---|
date | Thu, 05 Dec 2002 00:03:35 +0000 |
parents | ad75993b8deb |
children | b5478134c853 |
files | DOCS/mplayer.1 cfg-common.h libvo/sub.c libvo/sub.h mencoder.c mplayer.c subreader.c subreader.h |
diffstat | 8 files changed, 36 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/DOCS/mplayer.1 Wed Dec 04 23:58:38 2002 +0000 +++ b/DOCS/mplayer.1 Thu Dec 05 00:03:35 2002 +0000 @@ -774,6 +774,9 @@ .B \-noautosub Turns off automatic loading of subtitle files. .TP +.B \-nooverlapsub +Turns off support for overlapping subtitles. +.TP .B \-osdlevel <0\-2> (MPLAYER only) Specifies which mode the OSD should start in (0: none, 1: seek, 2: seek+timer, default is 1).
--- a/cfg-common.h Wed Dec 04 23:58:38 2002 +0000 +++ b/cfg-common.h Thu Dec 05 00:03:35 2002 +0000 @@ -180,6 +180,7 @@ {"ifo", &spudec_ifo, CONF_TYPE_STRING, 0, 0, 0, NULL}, // enable Closed Captioning display {"subcc", &subcc_enabled, CONF_TYPE_FLAG, 0, 0, 1, NULL}, + {"nooverlapsub", &suboverlap_enabled, CONF_TYPE_FLAG, 0, 0, 0, NULL}, #endif #ifdef USE_OSD {"font", &font_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
--- a/libvo/sub.c Wed Dec 04 23:58:38 2002 +0000 +++ b/libvo/sub.c Thu Dec 05 00:03:35 2002 +0000 @@ -351,7 +351,20 @@ 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 @@ } } + /* + 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;
--- a/libvo/sub.h Wed Dec 04 23:58:38 2002 +0000 +++ b/libvo/sub.h Thu Dec 05 00:03:35 2002 +0000 @@ -98,6 +98,7 @@ #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));
--- a/mencoder.c Wed Dec 04 23:58:38 2002 +0000 +++ b/mencoder.c Thu Dec 05 00:03:35 2002 +0000 @@ -162,6 +162,7 @@ float sub_fps=0; int sub_auto = 0; int subcc_enabled=0; +int suboverlap_enabled = 1; #ifdef USE_SUB static subtitle* subtitles=NULL;
--- a/mplayer.c Wed Dec 04 23:58:38 2002 +0000 +++ b/mplayer.c Thu Dec 05 00:03:35 2002 +0000 @@ -256,6 +256,7 @@ char *vobsub_name=NULL; /*DSP!!char *dsp=NULL;*/ int subcc_enabled=0; +int suboverlap_enabled = 1; #ifdef USE_SUB subtitle* subtitles=NULL; float sub_last_pts = -303;
--- a/subreader.c Wed Dec 04 23:58:38 2002 +0000 +++ b/subreader.c Thu Dec 05 00:03:35 2002 +0000 @@ -1048,7 +1048,7 @@ } adjust_subs_time(first, 6.0, fps, 0); /* ~6 secs AST */ - +if(suboverlap_enabled){ // here we manage overlapping subtitles sub_orig = sub_num; n_first = sub_num; @@ -1057,7 +1057,7 @@ second = NULL; // for each subtitle in first[] for (sub_first = 0; sub_first < n_first; ++sub_first) { - while (first[sub_first].start <= first[sub_first].end) { + while (first[sub_first].start < first[sub_first].end) { unsigned long end_time = first[sub_first].end; int lines_to_add = 0, sub_to_add, event, ls, lf; @@ -1144,6 +1144,11 @@ } return second; +} else { //if(suboverlap_enabled) + adjust_subs_time(first, 6.0, fps, 1); /* ~6 secs AST */ + + return first; +} } #if 0