From 41db8e63dc93a08e969e74a7e123769d6361ddbc Mon Sep 17 00:00:00 2001 From: arpi Date: Sat, 16 Nov 2002 03:23:49 +0000 Subject: [PATCH] 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 --- subreader.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/subreader.c b/subreader.c index 540415e461..764448c01a 100644 --- a/subreader.c +++ b/subreader.c @@ -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;