mirror of https://github.com/mpv-player/mpv
player: add --track-auto-selection option
I imagine this is useful. Or maybe it isn't.
This commit is contained in:
parent
b531332835
commit
c6628a5fb6
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
----------------
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue