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

LibVideo: Implement accurate seeking to inter frames in PlaybackManager

This implements the PlaybackManager portion of seeking, so that it can
seek to any frame in the video by dropping all preceding frames until
it reaches the seek point.

MatroskaDemuxer currently will only seek to the start of the video.
That means that every seek has to drop all the frames until it comes
across the target timestamp.
This commit is contained in:
Zaggy1024 2022-11-14 00:54:21 -06:00 committed by Andreas Kling
parent 9a9fe08449
commit 5c2cede2c9
3 changed files with 65 additions and 24 deletions

View file

@ -53,15 +53,13 @@ DecoderErrorOr<MatroskaDemuxer::TrackStatus*> MatroskaDemuxer::get_track_status(
return &m_track_statuses.get(track).release_value();
}
DecoderErrorOr<void> MatroskaDemuxer::seek_to_most_recent_keyframe(Track track, Time timestamp)
DecoderErrorOr<void> MatroskaDemuxer::seek_to_most_recent_keyframe(Track track, Time)
{
if (timestamp.is_zero()) {
// Removing the track status will cause us to start from the beginning.
m_track_statuses.remove(track);
return {};
}
return DecoderError::not_implemented();
// Removing the track status will cause us to start from the beginning.
// FIXME: We just go back to the beginning always, so that the PlaybackManager seeking
// technology can be tested.
m_track_statuses.remove(track);
return {};
}
DecoderErrorOr<NonnullOwnPtr<Sample>> MatroskaDemuxer::get_next_sample_for_track(Track track)