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

LibVideo: Propagate decoder errors in the Matroska Reader

Matroska::Reader functions now return DecoderErrorOr instead of values
being declared Optional. Useful errors can be handled by the users of
the parser, similarly to the VP9 decoder. A lot of the error checking
in the reader is a lot cleaner thanks to this change, since all reads
can be range checked in Streamer::read_octet() now.

Most functions for the Streamer class are now also out-of-line in
Reader.cpp now instead of residing in the header.
This commit is contained in:
Zaggy1024 2022-11-09 23:38:50 -06:00 committed by Andreas Kling
parent 9cf7e8c5aa
commit 2dfd236dcd
6 changed files with 338 additions and 440 deletions

View file

@ -11,8 +11,7 @@
static void decode_video(StringView path, size_t expected_frame_count)
{
auto matroska_document = Video::Matroska::Reader::parse_matroska_from_file(path);
VERIFY(matroska_document);
auto matroska_document = MUST(Video::Matroska::Reader::parse_matroska_from_file(path));
auto video_track_optional = matroska_document->track_for_track_type(Video::Matroska::TrackEntry::TrackType::Video);
VERIFY(video_track_optional.has_value());
auto video_track_entry = video_track_optional.value();