[Mplayer-cvslog] CVS: main subreader.c,1.25,1.26

Megyer Laszlo laaz at mplayer.dev.hu
Tue Oct 9 02:37:12 CEST 2001


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

Modified Files:
	subreader.c 
Log Message:
SSA 2. felvonas (egyre jobban programozok!!!)


Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- subreader.c	9 Oct 2001 00:18:20 -0000	1.25
+++ subreader.c	9 Oct 2001 00:36:55 -0000	1.26
@@ -305,10 +305,13 @@
 subtitle *sub_read_line_ssa(FILE *fd,subtitle *current) {
 	int hour1, min1, sec1, hunsec1,
 	    hour2, min2, sec2, hunsec2, nothing;
+	int num;
 	
 	char line[1000],
 	     line3[1000],
 	     *line2;
+	char *tmp;
+
 	do {
 		if (!fgets (line, 1000, fd)) return NULL;
 	} while (sscanf (line, "Dialogue: Marked=%d,%d:%d:%d.%d,%d:%d:%d.%d,"
@@ -321,11 +324,23 @@
 	line2 ++;
 	line2 ++;
 
-	current->lines=1; // ez a kiraly!!!
+	current->lines=1;num=0;
 	current->start = 360000*hour1 + 6000*min1 + 100*sec1 + hunsec1;
 	current->end   = 360000*hour2 + 6000*min2 + 100*sec2 + hunsec2;
-	current->text[0]=(char *) malloc(strlen(line2)+1);
-	strcpy(current->text[0],line2);
+	
+	while (tmp=strstr(line2, "\\n")) {
+		current->text[num]=(char *)malloc(tmp-line2+1);
+		strncpy (current->text[num], line2, tmp-line2);
+		current->text[num][tmp-line2]='\0';
+		line2=tmp+2;
+		num++;
+		current->lines++;
+		if (current->lines >=  SUB_MAX_TEXT) return current;
+	}
+
+
+	current->text[num]=(char *) malloc(strlen(line2)+1);
+	strcpy(current->text[num],line2);
 
 	return current;
 }




More information about the MPlayer-cvslog mailing list