diff options
author | Dudemanguy <random342@airmail.cc> | 2022-05-12 21:58:12 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2022-05-14 14:51:42 +0000 |
commit | 94677723624fb84756e65c8f1377956667244bc9 (patch) | |
tree | 2625c051783bc3620d640d132852eb19edd672b4 | |
parent | fe9e074752da1352e970dce5afcfdc3d30bfb7e2 (diff) | |
download | mpv-94677723624fb84756e65c8f1377956667244bc9.tar.bz2 mpv-94677723624fb84756e65c8f1377956667244bc9.tar.xz |
player: set EOF when seeking to end with keep-open
Normally with the keep-open option, mpv is supposed to set the
eof-reached property to true so clients can possibly do interesting
things at this step. However, there was actually an edge case where this
property notification did not occur. If you use keep-open and then seek
in the file past the end (so mpv stops), property notification is not
actually sent in this case. Internally, mpv does a very exact seek at
this step which also ends playback, but it does not set STATUS_EOF to
the ao and vo before the core idle state is updated. To fix this edge
case, it's simply just a matter of explictly setting STATUS_EOF after
seek_to_last_frame in handle_keep_open. This logic will only ever
trigger if keep-open is being used and the seek goes past the end of the
file, so we know that there will always be an EOF here.
-rw-r--r-- | player/playloop.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/player/playloop.c b/player/playloop.c index c0db53f294..91badf0647 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -947,8 +947,11 @@ static void handle_keep_open(struct MPContext *mpctx) { mpctx->stop_play = KEEP_PLAYING; if (mpctx->vo_chain) { - if (!vo_has_frame(mpctx->video_out)) // EOF not reached normally + if (!vo_has_frame(mpctx->video_out)) { // EOF not reached normally seek_to_last_frame(mpctx); + mpctx->audio_status = STATUS_EOF; + mpctx->video_status = STATUS_EOF; + } } if (opts->keep_open_pause) { if (mpctx->ao && ao_is_playing(mpctx->ao)) |