From 735a9c39d7bb7842e92eb04de3ad2eb1a93588ee Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 24 Sep 2014 01:56:53 +0200 Subject: player: change --keep-open semantics By popular request. --- DOCS/man/options.rst | 9 ++++++++- player/playloop.c | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) 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; -- cgit v1.2.3