From 7d137dc4802b9f83d7bde3217e1db18d9926e39d Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 22 Mar 2024 14:49:21 -0400 Subject: [PATCH] LibGfx/ISOBMFF: Add JPEG2000UUIDInfoBox --- .../ImageFormats/ISOBMFF/JPEG2000Boxes.cpp | 19 +++++++++++++++++++ .../ImageFormats/ISOBMFF/JPEG2000Boxes.h | 4 ++++ .../LibGfx/ImageFormats/ISOBMFF/Reader.cpp | 2 ++ 3 files changed, 25 insertions(+) diff --git a/Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/JPEG2000Boxes.cpp b/Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/JPEG2000Boxes.cpp index 41ef88283a1..122c290f47f 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/JPEG2000Boxes.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/JPEG2000Boxes.cpp @@ -99,4 +99,23 @@ void JPEG2000SignatureBox::dump(String const& prepend) const outln("{}- signature = {:#08x}", prepend, signature); } +ErrorOr JPEG2000UUIDInfoBox::read_from_stream(BoxStream& stream) +{ + auto make_subbox = [](BoxType type, BoxStream&) -> ErrorOr>> { + switch (type) { + default: + return OptionalNone {}; + } + }; + + TRY(SuperBox::read_from_stream(stream, move(make_subbox))); + return {}; +} + +void JPEG2000UUIDInfoBox::dump(String const& prepend) const +{ + SuperBox::dump(prepend); +} + + } diff --git a/Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/JPEG2000Boxes.h b/Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/JPEG2000Boxes.h index a35c5d7c57f..0a625dba10d 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/JPEG2000Boxes.h +++ b/Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/JPEG2000Boxes.h @@ -44,4 +44,8 @@ struct JPEG2000SignatureBox final : public Box { u32 signature { 0 }; }; +struct JPEG2000UUIDInfoBox final : public SuperBox { + BOX_SUBTYPE(JPEG2000UUIDInfoBox); +}; + } diff --git a/Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/Reader.cpp b/Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/Reader.cpp index 78c14997d88..8f5b513c7fb 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/Reader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/Reader.cpp @@ -31,6 +31,8 @@ ErrorOr Reader::read_entire_file() return TRY(JPEG2000HeaderBox::create_from_stream(stream)); case BoxType::JPEG2000SignatureBox: return TRY(JPEG2000SignatureBox::create_from_stream(stream)); + case BoxType::JPEG2000UUIDInfoBox: + return TRY(JPEG2000UUIDInfoBox::create_from_stream(stream)); default: return OptionalNone {}; }