[Mplayer-cvslog] CVS: main subreader.c,1.29,1.30

Arpi of Ize arpi at mplayer.dev.hu
Sun Oct 21 19:20:26 CEST 2001


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

Modified Files:
	subreader.c 
Log Message:
AQT type support patch by Jiri.Svoboda at seznam.cz

Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- subreader.c	12 Oct 2001 16:21:55 -0000	1.29
+++ subreader.c	21 Oct 2001 17:19:59 -0000	1.30
@@ -37,6 +37,7 @@
 		 // 6 for ssa (Sub Station Alpha)
 		// 7 for ... erm ... dunnowhat. tell me if you know
 	       // 8 for the glorious MPsub
+	      // 9 for AQTitle
 
 int eol(char p) {
     return (p=='\r' || p=='\n' || p=='\0');
@@ -49,6 +50,7 @@
 	while (i > 0 && isspace(s[i])) s[i--] = '\0';
 }
 
+
 subtitle *sub_read_line_sami(FILE *fd, subtitle *current) {
     static char line[1001];
     static char *s = NULL;
@@ -406,6 +408,47 @@
 	}
 }
 
+subtitle *previous_aqt_sub = NULL;
+
+subtitle *sub_read_line_aqt(FILE *fd,subtitle *current) {
+    char line[1001];
+
+    bzero (current, sizeof(subtitle));
+
+    while (1) {
+    // try to locate next subtitle
+        if (!fgets (line, 1000, fd))
+		return NULL;
+        if (!(sscanf (line, "-->> %ld", &(current->start)) <1))
+		break;
+    }
+    
+    if (previous_aqt_sub != NULL) 
+	previous_aqt_sub->end = current->start-1;
+    
+    previous_aqt_sub = current;
+
+    if (!fgets (line, 1000, fd))
+	return NULL;
+
+    sub_readtext(&line,&current->text[0]);
+    current->lines = 1;
+    current->end = current->start; // will be corrected by next subtitle
+
+    if (!fgets (line, 1000, fd))
+	return current;;
+
+    sub_readtext(&line,&current->text[1]);
+    current->lines = 2;
+
+    if ((current->text[0]=="") && (current->text[1]=="")) {
+	// void subtitle -> end of previous marked and exit
+	previous_aqt_sub = NULL;
+	return NULL;
+	}
+
+    return current;
+}
 
 int sub_autodetect (FILE *fd) {
     char line[1001];
@@ -444,6 +487,8 @@
 		{sub_uses_time=0; return 8;}
 	if (sscanf (line, "FORMAT=TIM%c", &p)==1 && p=='E')
 		{sub_uses_time=1; return 8;}
+	if (strstr (line, "-->>"))
+		{sub_uses_time=0; return 9;}
     }
 
     return -1;  // too many bad lines
@@ -530,7 +575,9 @@
 	    sub_read_line_rt,
 	    sub_read_line_ssa,
 	    sub_read_line_dunnowhat,
-	    sub_read_line_mpsub
+	    sub_read_line_mpsub,
+	    sub_read_line_aqt
+
     };
 
     fd=fopen (filename, "r"); if (!fd) return NULL;
@@ -612,7 +659,9 @@
     ".txt",
     ".TXT",
     ".ssa",
-    ".SSA"};
+    ".SSA",
+    ".aqt",
+    ".AQT"};
 
 
  if ( fname == NULL ) return NULL;




More information about the MPlayer-cvslog mailing list