mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:04:59 +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:
parent
9cf7e8c5aa
commit
2dfd236dcd
6 changed files with 338 additions and 440 deletions
|
@ -10,10 +10,12 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments)
|
||||
{
|
||||
auto document = Video::Matroska::Reader::parse_matroska_from_file("/home/anon/Videos/test-webm.webm"sv);
|
||||
if (!document) {
|
||||
auto document_result = Video::Matroska::Reader::parse_matroska_from_file("/home/anon/Videos/test-webm.webm"sv);
|
||||
if (document_result.is_error()) {
|
||||
outln("Encountered an error during parsing: {}", document_result.release_error().string_literal());
|
||||
return Error::from_string_literal("Failed to parse :(");
|
||||
}
|
||||
auto document = document_result.release_value();
|
||||
|
||||
outln("DocType is {}", document->header().doc_type.characters());
|
||||
outln("DocTypeVersion is {}", document->header().doc_type_version);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue