[MPlayer-dev-eng] [PATCH] JACOSub subtitle format

Salvatore Falco sfalco at studenti.ing.uniroma1.it
Wed Apr 3 17:35:51 CEST 2002


These are two patches to add JACOSub support to mplayer (version 0.60).
JACOSub is another subtitling format, whose specifications are at:
http://unicorn.us.com/jacosub
These patches support only displaying of the subtitles and breaking lines
(such as <BR> in html), since I don't know if MPlayer subtitle system
supports other features (such as raised / colored text and so on).



--- subreader.c	Wed Apr  3 16:47:01 2002
+++ subreader.c-old	Tue Jan  1 02:11:31 2002
@@ -481,55 +481,6 @@
     return current;
 }

-subtitle *sub_read_line_jacosub(FILE *fd,subtitle *current) {
-    char line[LINE_LEN+1];
-    char line2[LINE_LEN+1];
-    char garbage[LINE_LEN+1];
-    char garbage2[LINE_LEN+1];
-    int a1,a2,a3,a4,b1,b2,b3,b4, len, count;
-    char *p=NULL, *q=NULL, *r=NULL;
-
-
-    bzero (current, sizeof(subtitle));
-    while (1) {
-	if (!fgets (line, 1000, fd)) return NULL;
-	if (sscanf (line, "%d:%d:%d.%d %d:%d:%d.%d",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4) < 8) continue;
-	p=line;
-	while((*p)!='}') p++;
-	p++ ;
-	p++ ;
-	q = p;
-	r = line2 ;
-	len = 0 ;
-
-    	while( ((*p)!='\n') && ((*p)!='\r') ){
-	    if( ( (*p) == '\\' ) && ( *(p+1) == 'n' ) ){
-		*r = '\0';
-		p++;
-		len++;
-	    } else {
-		*r = *p;
-	    }
-	    r++;
-	    p++;
-	}
-	*r = '\0';
-	len++;
-
-	r = line2 ;
-	current->lines = len ;
-	current->start = a1*360000+a2*6000+a3*100+a4;
-	current->end   = b1*360000+b2*6000+b3*100+b4;
-	for(count = 0 ; count < len ; count++){
-		current->text[count] = strdup(r);
-		while(*r != '\0') r++;
-		r++;
-	}
-	break;
-    }
-    return current;
-}
-
 int sub_autodetect (FILE *fd) {
     char line[LINE_LEN+1];
     int i,j=0;
@@ -548,8 +499,6 @@
 		{sub_uses_time=1;return SUB_SUBVIEWER;}
 	if (strstr (line, "<SAMI>"))
 		{sub_uses_time=1; return SUB_SAMI;}
-	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_JACOSUB;}
 	if (sscanf (line, "%d:%d:%d:",     &i, &i, &i )==3)
 		{sub_uses_time=1;return SUB_VPLAYER;}
 	//TODO: just checking if first line of sub starts with "<" is WAY
@@ -660,8 +609,7 @@
 	    sub_read_line_ssa,
 	    sub_read_line_dunnowhat,
 	    sub_read_line_mpsub,
-	    sub_read_line_aqt,
-	    sub_read_line_jacosub
+	    sub_read_line_aqt

     };
     if(filename==NULL) return NULL; //qnx segfault



--- subreader.h	Wed Apr  3 15:37:52 2002
+++ subreader.h-old	Tue Dec 25 17:39:12 2001
@@ -18,7 +18,6 @@
 #define SUB_DUNNOWHAT 7		// FIXME what format is it ?
 #define SUB_MPSUB     8
 #define SUB_AQTITLE   9
-#define SUB_JACOSUB   10

 // One of the SUB_* constant above
 extern int sub_format;


	Bye, Salvatore Falco
     --- Linux User Group Roma ---





More information about the MPlayer-dev-eng mailing list