From 87190969a758d7c20c39a456f05926bff42ac533 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 10 Aug 2016 22:22:50 +0200 Subject: player: add --no-autoload-files option Allt his auto-loading is getting annoying especially for testing. --- DOCS/man/options.rst | 10 ++++++++++ options/options.c | 2 ++ options/options.h | 1 + player/loadfile.c | 6 ++++++ 4 files changed, 19 insertions(+) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 2deadd29df..e3eb3c2f5d 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -3720,6 +3720,16 @@ Miscellaneous ``--audio-file``, this includes all tracks, and does not cause default stream selection over the "proper" file. +``--autoload-files=`` + Automatically load/select external files (default: yes). + + If set to ``no``, then do not automatically load external files as specified + by ``--sub-auto`` and ``--audio-file-auto``. If external files are forcibly + added (like with ``--sub-file``), they will not be auto-selected. + + This does not affect playlist expansion, redirection, or other loading of + referenced files like with ordered chapters. + ``--lavfi-complex=`` Set a "complex" libavfilter filter, which means a single filter graph can take input from multiple source audio and video tracks. The graph can result diff --git a/options/options.c b/options/options.c index 9dcaedcf2d..9e3e70385e 100644 --- a/options/options.c +++ b/options/options.c @@ -342,6 +342,7 @@ const m_option_t mp_opts[] = { OPT_PATHLIST("sub-paths", sub_paths, 0), OPT_PATHLIST("audio-file-paths", audiofile_paths, 0), OPT_STRING_APPEND_LIST("external-file", external_files, M_OPT_FILE), + OPT_FLAG("autoload-files", autoload_files, 0), OPT_STRING("sub-codepage", sub_cp, 0), OPT_FLOAT("sub-delay", sub_delay, 0), OPT_FLOAT("sub-fps", sub_fps, 0), @@ -763,6 +764,7 @@ const struct MPOpts mp_default_opts = { .sync_audio_drop_size = 0.020, .load_config = 1, .position_resume = 1, + .autoload_files = 1, .stream_cache = { .size = -1, .def_size = 75000, diff --git a/options/options.h b/options/options.h index 29cfb2231d..4de4a831bb 100644 --- a/options/options.h +++ b/options/options.h @@ -245,6 +245,7 @@ typedef struct MPOpts { char **sub_paths; char **audiofile_paths; char **external_files; + int autoload_files; int sub_auto; int audiofile_auto; int osd_bar_visible; diff --git a/player/loadfile.c b/player/loadfile.c index 75c5499369..590839c799 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -296,6 +296,8 @@ static int match_lang(char **langs, char *lang) static bool compare_track(struct track *t1, struct track *t2, char **langs, struct MPOpts *opts) { + if (!opts->autoload_files && t1->is_external != t2->is_external) + return !t1->is_external; bool ext1 = t1->is_external && !t1->no_default; bool ext2 = t2->is_external && !t2->no_default; if (ext1 != ext2) @@ -354,6 +356,8 @@ struct track *select_default_track(struct MPContext *mpctx, int order, pick = NULL; if (pick && pick->attached_picture && !mpctx->opts->audio_display) pick = NULL; + if (pick && !opts->autoload_files && pick->is_external) + pick = NULL; return pick; } @@ -605,6 +609,8 @@ void autoload_external_files(struct MPContext *mpctx) { if (mpctx->opts->sub_auto < 0 && mpctx->opts->audiofile_auto < 0) return; + if (!mpctx->opts->autoload_files) + return; void *tmp = talloc_new(NULL); char *base_filename = mpctx->filename; -- cgit v1.2.3