[PATCH] Avoid raising error when trying to load a vobsub.

Clément Bœsch ubitux at gmail.com
Thu Jan 13 00:34:38 CET 2011


---
 sub/subreader.c |    4 ++++
 sub/subreader.h |    1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/sub/subreader.c b/sub/subreader.c
index 4877dc6..565c47b 100644
--- a/sub/subreader.c
+++ b/sub/subreader.c
@@ -1146,6 +1146,8 @@ static int sub_autodetect (stream_t* st, int *uses_time, int utf16) {
 		{*uses_time=0; return SUB_AQTITLE;}
 	if (sscanf (line, "[%d:%d:%d]", &i, &i, &i)==3)
 		{*uses_time=1;return SUB_SUBRIP09;}
+        if (j == 1 && (unsigned char)line[3] == 0xba)
+            return SUB_VOBSUB;
     }
 
     return SUB_INVALID;  // too many bad lines
@@ -1454,6 +1456,8 @@ sub_data* sub_read_file (char *filename, float fps) {
     utf16--;
 
     mpsub_multiplier = (uses_time ? 100.0 : 1.0);
+    if (sub_format == SUB_VOBSUB)
+        return NULL;
     if (sub_format==SUB_INVALID) {mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: Could not determine file format\n");return NULL;}
     srp=sr+sub_format;
     mp_msg(MSGT_SUBREADER, MSGL_V, "SUB: Detected subtitle file format: %s\n", srp->name);
diff --git a/sub/subreader.h b/sub/subreader.h
index dd08a22..ffdddd7 100644
--- a/sub/subreader.h
+++ b/sub/subreader.h
@@ -45,6 +45,7 @@ extern char *sub_cp;
 #define SUB_SUBRIP09 11
 #define SUB_JACOSUB  12
 #define SUB_MPL2     13
+#define SUB_VOBSUB   0xff
 
 #define MAX_SUBTITLE_FILES 128
 
-- 
1.7.3.5


--YToU2i3Vx8H2dn7O--


More information about the MPlayer-dev-eng mailing list