mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
LibGfx/ISOBMFF: Add JPEG2000UUIDListBox
This commit is contained in:
parent
4a95e55fb3
commit
f372a9b346
Notes:
sideshowbarker
2024-07-16 22:24:48 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/f372a9b346 Pull-request: https://github.com/SerenityOS/serenity/pull/23682 Reviewed-by: https://github.com/LucasChollet Reviewed-by: https://github.com/Zaggy1024 Reviewed-by: https://github.com/timschumi ✅
2 changed files with 33 additions and 1 deletions
|
@ -141,8 +141,10 @@ void JPEG2000SignatureBox::dump(String const& prepend) const
|
||||||
|
|
||||||
ErrorOr<void> JPEG2000UUIDInfoBox::read_from_stream(BoxStream& stream)
|
ErrorOr<void> JPEG2000UUIDInfoBox::read_from_stream(BoxStream& stream)
|
||||||
{
|
{
|
||||||
auto make_subbox = [](BoxType type, BoxStream&) -> ErrorOr<Optional<NonnullOwnPtr<Box>>> {
|
auto make_subbox = [](BoxType type, BoxStream& stream) -> ErrorOr<Optional<NonnullOwnPtr<Box>>> {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
case BoxType::JPEG2000UUIDListBox:
|
||||||
|
return TRY(JPEG2000UUIDListBox::create_from_stream(stream));
|
||||||
default:
|
default:
|
||||||
return OptionalNone {};
|
return OptionalNone {};
|
||||||
}
|
}
|
||||||
|
@ -157,5 +159,27 @@ void JPEG2000UUIDInfoBox::dump(String const& prepend) const
|
||||||
SuperBox::dump(prepend);
|
SuperBox::dump(prepend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ErrorOr<void> JPEG2000UUIDListBox::read_from_stream(BoxStream& stream)
|
||||||
|
{
|
||||||
|
u16 count = TRY(stream.read_value<BigEndian<u16>>());
|
||||||
|
for (u32 i = 0; i < count; ++i) {
|
||||||
|
Array<u8, 16> uuid;
|
||||||
|
TRY(stream.read_until_filled(uuid));
|
||||||
|
uuids.append(uuid);
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
void JPEG2000UUIDListBox::dump(String const& prepend) const
|
||||||
|
{
|
||||||
|
Box::dump(prepend);
|
||||||
|
for (auto const& uuid : uuids) {
|
||||||
|
out("{}- ", prepend);
|
||||||
|
for (auto byte : uuid) {
|
||||||
|
out("{:02x}", byte);
|
||||||
|
}
|
||||||
|
outln();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,8 +61,16 @@ struct JPEG2000SignatureBox final : public Box {
|
||||||
u32 signature { 0 };
|
u32 signature { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// I.7.3 UUID Info boxes (superbox)
|
||||||
struct JPEG2000UUIDInfoBox final : public SuperBox {
|
struct JPEG2000UUIDInfoBox final : public SuperBox {
|
||||||
BOX_SUBTYPE(JPEG2000UUIDInfoBox);
|
BOX_SUBTYPE(JPEG2000UUIDInfoBox);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// I.7.3.1 UUID List box
|
||||||
|
struct JPEG2000UUIDListBox final : public Box {
|
||||||
|
BOX_SUBTYPE(JPEG2000UUIDListBox);
|
||||||
|
|
||||||
|
Vector<Array<u8, 16>> uuids;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue