[Mplayer-cvslog] CVS: main subreader.c,1.76,1.77

Arpi of Ize arpi at mplayerhq.hu
Sat Nov 16 04:23:52 CET 2002


Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv28939

Modified Files:
	subreader.c 
Log Message:
allow max 0.2s overlapping without splitting subs
patch by salvatore.falco at katamail.com


Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- subreader.c	6 Nov 2002 23:54:21 -0000	1.76
+++ subreader.c	16 Nov 2002 03:23:49 -0000	1.77
@@ -925,6 +925,7 @@
 	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 @@
 		}
 		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;




More information about the MPlayer-cvslog mailing list