[MPlayer-cvslog] r32861 - trunk/sub/subreader.c

cboesch subversion at mplayerhq.hu
Sat Feb 5 21:45:42 CET 2011


Author: cboesch
Date: Sat Feb  5 21:45:42 2011
New Revision: 32861

Log:
Do not add .sub to text subtitles when they look like vobsub.

This will avoid the annoying message "SUB: Could not determine file
format" because of MicroDVD and VOBsub sharing the same extension.

Modified:
   trunk/sub/subreader.c

Modified: trunk/sub/subreader.c
==============================================================================
--- trunk/sub/subreader.c	Sat Feb  5 21:38:02 2011	(r32860)
+++ trunk/sub/subreader.c	Sat Feb  5 21:45:42 2011	(r32861)
@@ -1957,6 +1957,22 @@ static void append_dir_subtitles(struct 
             strcpy_get_ext(tmp_fname_ext, de->d_name);
             strcpy_trim(tmp_fname_trim, tmp_fname_noext);
 
+            // If it's a .sub, check if there is a .idx with the same name. If
+            // there is one, it's certainly a vobsub so we skip it.
+            if (strcasecmp(tmp_fname_ext, "sub") == 0) {
+                char *idx, *idxname = strdup(de->d_name);
+
+                strcpy(idxname + strlen(de->d_name) - sizeof("idx") + 1, "idx");
+                idx = mp_dir_join(path, idxname);
+                free(idxname);
+                f = fopen(idx, "rt");
+                free(idx);
+                if (f) {
+                    fclose(f);
+                    continue;
+                }
+            }
+
             // does it end with a subtitle extension?
             found = 0;
 #ifdef CONFIG_ICONV


More information about the MPlayer-cvslog mailing list