diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2014-12-07 12:49:07 +0100 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2014-12-07 16:22:38 +0100 |
commit | f56fcd71bbf302595afc19b3a8291cd47f485cfc (patch) | |
tree | 7bac0792bb3e12f75db9e6dad3d7dec11aafae71 | |
parent | 3afe76133b184260db726269d6495b5bbf044b4d (diff) |
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.
-rw-r--r-- | DOCS/man/options.rst | 5 | ||||
-rw-r--r-- | options/options.c | 7 | ||||
-rw-r--r-- | player/loadfile.c | 2 |
3 files changed, 11 insertions, 3 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index ad5babb1f4..275f9d084a 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -333,11 +333,14 @@ Program Behavior 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. Mostly useful in slave mode, where mpv can be controlled through input 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>`` Specify configuration file to be parsed after the default ones. diff --git a/options/options.c b/options/options.c index 57cf20afa8..223c3ff666 100644 --- a/options/options.c +++ b/options/options.c @@ -541,7 +541,12 @@ const m_option_t mp_opts[] = { OPT_STRING("osd-msg2", osd_msg[1], 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_STRING("input-file", input_file, M_OPT_FILE | M_OPT_GLOBAL), diff --git a/player/loadfile.c b/player/loadfile.c index 5b04451667..d1b77743e6 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -1313,7 +1313,7 @@ void mp_play_files(struct MPContext *mpctx) mpctx->playlist->current_was_replaced = false; mpctx->stop_play = 0; - if (!mpctx->playlist->current && !mpctx->opts->player_idle_mode) + if (!mpctx->playlist->current && mpctx->opts->player_idle_mode < 2) break; } } |