player: add --keep-open-pause=no option

Instead of pausing if --keep-open is active, stop
at end but continue playing if seeking backwards.
And then stop again when end is reached.

Signed-off-by: wm4 <wm4@nowhere>

Over the PR, the option was renamed, and the manpage additions were
slightly changed/enhanced.
This commit is contained in:
Dan Oscarsson 2017-03-27 11:34:02 +02:00 committed by wm4
parent 7b84297699
commit ae0a40259f
5 changed files with 13 additions and 1 deletions

View File

@ -43,6 +43,7 @@ Interface changes
moved to "somewhere else" syntax-wise. moved to "somewhere else" syntax-wise.
- deprecate --loop - after a deprecation period, it will be undeprecated, - deprecate --loop - after a deprecation period, it will be undeprecated,
but changed to alias --loop-file but changed to alias --loop-file
- add --keep-open-pause=no
--- mpv 0.24.0 --- --- mpv 0.24.0 ---
- deprecate --hwdec-api and replace it with --opengl-hwdec-interop. - deprecate --hwdec-api and replace it with --opengl-hwdec-interop.
The new option accepts both --hwdec values, as well as named backends. The new option accepts both --hwdec values, as well as named backends.

View File

@ -2070,6 +2070,9 @@ Window
Instead, pause the player. When trying to seek beyond end of the file, the Instead, pause the player. When trying to seek beyond end of the file, the
player will attempt to seek to the last frame. player will attempt to seek to the last frame.
Normally, this will act like ``set pause yes`` on EOF, unless the
``--keep-open-pause=no`` option is set.
The following arguments can be given: The following arguments can be given:
:no: If the current file ends, go to the next file or terminate. :no: If the current file ends, go to the next file or terminate.
@ -2096,6 +2099,11 @@ Window
file.mkv normally, then fail to open ``/dev/null``, then exit). (In file.mkv normally, then fail to open ``/dev/null``, then exit). (In
mpv 0.8.0, ``always`` was introduced, which restores the old behavior.) mpv 0.8.0, ``always`` was introduced, which restores the old behavior.)
``--keep-open-pause=<yes|no>``
If set to ``no``, instead of pausing when ``--keep-open`` is active, just
stop at end of file and continue playing forward when you seek backwards
until end where it stops again. Default: ``yes``.
``--image-display-duration=<seconds|inf>`` ``--image-display-duration=<seconds|inf>``
If the current file is an image, play the image for the given amount of If the current file is an image, play the image for the given amount of
seconds (default: 1). ``inf`` means the file is kept open forever (until seconds (default: 1). ``inf`` means the file is kept open forever (until

View File

@ -354,6 +354,7 @@ const m_option_t mp_opts[] = {
({"no", 0}, ({"no", 0},
{"yes", 1}, {"yes", 1},
{"always", 2})), {"always", 2})),
OPT_FLAG("keep-open-pause", keep_open_pause, 0),
OPT_DOUBLE("image-display-duration", image_display_duration, OPT_DOUBLE("image-display-duration", image_display_duration,
M_OPT_RANGE, 0, INFINITY), M_OPT_RANGE, 0, INFINITY),
@ -911,6 +912,7 @@ const struct MPOpts mp_default_opts = {
.play_frames = -1, .play_frames = -1,
.rebase_start_time = 1, .rebase_start_time = 1,
.keep_open = 0, .keep_open = 0,
.keep_open_pause = 1,
.image_display_duration = 1.0, .image_display_duration = 1.0,
.stream_id = { { [STREAM_AUDIO] = -1, .stream_id = { { [STREAM_AUDIO] = -1,
[STREAM_VIDEO] = -1, [STREAM_VIDEO] = -1,

View File

@ -200,6 +200,7 @@ typedef struct MPOpts {
char *watch_later_directory; char *watch_later_directory;
int pause; int pause;
int keep_open; int keep_open;
int keep_open_pause;
double image_display_duration; double image_display_duration;
char *lavfi_complex; char *lavfi_complex;
int stream_id[2][STREAM_TYPE_COUNT]; int stream_id[2][STREAM_TYPE_COUNT];

View File

@ -831,7 +831,7 @@ static void handle_keep_open(struct MPContext *mpctx)
seek_to_last_frame(mpctx); seek_to_last_frame(mpctx);
mpctx->playback_pts = mpctx->last_vo_pts; mpctx->playback_pts = mpctx->last_vo_pts;
} }
if (!mpctx->opts->pause) if (opts->keep_open_pause && !mpctx->opts->pause)
pause_player(mpctx); pause_player(mpctx);
} }
} }