diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 33431a03e7..70a11e7cc3 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -1430,7 +1430,8 @@ Window See also ``--screen``. ``--keep-open`` - Do not terminate when playing or seeking beyond the end of the file. + Do not terminate when playing or seeking beyond the end of the file, and + there is not next file to be played (and ``--loop`` is not used). Instead, pause the player. When trying to seek beyond end of the file, the player will pause at an arbitrary playback position (or, in corner cases, not redraw the window at all). @@ -1443,6 +1444,12 @@ Window chapter will terminate playback as well, even if ``--keep-open`` is given. + Since mpv 0.6.0, this doesn't pause if there is a next file in the playlist, + or the playlist is looped. Approximately, this will pause when the player + would normally exit, but in practice there are corner cases in which this + is not the case (e.g. ``mpv --keep-open file.mkv /dev/null`` will play + file.mkv normally, then fail to open ``/dev/null``, then exit). + ``--force-window`` Create a video output window even if there is no video. This can be useful when pretending that mpv is a GUI application. Currently, the window diff --git a/player/playloop.c b/player/playloop.c index fc3259de01..d5c3ac0713 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -764,7 +764,9 @@ static void handle_loop_file(struct MPContext *mpctx) static void handle_keep_open(struct MPContext *mpctx) { struct MPOpts *opts = mpctx->opts; - if (opts->keep_open && mpctx->stop_play == AT_END_OF_FILE) { + if (opts->keep_open && mpctx->stop_play == AT_END_OF_FILE && + !playlist_get_next(mpctx->playlist, 1) && opts->loop_times < 0) + { mpctx->stop_play = KEEP_PLAYING; if (mpctx->d_video) mpctx->playback_pts = mpctx->last_vo_pts;