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

LibVideo: Implement Matroska keyframe search for when there are no Cues

This just searches sequentially through each block in a SampleIterator
until it finds a block after the specified seek timestamp. Once it
finds one, it will try to set the input/output iterator to the most
recent keyframe. If the iterator's original position is closer to the
target, however, it leaves it at that original position, allowing
callers to continue decoding from that position until they reach the
target timestamp.
This commit is contained in:
Zaggy1024 2022-11-12 04:04:13 -06:00 committed by Andreas Kling
parent 9040194d54
commit eef8867d9e
3 changed files with 67 additions and 9 deletions

View file

@ -75,6 +75,7 @@ class SampleIterator {
public:
DecoderErrorOr<Block> next_block();
Cluster const& current_cluster() { return *m_current_cluster; }
Time const& last_timestamp() { return m_last_timestamp; }
private:
friend class Reader;
@ -98,6 +99,7 @@ private:
size_t m_position { 0 };
u64 m_timestamp_scale { 0 };
Time m_last_timestamp { Time::min() };
Optional<Cluster> m_current_cluster;
};