summaryrefslogtreecommitdiffstats
path: root/subreader.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-11-16 03:23:49 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-11-16 03:23:49 +0000
commit41db8e63dc93a08e969e74a7e123769d6361ddbc (patch)
tree4b2c8bde8fa6d01d514b0d5d8410f0b5152cf436 /subreader.c
parentd8b9a179e89f95eef1878ae824a9043c4acd93f7 (diff)
downloadmpv-41db8e63dc93a08e969e74a7e123769d6361ddbc.tar.bz2
mpv-41db8e63dc93a08e969e74a7e123769d6361ddbc.tar.xz
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
Diffstat (limited to 'subreader.c')
-rw-r--r--subreader.c12
1 files changed, 12 insertions, 0 deletions
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;