[Mplayer-cvslog] CVS: main subreader.h,1.12,1.13 subreader.c,1.57,1.58

pl pl at mplayerhq.hu
Tue May 7 23:58:04 CEST 2002


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

Modified Files:
	subreader.h subreader.c 
Log Message:
patch by Didier <did-c-debian at ifrance.com>:
 - subviewer 2.0 support


Index: subreader.h
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- subreader.h	9 Jan 2002 16:35:24 -0000	1.12
+++ subreader.h	7 May 2002 21:58:01 -0000	1.13
@@ -17,6 +17,7 @@
 #define SUB_DUNNOWHAT 7		// FIXME what format is it ?
 #define SUB_MPSUB     8
 #define SUB_AQTITLE   9
+#define SUB_SUBVIEWER2 10
 
 // One of the SUB_* constant above
 extern int sub_format;

Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- subreader.c	5 May 2002 21:33:13 -0000	1.57
+++ subreader.c	7 May 2002 21:58:01 -0000	1.58
@@ -252,6 +252,39 @@
     return current;
 }
 
+subtitle *sub_read_line_subviewer2(FILE *fd,subtitle *current) {
+    char line[LINE_LEN+1];
+    int a1,a2,a3,a4;
+    char *p=NULL;
+    int i,len;
+   
+    while (!current->text[0]) {
+        if (!fgets (line, LINE_LEN, fd)) return NULL;
+	if (line[0]!='{')
+	    continue;
+        if ((len=sscanf (line, "{T %d:%d:%d:%d",&a1,&a2,&a3,&a4)) < 4)
+            continue;
+        current->start = a1*360000+a2*6000+a3*100+a4/10;
+        for (i=0; i<SUB_MAX_TEXT;) {
+            if (!fgets (line, LINE_LEN, fd)) break;
+            if (line[0]=='}') break;
+            len=0;
+            for (p=line; *p!='\n' && *p!='\r' && *p; ++p,++len);
+            if (len) {
+                current->text[i]=(char *)malloc (len+1);
+                if (!current->text[i]) return ERR;
+                strncpy (current->text[i], line, len); current->text[i][len]='\0';
+                ++i;
+            } else {
+                break;
+            }
+        }
+        current->lines=i;
+    }
+    return current;
+}
+
+
 subtitle *sub_read_line_vplayer(FILE *fd,subtitle *current) {
 	char line[LINE_LEN+1];
 	int a1,a2,a3;
@@ -491,6 +524,8 @@
 		{sub_uses_time=1;return SUB_SUBRIP;}
 	if (sscanf (line, "%d:%d:%d,%d --> %d:%d:%d,%d", &i, &i, &i, &i, &i, &i, &i, &i)==8)
 		{sub_uses_time=1;return SUB_SUBVIEWER;}
+	if (sscanf (line, "{T %d:%d:%d:%d",&i, &i, &i, &i))
+		{sub_uses_time=1;return SUB_SUBVIEWER2;}
 	if (strstr (line, "<SAMI>"))
 		{sub_uses_time=1; return SUB_SAMI;}
 	if (sscanf (line, "%d:%d:%d:",     &i, &i, &i )==3)
@@ -626,7 +661,7 @@
     int n_max;
     subtitle *first;
     char *fmtname[] = { "microdvd", "subrip", "subviewer", "sami", "vplayer",
-		        "rt", "ssa", "dunnowhat", "mpsub", "aqt" };
+		        "rt", "ssa", "dunnowhat", "mpsub", "aqt", "subviewer 2.0" };
     subtitle * (*func[])(FILE *fd,subtitle *dest)=
     {
 	    sub_read_line_microdvd,
@@ -638,7 +673,8 @@
 	    sub_read_line_ssa,
 	    sub_read_line_dunnowhat,
 	    sub_read_line_mpsub,
-	    sub_read_line_aqt
+	    sub_read_line_aqt,
+	    sub_read_line_subviewer2
 
     };
     if(filename==NULL) return NULL; //qnx segfault




More information about the MPlayer-cvslog mailing list