mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:27:35 +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:
parent
f4c476b26f
commit
393cfdd5c5
11 changed files with 576 additions and 310 deletions
|
@ -9,8 +9,12 @@
|
|||
|
||||
extern "C" int LLVMFuzzerTestOneInput(u8 const* data, size_t size)
|
||||
{
|
||||
auto matroska_document = Video::Matroska::Reader::parse_matroska_from_data(data, size);
|
||||
if (!matroska_document)
|
||||
auto matroska_reader_result = Video::Matroska::Reader::from_data({ data, size });
|
||||
if (matroska_reader_result.is_error())
|
||||
return -1;
|
||||
if (auto result = matroska_reader_result.value().segment_information(); result.is_error())
|
||||
return -1;
|
||||
if (auto result = matroska_reader_result.value().track_count(); result.is_error())
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue