[MPlayer-dev-eng] [PATCH] subviewer variant?

Oskar Liljeblad oskar at osk.mine.nu
Sat Dec 28 16:43:54 CET 2002


Hello

I found these weird subtitles for Office Space, similar to the
subviewer format but not exactly:

1
00:00:27.000 --> 00:00:28.300
PEREZ PRADO SINGING:
Uno

2
00:00:28.330 --> 00:00:29.630
Dos

Notice the periods (.) instead of commas (,). I don't really know
what program reads them... But this patch makes mplayer read them
as well.

Oskar Liljeblad (oskar at osk.mine.nu)
-------------- next part --------------
diff -u -p subreader.c.v0 subreader.c
--- subreader.c.v0	2002-12-28 16:24:00.000000000 +0100
+++ subreader.c	2002-12-28 16:36:55.000000000 +0100
@@ -244,7 +244,7 @@ subtitle *sub_read_line_subviewer(FILE *
     
     while (!current->text[0]) {
 	if (!fgets (line, LINE_LEN, fd)) return NULL;
-	if ((len=sscanf (line, "%d:%d:%d,%d --> %d:%d:%d,%d",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4)) < 8)
+	if ((len=sscanf (line, "%d:%d:%d%[,.]%d --> %d:%d:%d%[,.]%d",&a1,&a2,&a3,&i,&a4,&b1,&b2,&b3,&i,&b4)) < 10)
 	    continue;
 	current->start = a1*360000+a2*6000+a3*100+a4/10;
 	current->end   = b1*360000+b2*6000+b3*100+b4/10;
@@ -839,7 +839,7 @@ int sub_autodetect (FILE *fd) {
 		{sub_uses_time=0;return SUB_MICRODVD;}
 	if (sscanf (line, "%d:%d:%d.%d,%d:%d:%d.%d",     &i, &i, &i, &i, &i, &i, &i, &i)==8)
 		{sub_uses_time=1;return SUB_SUBRIP;}
-	if (sscanf (line, "%d:%d:%d,%d --> %d:%d:%d,%d", &i, &i, &i, &i, &i, &i, &i, &i)==8)
+	if (sscanf (line, "%d:%d:%d%[,.]%d --> %d:%d:%d%[,.]%d", &i, &i, &i, &i, &i, &i, &i, &i, &i, &i)==10)
 		{sub_uses_time=1;return SUB_SUBVIEWER;}
 	if (sscanf (line, "{T %d:%d:%d:%d",&i, &i, &i, &i))
 		{sub_uses_time=1;return SUB_SUBVIEWER2;}


More information about the MPlayer-dev-eng mailing list