changeset 2141:fa62c11857e8

SSA 2. felvonas (egyre jobban programozok!!!)
author laaz
date Tue, 09 Oct 2001 00:36:55 +0000
parents 885c9c802373
children 8939341c5187
files subreader.c
diffstat 1 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/subreader.c	Tue Oct 09 00:18:20 2001 +0000
+++ b/subreader.c	Tue Oct 09 00:36:55 2001 +0000
@@ -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;
 }