player: change --keep-open semantics

By popular request.
This commit is contained in:
wm4 2014-09-24 01:56:53 +02:00
parent 53c288d364
commit 735a9c39d7
2 changed files with 11 additions and 2 deletions

View File

@ -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

View File

@ -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;