1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-25 08:12:17 +00:00

options: add a 'once' idle mode

This allows to make mpv wait for file open events at start but close
after it is done playing the first playlist.
This commit is contained in:
Stefano Pigozzi 2014-12-07 12:49:07 +01:00
parent 3afe76133b
commit f56fcd71bb
3 changed files with 11 additions and 3 deletions

View File

@ -333,11 +333,14 @@ Program Behavior
This option is useful for debugging only. This option is useful for debugging only.
``--idle`` ``--idle=<no|yes|once>``
Makes mpv wait idly instead of quitting when there is no file to play. Makes mpv wait idly instead of quitting when there is no file to play.
Mostly useful in slave mode, where mpv can be controlled through input Mostly useful in slave mode, where mpv can be controlled through input
commands (see also ``--slave-broken``). commands (see also ``--slave-broken``).
``once`` will only idle at start and let the player close once the
first playlist has finished playing back.
``--include=<configuration-file>`` ``--include=<configuration-file>``
Specify configuration file to be parsed after the default ones. Specify configuration file to be parsed after the default ones.

View File

@ -541,7 +541,12 @@ const m_option_t mp_opts[] = {
OPT_STRING("osd-msg2", osd_msg[1], 0), OPT_STRING("osd-msg2", osd_msg[1], 0),
OPT_STRING("osd-msg3", osd_msg[2], 0), OPT_STRING("osd-msg3", osd_msg[2], 0),
OPT_FLAG("idle", player_idle_mode, M_OPT_GLOBAL), OPT_CHOICE("idle", player_idle_mode, M_OPT_OPTIONAL_PARAM,
({"no", 0},
{"once", 1},
{"yes", 2},
{"", 2})),
OPT_FLAG("input-terminal", consolecontrols, CONF_GLOBAL), OPT_FLAG("input-terminal", consolecontrols, CONF_GLOBAL),
OPT_STRING("input-file", input_file, M_OPT_FILE | M_OPT_GLOBAL), OPT_STRING("input-file", input_file, M_OPT_FILE | M_OPT_GLOBAL),

View File

@ -1313,7 +1313,7 @@ void mp_play_files(struct MPContext *mpctx)
mpctx->playlist->current_was_replaced = false; mpctx->playlist->current_was_replaced = false;
mpctx->stop_play = 0; mpctx->stop_play = 0;
if (!mpctx->playlist->current && !mpctx->opts->player_idle_mode) if (!mpctx->playlist->current && mpctx->opts->player_idle_mode < 2)
break; break;
} }
} }