1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:27:45 +00:00

VideoPlayer/LibVideo: Seek accurately when scrolling in the seek bar

Fast seeking does not work correctly when seeking in small increments,
so it is necessary to use accurate seeking when using certain actions.

The PlaybackManager has been changed to accept the seek mode as a
parameter to `seek_to_timestamp` to facilitate this. This now means
that it no longer has to track a seek mode preference.
This commit is contained in:
Zaggy1024 2023-02-06 04:11:32 -06:00 committed by Andreas Kling
parent 1f650088a0
commit b0db56cd39
4 changed files with 6 additions and 21 deletions

View file

@ -98,15 +98,12 @@ public:
void resume_playback();
void pause_playback();
void restart_playback();
void seek_to_timestamp(Time);
void seek_to_timestamp(Time, SeekMode = DEFAULT_SEEK_MODE);
bool is_playing() const
{
return m_playback_handler->is_playing();
}
SeekMode seek_mode() { return m_seek_mode; }
void set_seek_mode(SeekMode mode) { m_seek_mode = mode; }
u64 number_of_skipped_frames() const { return m_skipped_frames; }
void on_decoder_error(DecoderError error);
@ -140,8 +137,6 @@ private:
Time m_last_present_in_media_time = Time::zero();
SeekMode m_seek_mode = DEFAULT_SEEK_MODE;
NonnullOwnPtr<Demuxer> m_demuxer;
Track m_selected_video_track;
NonnullOwnPtr<VideoDecoder> m_decoder;