diff options
author | wm4 <wm4@nowhere> | 2013-09-07 20:33:47 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-09-07 20:34:49 +0200 |
commit | c7ab8ea513fdc15a500dddcae01fa76cd07d0d84 (patch) | |
tree | d49535f34f43026017c133dc6290b08962c13826 /mpvcore | |
parent | dc475728e0fd395e0780a2e41b0dc19af162e383 (diff) | |
download | mpv-c7ab8ea513fdc15a500dddcae01fa76cd07d0d84.tar.bz2 mpv-c7ab8ea513fdc15a500dddcae01fa76cd07d0d84.tar.xz |
mplayer: don't auto-load explicitly loaded subtitle files
Even if a subtitle was explicitly loaded with -sub, it was still auto-
loaded (if auto-loading applied to that file). Fix this by explicitly
checking whether a file is already loaded.
The check is maximal naive and just compares the filenames as strings.
The change in find_subfiles.c is so that "-sub something.ass" happens to
work (auto-loading prepended a "./" to it, so the naive filename
comparison check didn't work).
Diffstat (limited to 'mpvcore')
-rw-r--r-- | mpvcore/mplayer.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mpvcore/mplayer.c b/mpvcore/mplayer.c index d811bd8207..ad1bae476b 100644 --- a/mpvcore/mplayer.c +++ b/mpvcore/mplayer.c @@ -3957,9 +3957,15 @@ static void open_subtitles_from_options(struct MPContext *mpctx) char **tmp = find_text_subtitles(mpctx->opts, mpctx->filename); int nsub = MP_TALLOC_ELEMS(tmp); for (int i = 0; i < nsub; i++) { - struct track *track = mp_add_subtitles(mpctx, tmp[i]); + char *filename = tmp[i]; + for (int n = 0; n < mpctx->num_sources; n++) { + if (strcmp(mpctx->sources[n]->stream->url, filename) == 0) + goto skip; + } + struct track *track = mp_add_subtitles(mpctx, filename); if (track) track->auto_loaded = true; + skip:; } talloc_free(tmp); } |