Fix multiple appearing or appearing+disappearing subs in the same frame

in non-ASS mode. The latter is common (old sub replaced by new) and 
resulted in an incorrect frame where both appeared simultaneously.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22162 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
uau 2007-02-06 00:18:35 +00:00
parent d524405f5c
commit b5c470a029
1 changed files with 5 additions and 6 deletions

View File

@ -2966,17 +2966,14 @@ static void update_subtitles(void)
} else if (dvdsub_id >= 0 && type == 't') { } else if (dvdsub_id >= 0 && type == 't') {
static subtitle subs; static subtitle subs;
double curpts = sh_video->pts + sub_delay; double curpts = sh_video->pts + sub_delay;
double pts = MP_NOPTS_VALUE;
double endpts; double endpts;
vo_sub = &subs; vo_sub = &subs;
while (d_dvdsub->first) { while (d_dvdsub->first) {
double nextpts = ds_get_next_pts(d_dvdsub); double pts = ds_get_next_pts(d_dvdsub);
if (nextpts == MP_NOPTS_VALUE || nextpts > curpts) if (pts > curpts)
break; break;
endpts = d_dvdsub->first->endpts; endpts = d_dvdsub->first->endpts;
len = ds_get_packet_sub(d_dvdsub, &packet); len = ds_get_packet_sub(d_dvdsub, &packet);
pts = nextpts;
}
#ifdef USE_ASS #ifdef USE_ASS
if (ass_enabled) { if (ass_enabled) {
static ass_track_t *global_ass_track = NULL; static ass_track_t *global_ass_track = NULL;
@ -2998,7 +2995,9 @@ static void update_subtitles(void)
sub_clear_text(&subs, MP_NOPTS_VALUE); sub_clear_text(&subs, MP_NOPTS_VALUE);
sub_add_text(&subs, packet, len, endpts); sub_add_text(&subs, packet, len, endpts);
vo_osd_changed(OSDTYPE_SUBTITLE); vo_osd_changed(OSDTYPE_SUBTITLE);
} else if (sub_clear_text(&subs, curpts)) }
}
if (sub_clear_text(&subs, curpts))
vo_osd_changed(OSDTYPE_SUBTITLE); vo_osd_changed(OSDTYPE_SUBTITLE);
} }
current_module=NULL; current_module=NULL;