[Mplayer-cvslog] CVS: main subreader.c,1.45,1.46

Adam Tla/lka atlka at mplayer.dev.hu
Tue Jan 8 12:03:46 CET 2002


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

Modified Files:
	subreader.c 
Log Message:
changed subreader.c to read microdvd lines in form "{%ld}{}[^\r\n]" too


Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- subreader.c	1 Jan 2002 01:11:31 -0000	1.45
+++ subreader.c	8 Jan 2002 11:03:43 -0000	1.46
@@ -171,12 +171,19 @@
     char *p, *next;
     int i;
 
+static subtitle *prevsub = NULL;
+
     memset(current, 0, sizeof(subtitle));
 
     do {
 	if (!fgets (line, LINE_LEN, fd)) return NULL;
-    } while (sscanf (line, "{%ld}{%ld}%[^\r\n]", &(current->start), &(current->end),line2) <3);
-
+    } while ((sscanf (line,
+		      "{%ld}{}%[^\r\n]",
+		      &(current->start), line2) < 2) &&
+	     (sscanf (line,
+		      "{%ld}{%ld}%[^\r\n]",
+		      &(current->start), &(current->end), line2) < 3));
+	
     p=line2;
 
     next=p, i=0;
@@ -187,6 +194,14 @@
     }
     current->lines= ++i;
 
+    if (!current->end)
+	current->end = current->start + 150; /* approx 6 sec */
+
+    if (prevsub && (prevsub->end >= current->start))
+	prevsub->end = current->start - 1; /* correct previous end time */
+
+    prevsub = current;
+	
     return current;
 }
 




More information about the MPlayer-cvslog mailing list