[Mplayer-cvslog] CVS: main subreader.c,1.82,1.83

Arpi of Ize arpi at mplayerhq.hu
Sat Dec 28 14:42:31 CET 2002


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

Modified Files:
	subreader.c 
Log Message:
Attached is a small patch to fix a couple of problems I found when using
.SSA subtitle files:
1) A comma appears at the beggining of the text. From comments on the
code this seems to be a delicated matter, so I just added a conditional
to eliminate the comma if it is at the beggining of the string.
2) It looks like this format uses {*} for attributes, like {/fs36} to
select "font size 36pt". These things becomes really annoying when
displayed with the real text ;-), so I added a simple filter to collapse
all the text enclosed with { and }.

Salvador Eduardo Tropea <salvador at inti.gov.ar>


Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- subreader.c	5 Dec 2002 00:07:58 -0000	1.82
+++ subreader.c	28 Dec 2002 13:42:24 -0000	1.83
@@ -425,7 +425,7 @@
 	
 	char line[LINE_LEN+1],
 	     line3[LINE_LEN+1],
-	     *line2;
+	     *line2,*so,*de;
 	char *tmp;
 
 	do {
@@ -448,6 +448,21 @@
           }
 
         if(comma < max_comma)max_comma = comma;
+	/* eliminate the trailing comma */
+	if(*line2 == ',') line2++;
+	/* eliminate any text enclosed with {}, they are font and color settings */
+	so=de=line2;
+	while (*so) {
+		if(*so == '{') {
+			for (; *so && *so!='}'; *so++);
+			if(*so) so++;
+		}
+		if(*so) {
+			*de=*so;
+			so++; de++;
+		}
+	}
+	*de=*so;
 
 	current->lines=0;num=0;
 	current->start = 360000*hour1 + 6000*min1 + 100*sec1 + hunsec1;




More information about the MPlayer-cvslog mailing list