diff options
-rw-r--r-- | DOCS/interface-changes.rst | 2 | ||||
-rw-r--r-- | DOCS/man/options.rst | 12 | ||||
-rw-r--r-- | options/options.c | 2 | ||||
-rw-r--r-- | options/options.h | 1 | ||||
-rw-r--r-- | player/loadfile.c | 4 |
5 files changed, 19 insertions, 2 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 74eb079322..2163fc4066 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -38,6 +38,8 @@ Interface changes - --lavfi-complex can now be set during runtime. If you set this in expectation it would be applied only after a reload, you might observe weird behavior. + - add --track-auto-selection to help with scripts/applications that + make exclusive use of --lavfi-complex. --- mpv 0.26.0 --- - remove remaining deprecated audio device options, like --alsa-device Some of them were removed in earlier releases. diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 679736e867..3de554f07c 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -76,6 +76,18 @@ Track Selection to ``auto`` (the default), mpv will choose the first edition declared as a default, or if there is no default, the first edition defined. +``--track-auto-selection=<yes|no>`` + Enable the default track auto-selection (default: yes). Enabling this will + make the player select streams according to ``--aid``, ``--alang``, and + others. If it is disabled, no tracks are selected. In addition, the player + will not exit if no tracks are selected, and wait instead (this wait mode + is similar to pausing, but the pause option is not set). + + This is useful with ``--lavfi-complex``: you can start playback in this + mode, and then set select tracks at runtime by setting the filter graph. + Note that if ``--lavfi-complex`` is set before playback is started, the + referenced tracks are always selected. + Playback Control ---------------- diff --git a/options/options.c b/options/options.c index 30249467aa..3400f9ee96 100644 --- a/options/options.c +++ b/options/options.c @@ -361,6 +361,7 @@ const m_option_t mp_opts[] = { OPT_ALIAS("audio", "aid"), OPT_STRINGLIST("alang", stream_lang[STREAM_AUDIO], 0), OPT_STRINGLIST("slang", stream_lang[STREAM_SUB], 0), + OPT_FLAG("track-auto-selection", stream_auto_sel, 0), OPT_STRING("lavfi-complex", lavfi_complex, UPDATE_LAVFI_COMPLEX), @@ -921,6 +922,7 @@ const struct MPOpts mp_default_opts = { .stream_id_ff = { [STREAM_AUDIO] = -1, [STREAM_VIDEO] = -1, [STREAM_SUB] = -1, }, + .stream_auto_sel = 1, .audio_display = 1, .sub_visibility = 1, .sub_pos = 100, diff --git a/options/options.h b/options/options.h index 75884a290c..9ea09a83b3 100644 --- a/options/options.h +++ b/options/options.h @@ -212,6 +212,7 @@ typedef struct MPOpts { int stream_id[2][STREAM_TYPE_COUNT]; int stream_id_ff[STREAM_TYPE_COUNT]; char **stream_lang[STREAM_TYPE_COUNT]; + int stream_auto_sel; int audio_display; char **display_tags; int sub_visibility; diff --git a/player/loadfile.c b/player/loadfile.c index f0bb582b4f..311280d915 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -1269,7 +1269,7 @@ reopen_file: struct track *sel = NULL; bool taken = (t == STREAM_VIDEO && mpctx->vo_chain) || (t == STREAM_AUDIO && mpctx->ao_chain); - if (!taken) + if (!taken && opts->stream_auto_sel) sel = select_default_track(mpctx, i, t); mpctx->current_track[i][t] = sel; } @@ -1311,7 +1311,7 @@ reopen_file: reinit_audio_chain(mpctx); reinit_sub_all(mpctx); - if (!mpctx->vo_chain && !mpctx->ao_chain) { + if (!mpctx->vo_chain && !mpctx->ao_chain && opts->stream_auto_sel) { MP_FATAL(mpctx, "No video or audio streams selected.\n"); mpctx->error_playing = MPV_ERROR_NOTHING_TO_PLAY; goto terminate_playback; |