From a3bd8c3b5f84c5d48785552fc7bd2505ee839736 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 7 Feb 2020 13:32:07 +0100 Subject: player: make screenshot each-frame mode more accurate Due to asynchronicity, we generally can't guarantee that a video frame matches up with other events such as playback time change exactly (since decoding, presentation, and property update all happen at different times). This is a complaint in the referenced bug report, where screenshot filenames in each-frame screenshot did not use the correct timestamp, and instead was lagging behind by 1 frame. But in this case, synchronicity was already pretty much forced with wait calls. The only problem was that the playback time was updated at a later time, which results in the observed 1 frame lag. Fix this by moving the place where the screenshot is triggered in this mode. Normal screenshots may still have the old problem. There is no effort made to guarantee the timestamps absolutely line up, same as with the OSD. (If you want a guarantee, you need to use a video filter, such as libavfilter's drawtext. These will obviously use the proper timestamp, instead of going through the somewhat asynchronous property etc. system in the player frontend.) Fixes: #7433 --- player/playloop.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'player/playloop.c') diff --git a/player/playloop.c b/player/playloop.c index 7b5a2f6d45..86f19fd79f 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -49,6 +49,7 @@ #include "core.h" #include "client.h" #include "command.h" +#include "screenshot.h" // Wait until mp_wakeup_core() is called, since the last time // mp_wait_events() was called. @@ -1226,6 +1227,8 @@ void run_playloop(struct MPContext *mpctx) if (mpctx->video_status == STATUS_EOF) update_subtitles(mpctx, mpctx->playback_pts); + handle_each_frame_screenshot(mpctx); + handle_eof(mpctx); handle_loop_file(mpctx); -- cgit v1.2.3