LibGfx/ISOBMFF: Add JPEG2000ResolutionBox

This commit is contained in:
Nico Weber 2024-03-22 15:13:59 -04:00 committed by Tim Schumacher
parent 7d137dc480
commit b386d5bb14
2 changed files with 25 additions and 0 deletions

View file

@ -17,6 +17,8 @@ ErrorOr<void> JPEG2000HeaderBox::read_from_stream(BoxStream& stream)
return TRY(JPEG2000ColorSpecificationBox::create_from_stream(stream));
case BoxType::JPEG2000ImageHeaderBox:
return TRY(JPEG2000ImageHeaderBox::create_from_stream(stream));
case BoxType::JPEG2000ResolutionBox:
return TRY(JPEG2000ResolutionBox::create_from_stream(stream));
default:
return OptionalNone {};
}
@ -87,6 +89,24 @@ void JPEG2000ColorSpecificationBox::dump(String const& prepend) const
outln("{}- icc_data = {} bytes", prepend, icc_data.size());
}
ErrorOr<void> JPEG2000ResolutionBox::read_from_stream(BoxStream& stream)
{
auto make_subbox = [](BoxType type, BoxStream&) -> ErrorOr<Optional<NonnullOwnPtr<Box>>> {
switch (type) {
default:
return OptionalNone {};
}
};
TRY(SuperBox::read_from_stream(stream, move(make_subbox)));
return {};
}
void JPEG2000ResolutionBox::dump(String const& prepend) const
{
SuperBox::dump(prepend);
}
ErrorOr<void> JPEG2000SignatureBox::read_from_stream(BoxStream& stream)
{
signature = TRY(stream.read_value<BigEndian<u32>>());

View file

@ -38,6 +38,11 @@ struct JPEG2000ColorSpecificationBox final : public Box {
ByteBuffer icc_data; // Only set if method == 2
};
// I.5.3.7 Resolution box
struct JPEG2000ResolutionBox final : public SuperBox {
BOX_SUBTYPE(JPEG2000ResolutionBox);
};
struct JPEG2000SignatureBox final : public Box {
BOX_SUBTYPE(JPEG2000SignatureBox);