From fd3ffd88cecd059eaf36cef1814cbe805361c564 Mon Sep 17 00:00:00 2001 From: Zaggy1024 Date: Sun, 13 Nov 2022 20:33:23 -0600 Subject: [PATCH] LibVideo: Add a fast seeking mode to seek only to keyframes Now that we're able to find the nearest keyframe, we can have a fast seeking mode that only seeks to keyframes, so that it doesn't have to also decode inter frames until it reaches the timestamp. The default is still accurate seeking, so that the entire seeking implementation can be tested. --- Userland/Libraries/LibVideo/Containers/Demuxer.h | 3 ++- .../LibVideo/Containers/Matroska/MatroskaDemuxer.cpp | 7 ++++--- .../LibVideo/Containers/Matroska/MatroskaDemuxer.h | 2 +- Userland/Libraries/LibVideo/PlaybackManager.cpp | 5 ++++- Userland/Libraries/LibVideo/PlaybackManager.h | 11 +++++++++++ 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibVideo/Containers/Demuxer.h b/Userland/Libraries/LibVideo/Containers/Demuxer.h index dacc121678..1a2d2355d2 100644 --- a/Userland/Libraries/LibVideo/Containers/Demuxer.h +++ b/Userland/Libraries/LibVideo/Containers/Demuxer.h @@ -28,7 +28,8 @@ public: return sample.release_nonnull(); } - virtual DecoderErrorOr seek_to_most_recent_keyframe(Track track, Time timestamp) = 0; + // Returns the timestamp of the keyframe that was seeked to. + virtual DecoderErrorOr