Mercurial > mplayer.hg
comparison subreader.c @ 2141:fa62c11857e8
SSA 2. felvonas (egyre jobban programozok!!!)
author | laaz |
---|---|
date | Tue, 09 Oct 2001 00:36:55 +0000 |
parents | 885c9c802373 |
children | a9d91476085a |
comparison
equal
deleted
inserted
replaced
2140:885c9c802373 | 2141:fa62c11857e8 |
---|---|
303 } | 303 } |
304 | 304 |
305 subtitle *sub_read_line_ssa(FILE *fd,subtitle *current) { | 305 subtitle *sub_read_line_ssa(FILE *fd,subtitle *current) { |
306 int hour1, min1, sec1, hunsec1, | 306 int hour1, min1, sec1, hunsec1, |
307 hour2, min2, sec2, hunsec2, nothing; | 307 hour2, min2, sec2, hunsec2, nothing; |
308 int num; | |
308 | 309 |
309 char line[1000], | 310 char line[1000], |
310 line3[1000], | 311 line3[1000], |
311 *line2; | 312 *line2; |
313 char *tmp; | |
314 | |
312 do { | 315 do { |
313 if (!fgets (line, 1000, fd)) return NULL; | 316 if (!fgets (line, 1000, fd)) return NULL; |
314 } while (sscanf (line, "Dialogue: Marked=%d,%d:%d:%d.%d,%d:%d:%d.%d," | 317 } while (sscanf (line, "Dialogue: Marked=%d,%d:%d:%d.%d,%d:%d:%d.%d," |
315 "%[^\n\r]", ¬hing, | 318 "%[^\n\r]", ¬hing, |
316 &hour1, &min1, &sec1, &hunsec1, | 319 &hour1, &min1, &sec1, &hunsec1, |
319 line2=strstr(line3,",,"); | 322 line2=strstr(line3,",,"); |
320 if (!line2) return NULL; | 323 if (!line2) return NULL; |
321 line2 ++; | 324 line2 ++; |
322 line2 ++; | 325 line2 ++; |
323 | 326 |
324 current->lines=1; // ez a kiraly!!! | 327 current->lines=1;num=0; |
325 current->start = 360000*hour1 + 6000*min1 + 100*sec1 + hunsec1; | 328 current->start = 360000*hour1 + 6000*min1 + 100*sec1 + hunsec1; |
326 current->end = 360000*hour2 + 6000*min2 + 100*sec2 + hunsec2; | 329 current->end = 360000*hour2 + 6000*min2 + 100*sec2 + hunsec2; |
327 current->text[0]=(char *) malloc(strlen(line2)+1); | 330 |
328 strcpy(current->text[0],line2); | 331 while (tmp=strstr(line2, "\\n")) { |
332 current->text[num]=(char *)malloc(tmp-line2+1); | |
333 strncpy (current->text[num], line2, tmp-line2); | |
334 current->text[num][tmp-line2]='\0'; | |
335 line2=tmp+2; | |
336 num++; | |
337 current->lines++; | |
338 if (current->lines >= SUB_MAX_TEXT) return current; | |
339 } | |
340 | |
341 | |
342 current->text[num]=(char *) malloc(strlen(line2)+1); | |
343 strcpy(current->text[num],line2); | |
329 | 344 |
330 return current; | 345 return current; |
331 } | 346 } |
332 | 347 |
333 subtitle *sub_read_line_dunnowhat(FILE *fd,subtitle *current) { | 348 subtitle *sub_read_line_dunnowhat(FILE *fd,subtitle *current) { |