Mercurial > mplayer.hg
diff sub/subreader.c @ 32774:dfeea3d3b2d0
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.
| author | cboesch |
|---|---|
| date | Sat, 05 Feb 2011 20:45:42 +0000 |
| parents | 06b75ec1b9c9 |
| children | 93629a05a380 |
line wrap: on
line diff
--- a/sub/subreader.c Sat Feb 05 20:38:02 2011 +0000 +++ b/sub/subreader.c Sat Feb 05 20:45:42 2011 +0000 @@ -1957,6 +1957,22 @@ 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
