1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:17:44 +00:00

LibVideo: Read Matroska lazily so that large files can start quickly

The Demuxer class was changed to return errors for more functions so
that all of the underlying reading can be done lazily. Other than that,
the demuxer interface is unchanged, and only the underlying reader was
modified.

The MatroskaDocument class is no more, and MatroskaReader's getter
functions replace it. Every MatroskaReader getter beyond the Segment
element's position is parsed lazily from the file as needed. This means
that all getter functions can return DecoderErrors which must be
handled by callers.
This commit is contained in:
Zaggy1024 2022-11-11 17:14:27 -06:00 committed by Andreas Kling
parent f4c476b26f
commit 393cfdd5c5
11 changed files with 576 additions and 310 deletions

View file

@ -21,7 +21,7 @@ public:
class VideoSample : public Sample {
public:
VideoSample(ByteBuffer const& data, CodingIndependentCodePoints container_cicp, Time timestamp)
VideoSample(ReadonlyBytes data, CodingIndependentCodePoints container_cicp, Time timestamp)
: m_data(data)
, m_container_cicp(container_cicp)
, m_timestamp(timestamp)
@ -29,12 +29,12 @@ public:
}
bool is_video_sample() const override { return true; }
ByteBuffer const& data() const { return m_data; }
ReadonlyBytes const& data() const { return m_data; }
CodingIndependentCodePoints container_cicp() const { return m_container_cicp; }
Time timestamp() const { return m_timestamp; }
private:
ByteBuffer m_data;
ReadonlyBytes m_data;
CodingIndependentCodePoints m_container_cicp;
Time m_timestamp;
};