summaryrefslogtreecommitdiffstats
path: root/sub/find_subfiles.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-12-08 13:59:49 +0100
committerwm4 <wm4@nowhere>2012-12-11 00:37:54 +0100
commit5bf8706d1f6536cd89207b777161ab83195ddb20 (patch)
tree1e4ba07a00da6dcde3f8f308f2aa1128af56619e /sub/find_subfiles.c
parentb3fb7c2cade9d70a4ca05821c87f68e941da6237 (diff)
downloadmpv-5bf8706d1f6536cd89207b777161ab83195ddb20.tar.bz2
mpv-5bf8706d1f6536cd89207b777161ab83195ddb20.tar.xz
sub: remove vobsub reader in favor of ffmpeg vobsub demuxer
ffmpeg recently added a demuxer that can read vobsubs (pairs of .sub and .idx files). Get rid of the internal vobsub reader, and use the ffmpeg demuxer instead. Sneak in an unrelated manpage change (autosub default).
Diffstat (limited to 'sub/find_subfiles.c')
-rw-r--r--sub/find_subfiles.c53
1 files changed, 2 insertions, 51 deletions
diff --git a/sub/find_subfiles.c b/sub/find_subfiles.c
index 502fc911dc..95004b564f 100644
--- a/sub/find_subfiles.c
+++ b/sub/find_subfiles.c
@@ -87,7 +87,7 @@ static void append_dir_subtitles(struct MPOpts *opts,
struct bstr path, const char *fname,
int limit_fuzziness)
{
- char *sub_exts[] = {"utf", "utf8", "utf-8", "sub", "srt", "smi", "rt", "txt", "ssa", "aqt", "jss", "js", "ass", NULL};
+ char *sub_exts[] = {"utf", "utf8", "utf-8", "idx", "sub", "srt", "smi", "rt", "txt", "ssa", "aqt", "jss", "js", "ass", NULL};
void *tmpmem = talloc_new(NULL);
FILE *f;
assert(strlen(fname) < 1e6);
@@ -117,20 +117,6 @@ static void append_dir_subtitles(struct MPOpts *opts,
struct bstr tmp_fname_ext = get_ext(dename);
struct bstr tmp_fname_trim = bstr_strip(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 (bstrcasecmp(tmp_fname_ext, bstr0("sub")) == 0) {
- char *idxname = talloc_asprintf(tmpmem2, "%.*s.idx",
- (int)tmp_fname_noext.len,
- de->d_name);
- char *idx = mp_path_join(tmpmem2, path, bstr0(idxname));
- f = fopen(idx, "rt");
- if (f) {
- fclose(f);
- goto next_sub;
- }
- }
-
// does it end with a subtitle extension?
#ifdef CONFIG_ICONV
#ifdef CONFIG_ENCA
@@ -183,7 +169,7 @@ static void append_dir_subtitles(struct MPOpts *opts,
if (prio) {
prio += prio;
#ifdef CONFIG_ICONV
- if (i < 3) // prefer UTF-8 coded
+ if (i < 4) // prefer UTF-8 coded, or idx over sub (vobsubs)
prio++;
#endif
char *subpath = mp_path_join(*slist, path, dename);
@@ -241,38 +227,3 @@ char **find_text_subtitles(struct MPOpts *opts, const char *fname)
talloc_free(slist);
return subnames;
}
-
-char **find_vob_subtitles(struct MPOpts *opts, const char *fname)
-{
- char **vobs = talloc_array_ptrtype(NULL, vobs, 1);
- int n = 0;
-
- // Potential vobsub in the media directory
- struct bstr bname = bstr0(mp_basename(fname));
- int pdot = bstrrchr(bname, '.');
- if (pdot >= 0)
- bname.len = pdot;
- vobs[n++] = mp_path_join(vobs, mp_dirname(fname), bname);
-
- // Potential vobsubs in directories specified by sub-paths option
- if (opts->sub_paths) {
- for (int i = 0; opts->sub_paths[i]; i++) {
- char *path = mp_path_join(NULL, mp_dirname(fname),
- bstr0(opts->sub_paths[i]));
- MP_GROW_ARRAY(vobs, n);
- vobs[n++] = mp_path_join(vobs, bstr0(path), bname);
- talloc_free(path);
- }
- }
-
- // Potential vobsub in ~/.mplayer/sub
- char *mp_subdir = get_path("sub/");
- if (mp_subdir) {
- MP_GROW_ARRAY(vobs, n);
- vobs[n++] = mp_path_join(vobs, bstr0(mp_subdir), bname);
- }
-
- free(mp_subdir);
- MP_RESIZE_ARRAY(NULL, vobs, n);
- return vobs;
-}