[Mplayer-cvslog] CVS: main subreader.c, 1.129, 1.130 subreader.h, 1.30, 1.31
Alex Beregszaszi
syncmail at mplayerhq.hu
Tue Apr 6 13:52:33 CEST 2004
CVS change done by Alex Beregszaszi
Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv20816
Modified Files:
subreader.c subreader.h
Log Message:
MPL2 subreader, patch by Cezary Jackiewicz (cjackiewicz at poczta.onet.pl)
Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -r1.129 -r1.130
--- subreader.c 6 Apr 2004 11:22:06 -0000 1.129
+++ subreader.c 6 Apr 2004 11:52:31 -0000 1.130
@@ -248,6 +248,32 @@
return current;
}
+subtitle *sub_read_line_mpl2(FILE *fd,subtitle *current) {
+ char line[LINE_LEN+1];
+ char line2[LINE_LEN+1];
+ char *p, *next;
+ int i;
+
+ do {
+ if (!fgets (line, LINE_LEN, fd)) return NULL;
+ } while ((sscanf (line,
+ "[%ld][%ld]%[^\r\n]",
+ &(current->start), &(current->end), line2) < 3));
+ current->start *= 10;
+ current->end *= 10;
+ p=line2;
+
+ 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) { mp_msg(MSGT_SUBREADER,MSGL_WARN,"Too many lines in a subtitle\n");current->lines=i;return current;}
+ }
+ current->lines= ++i;
+
+ return current;
+}
+
subtitle *sub_read_line_subrip(FILE *fd, subtitle *current) {
char line[LINE_LEN+1];
int a1,a2,a3,a4,b1,b2,b3,b4;
@@ -954,6 +980,8 @@
{*uses_time=0;return SUB_MICRODVD;}
if (sscanf (line, "{%d}{}", &i)==1)
{*uses_time=0;return SUB_MICRODVD;}
+ if (sscanf (line, "[%d][%d]", &i, &i)==2)
+ {*uses_time=1;return SUB_MPL2;}
if (sscanf (line, "%d:%d:%d.%d,%d:%d:%d.%d", &i, &i, &i, &i, &i, &i, &i, &i)==8)
{*uses_time=1;return SUB_SUBRIP;}
if (sscanf (line, "%d:%d:%d%[,.:]%d --> %d:%d:%d%[,.:]%d", &i, &i, &i, (char *)&i, &i, &i, &i, &i, (char *)&i, &i)==10)
@@ -1239,7 +1267,8 @@
{ sub_read_line_aqt, NULL, "aqt" },
{ sub_read_line_subviewer2, NULL, "subviewer 2.0" },
{ sub_read_line_subrip09, NULL, "subrip 0.9" },
- { sub_read_line_jacosub, NULL, "jacosub" }
+ { sub_read_line_jacosub, NULL, "jacosub" },
+ { sub_read_line_mpl2, NULL, "mpl2" }
};
struct subreader *srp;
Index: subreader.h
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- subreader.h 29 Jan 2004 10:53:19 -0000 1.30
+++ subreader.h 6 Apr 2004 11:52:31 -0000 1.31
@@ -20,6 +20,7 @@
#define SUB_SUBVIEWER2 10
#define SUB_SUBRIP09 11
#define SUB_JACOSUB 12
+#define SUB_MPL2 13
// One of the SUB_* constant above
extern int sub_format;
More information about the MPlayer-cvslog
mailing list