CVS: main subreader.c,1.19,1.20
Update of /cvsroot/mplayer/main In directory usw-pr-cvs1:/tmp/cvs-serv13117 Modified Files: subreader.c Log Message: new sub format... Index: subreader.c =================================================================== RCS file: /cvsroot/mplayer/main/subreader.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** subreader.c 2001/06/01 21:12:05 1.19 --- subreader.c 2001/06/09 20:09:18 1.20 *************** *** 4,7 **** --- 4,8 ---- * Written by laaz * Some code cleanup & realloc() by A'rpi/ESP-team + * dunnowhat sub format by szabi */ *************** *** 27,30 **** --- 28,32 ---- // 5 for RT format // 6 for ssa (Sub Station Alpha) + // 7 for ... erm ... dunnowhat. tell me if you know int eol(char p) { *************** *** 144,151 **** next=p, i=0; ! while (next =sub_readtext (next, &(current->text[i]))) { if (current->text[i]==ERR) {return ERR;} i++; ! if (i>=SUB_MAX_TEXT) { printf ("Too many lines in a subtitle\n");current->lines=i;return;} } current->lines= ++i; --- 146,153 ---- next=p, i=0; ! while ((next =sub_readtext (next, &(current->text[i])))) { if (current->text[i]==ERR) {return ERR;} i++; ! if (i>=SUB_MAX_TEXT) { printf ("Too many lines in a subtitle\n");current->lines=i;return current;} } current->lines= ++i; *************** *** 220,225 **** char line2[1001]; int a1,a2,a3,b1,b2,b3; ! int setime,etime; ! char *p=NULL, *q=NULL, *l=NULL,*next; int i,len,len2,plen; --- 222,226 ---- char line2[1001]; int a1,a2,a3,b1,b2,b3; ! char *p=NULL, *next; int i,len,len2,plen; *************** *** 247,251 **** if (current->text[i]==ERR) {return ERR;} i++; ! if (i>=SUB_MAX_TEXT) { printf ("Too many lines in a subtitle\n");current->lines=i;return;} } current->lines=i+1; --- 248,252 ---- if (current->text[i]==ERR) {return ERR;} i++; ! if (i>=SUB_MAX_TEXT) { printf ("Too many lines in a subtitle\n");current->lines=i;return current;} } current->lines=i+1; *************** *** 288,292 **** if (current->text[i]==ERR) {return ERR;} i++; ! if (i>=SUB_MAX_TEXT) { printf ("Too many lines in a subtitle\n");current->lines=i;return;} } current->lines=i+1; --- 289,293 ---- if (current->text[i]==ERR) {return ERR;} i++; ! if (i>=SUB_MAX_TEXT) { printf ("Too many lines in a subtitle\n");current->lines=i;return current;} } current->lines=i+1; *************** *** 317,320 **** --- 318,338 ---- } + subtitle *sub_read_line_dunnowhat(FILE *fd,subtitle *current) { + char line[1001]; + char text[1001]; + + bzero (current, sizeof(current)); + + if (!fgets (line, 1000, fd)) + return NULL; + if (sscanf (line, "%ld,%ld,\"%[^\"]", &(current->start), + &(current->end), text) <3) + return ERR; + current->text[0] = strdup(text); + current->lines = 1; + + return current; + } + int sub_autodetect (FILE *fd) { char line[1001]; *************** *** 348,351 **** --- 366,371 ---- if (!memcmp(line, "Dialogue: Marked", 16)) {sub_uses_time=1; return 6;} + if (sscanf (line, "%d,%d,\"%c", &i, &i, (char *) &i) == 3) + {sub_uses_time=0;return 7;} } *************** *** 358,362 **** int n_max; subtitle *first; ! subtitle * (*func[7])(FILE *fd,subtitle *dest)= { sub_read_line_microdvd, --- 378,382 ---- int n_max; subtitle *first; ! subtitle * (*func[])(FILE *fd,subtitle *dest)= { sub_read_line_microdvd, *************** *** 366,370 **** sub_read_line_vplayer, sub_read_line_rt, ! sub_read_line_ssa }; --- 386,391 ---- sub_read_line_vplayer, sub_read_line_rt, ! sub_read_line_ssa, ! sub_read_line_dunnowhat }; *************** *** 433,437 **** ".RT", ".txt", ! ".TXT"}; --- 454,460 ---- ".RT", ".txt", ! ".TXT", ! ".ssa", ! ".SSA"}; *************** *** 446,450 **** sub_name2=malloc (strlen(path) + strlen(fname) + 8); ! if (tmp=strrchr(fname,'/')) sprintf (sub_name2, "%s%s", path, tmp+1); else --- 469,473 ---- sub_name2=malloc (strlen(path) + strlen(fname) + 8); ! if ((tmp=strrchr(fname,'/'))) sprintf (sub_name2, "%s%s", path, tmp+1); else *************** *** 490,494 **** for(j=0;j<sub_num;j++){ egysub=&subs[j]; ! printf ("%i line%c (%i-%i) ", egysub->lines, (1==egysub->lines)?' ':'s', --- 513,517 ---- for(j=0;j<sub_num;j++){ egysub=&subs[j]; ! printf ("%i line%c (%li-%li) ", egysub->lines, (1==egysub->lines)?' ':'s', _______________________________________________ Mplayer-cvslog mailing list Mplayer-cvslog@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog
participants (1)
-
Szabolcs Berecz