Mercurial > mplayer.hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
32773:06b75ec1b9c9 | 32774:dfeea3d3b2d0 |
---|---|
1955 // retrieve various parts of the filename | 1955 // retrieve various parts of the filename |
1956 strcpy_strip_ext_lower(tmp_fname_noext, de->d_name); | 1956 strcpy_strip_ext_lower(tmp_fname_noext, de->d_name); |
1957 strcpy_get_ext(tmp_fname_ext, de->d_name); | 1957 strcpy_get_ext(tmp_fname_ext, de->d_name); |
1958 strcpy_trim(tmp_fname_trim, tmp_fname_noext); | 1958 strcpy_trim(tmp_fname_trim, tmp_fname_noext); |
1959 | 1959 |
1960 // If it's a .sub, check if there is a .idx with the same name. If | |
1961 // there is one, it's certainly a vobsub so we skip it. | |
1962 if (strcasecmp(tmp_fname_ext, "sub") == 0) { | |
1963 char *idx, *idxname = strdup(de->d_name); | |
1964 | |
1965 strcpy(idxname + strlen(de->d_name) - sizeof("idx") + 1, "idx"); | |
1966 idx = mp_dir_join(path, idxname); | |
1967 free(idxname); | |
1968 f = fopen(idx, "rt"); | |
1969 free(idx); | |
1970 if (f) { | |
1971 fclose(f); | |
1972 continue; | |
1973 } | |
1974 } | |
1975 | |
1960 // does it end with a subtitle extension? | 1976 // does it end with a subtitle extension? |
1961 found = 0; | 1977 found = 0; |
1962 #ifdef CONFIG_ICONV | 1978 #ifdef CONFIG_ICONV |
1963 #ifdef CONFIG_ENCA | 1979 #ifdef CONFIG_ENCA |
1964 for (i = ((sub_cp && strncasecmp(sub_cp, "enca", 4) != 0) ? 3 : 0); sub_exts[i]; i++) { | 1980 for (i = ((sub_cp && strncasecmp(sub_cp, "enca", 4) != 0) ? 3 : 0); sub_exts[i]; i++) { |