mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
LibVideo: Implement Matroska Cues for faster keyframe lookup
This implements the fastest seeking mode available for tracks with cues using an array of cue points for each track. It approximates the index based on the seeking timestamp and then finds the earliest cue point before the timestamp. The approximation assumes that cues will be on a regular interval, which I don't believe is always the case, but it should at least be faster than iterating the whole set of cue points each time. Cues are stored per track, but most videos will only have cue points for the video track(s) that are present. For now, this assumes that it should only seek based on the cue points for the selected track. To seek audio in a video file, we should copy the seeked iterator over to the audio track's iterator after seeking is complete. The iterator will then skip to the next audio block.
This commit is contained in:
parent
56d8b96c78
commit
f6830eaf73
5 changed files with 288 additions and 2 deletions
|
@ -121,7 +121,7 @@ void PlaybackManager::on_decoder_error(DecoderError error)
|
|||
|
||||
void PlaybackManager::end_seek()
|
||||
{
|
||||
dbgln_if(PLAYBACK_MANAGER_DEBUG, "We've finished seeking, reset seek target and play");
|
||||
dbgln_if(PLAYBACK_MANAGER_DEBUG, "We've finished seeking, set media time to seek time at {}ms and change status", m_seek_to_media_time.to_milliseconds());
|
||||
VERIFY(!m_seek_to_media_time.is_negative());
|
||||
m_last_present_in_media_time = m_seek_to_media_time;
|
||||
m_seek_to_media_time = Time::min();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue