Index: subreader.c =================================================================== RCS file: /cvsroot/mplayer/main/subreader.c,v retrieving revision 1.126 diff -u -r1.126 subreader.c --- subreader.c 19 Nov 2003 01:41:27 -0000 1.126 +++ subreader.c 14 Jan 2004 13:47:41 -0000 @@ -3,7 +3,7 @@ * * Written by laaz * Some code cleanup & realloc() by A'rpi/ESP-team - * dunnowhat sub format by szabi + * */ @@ -533,15 +533,46 @@ } } -subtitle *sub_read_line_dunnowhat(FILE *fd,subtitle *current) { +/* + * PJS subtitles reader. + * That's the "Phoenix Japanimation Society" format. + * I found some of them in http://www.scriptsclub.org/ (used for anime). + * The time is in tenths of second. + * + * by set, based on code by szabi (dunnowhat sub format ;-) + */ +subtitle *sub_read_line_pjs(FILE *fd,subtitle *current) { char line[LINE_LEN+1]; - char text[LINE_LEN+1]; + char text[LINE_LEN+1], *s, *d; if (!fgets (line, LINE_LEN, fd)) return NULL; - if (sscanf (line, "%ld,%ld,\"%[^\"]", &(current->start), - &(current->end), text) <3) + /* skip spaces */ + for (s=line; *s && isspace(*s); s++); + /* allow empty lines at the end of the file */ + if (*s==0) + return NULL; + /* get the time */ + if (sscanf (s, "%ld,%ld,", &(current->start), + &(current->end)) <2) { return ERR; + } + /* the files I have are in tenths of second */ + current->start *= 10; + current->end *= 10; + /* walk to the beggining of the string */ + for (; *s; s++) if (*s==',') break; + if (*s) { + for (s++; *s; s++) if (*s==',') break; + if (*s) s++; + } + if (*s!='"') { + return ERR; + } + /* copy the string to the text buffer */ + for (s++, d=text; *s && *s!='"'; s++, d++) + *d=*s; + *d=0; current->text[0] = strdup(text); current->lines = 1; @@ -935,7 +966,7 @@ if (!memcmp(line, "Dialogue: ", 10)) {*uses_time=1; return SUB_SSA;} if (sscanf (line, "%d,%d,\"%c", &i, &i, (char *) &i) == 3) - {*uses_time=0;return SUB_DUNNOWHAT;} + {*uses_time=1;return SUB_PJS;} if (sscanf (line, "FORMAT=%d", &i) == 1) {*uses_time=0; return SUB_MPSUB;} if (sscanf (line, "FORMAT=TIM%c", &p)==1 && p=='E') @@ -1187,7 +1218,7 @@ { sub_read_line_vplayer, NULL, "vplayer" }, { sub_read_line_rt, NULL, "rt" }, { sub_read_line_ssa, sub_pp_ssa, "ssa" }, - { sub_read_line_dunnowhat, NULL, "dunnowhat" }, + { sub_read_line_pjs, NULL, "pjs" }, { sub_read_line_mpsub, NULL, "mpsub" }, { sub_read_line_aqt, NULL, "aqt" }, { sub_read_line_subviewer2, NULL, "subviewer 2.0" }, Index: subreader.h =================================================================== RCS file: /cvsroot/mplayer/main/subreader.h,v retrieving revision 1.29 diff -u -r1.29 subreader.h --- subreader.h 21 Sep 2003 13:20:00 -0000 1.29 +++ subreader.h 14 Jan 2004 13:47:41 -0000 @@ -14,7 +14,7 @@ #define SUB_VPLAYER 4 #define SUB_RT 5 #define SUB_SSA 6 -#define SUB_DUNNOWHAT 7 // FIXME what format is it ? +#define SUB_PJS 7 #define SUB_MPSUB 8 #define SUB_AQTITLE 9 #define SUB_SUBVIEWER2 10 Index: DOCS/man/en/mplayer.1 =================================================================== RCS file: /cvsroot/mplayer/main/DOCS/man/en/mplayer.1,v retrieving revision 1.520 diff -u -r1.520 mplayer.1 --- DOCS/man/en/mplayer.1 12 Jan 2004 11:09:03 -0000 1.520 +++ DOCS/man/en/mplayer.1 14 Jan 2004 13:47:42 -0000 @@ -162,8 +162,8 @@ MPlayer has an onscreen display (OSD) for status information, nice big antialiased shaded subtitles and visual feedback for keyboard controls. European/\:ISO 8859-1,2 (Hungarian, English, Czech, etc), Cyrillic and Korean -fonts are supported along with 10 subtitle formats (MicroDVD, SubRip, -SubViewer, Sami, VPlayer, RT, SSA, AQTitle, JACOsub and our own: MPsub) and +fonts are supported along with 11 subtitle formats (MicroDVD, SubRip, +SubViewer, Sami, VPlayer, RT, SSA, AQTitle, JACOsub, PJS and our own: MPsub) and DVD subtitles (SPU streams, VobSub and Closed Captions). .PP .B mencoder Index: DOCS/xml/en/install.xml =================================================================== RCS file: /cvsroot/mplayer/main/DOCS/xml/en/install.xml,v retrieving revision 1.34 diff -u -r1.34 install.xml --- DOCS/xml/en/install.xml 6 Jan 2004 22:19:12 -0000 1.34 +++ DOCS/xml/en/install.xml 14 Jan 2004 13:47:42 -0000 @@ -563,6 +563,7 @@ MPsub AQTitle JACOsub +PJS (Phoenix Japanimation Society)