mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user