overlapping subtitles support is now optional, can be disabled (-nooverlapsub)

patch by Salvatore Falco <sfalco@studenti.ing.uniroma1.it>


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8362 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2002-12-05 00:03:35 +00:00
parent 7228f67795
commit 268b2c1a0f
8 changed files with 36 additions and 3 deletions

View File

@ -774,6 +774,9 @@ If FreeType support is enabled, the old font support can't be used.
.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).

View File

@ -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},

View File

@ -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;

View File

@ -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));

View File

@ -162,6 +162,7 @@ float sub_delay=0;
float sub_fps=0;
int sub_auto = 0;
int subcc_enabled=0;
int suboverlap_enabled = 1;
#ifdef USE_SUB
static subtitle* subtitles=NULL;

View File

@ -256,6 +256,7 @@ int sub_auto = 1;
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;

View File

@ -1048,7 +1048,7 @@ subtitle* sub_read_file (char *filename, float fps) {
}
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 @@ subtitle* sub_read_file (char *filename, float fps) {
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 @@ subtitle* sub_read_file (char *filename, float fps) {
}
return second;
} else { //if(suboverlap_enabled)
adjust_subs_time(first, 6.0, fps, 1); /* ~6 secs AST */
return first;
}
}
#if 0

View File

@ -4,6 +4,7 @@
extern int sub_uses_time;
extern int sub_errs;
extern int sub_num; // number of subtitle structs
extern int suboverlap_enabled;
// subtitle formats
#define SUB_INVALID -1