1
mirror of https://github.com/mpv-player/mpv synced 2025-01-05 03:06:28 +01:00

allow max 0.2s overlapping without splitting subs

patch by salvatore.falco@katamail.com


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8207 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2002-11-16 03:23:49 +00:00
parent d8b9a179e8
commit 41db8e63dc

View File

@ -925,6 +925,7 @@ static void adjust_subs_time(subtitle* sub, float subtime, float fps, int block)
subtitle* nextsub;
int i = sub_num;
unsigned long subfms = (sub_uses_time ? 100 : fps) * subtime;
unsigned long overlap = (sub_uses_time ? 100 : fps) / 5; // 0.2s
n=m=0;
if (i) for (;;){
@ -936,6 +937,17 @@ static void adjust_subs_time(subtitle* sub, float subtime, float fps, int block)
}
if (!--i) break;
nextsub = sub + 1;
if(!block){
if ((sub->end > nextsub->start) && (sub->end <= nextsub->start + overlap)) {
// these subtitles overlap for less than 0.2 seconds
// and would result in very short overlapping subtitle
// so let's fix the problem here, before overlapping code
// get its hands on them
unsigned delta = sub->end - nextsub->start, half = delta / 2;
sub->end -= half + 1;
nextsub->start += delta - half;
}
}
if (block){
if (sub->end >= nextsub->start){
sub->end = nextsub->start - 1;