mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-07 20:31:04 +03:00
LibGfx/ISOBMFF: Add JPEG2000CaptureResolutionBox
This commit is contained in:
parent
b386d5bb14
commit
4a95e55fb3
Notes:
sideshowbarker
2024-07-17 03:03:15 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/4a95e55fb3 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 ✅
@ -91,8 +91,10 @@ void JPEG2000ColorSpecificationBox::dump(String const& prepend) const
|
||||
|
||||
ErrorOr<void> JPEG2000ResolutionBox::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) {
|
||||
case BoxType::JPEG2000CaptureResolutionBox:
|
||||
return TRY(JPEG2000CaptureResolutionBox::create_from_stream(stream));
|
||||
default:
|
||||
return OptionalNone {};
|
||||
}
|
||||
@ -107,6 +109,24 @@ void JPEG2000ResolutionBox::dump(String const& prepend) const
|
||||
SuperBox::dump(prepend);
|
||||
}
|
||||
|
||||
ErrorOr<void> JPEG2000CaptureResolutionBox::read_from_stream(BoxStream& stream)
|
||||
{
|
||||
vertical_capture_grid_resolution_numerator = TRY(stream.read_value<BigEndian<u16>>());
|
||||
vertical_capture_grid_resolution_denominator = TRY(stream.read_value<BigEndian<u16>>());
|
||||
horizontal_capture_grid_resolution_numerator = TRY(stream.read_value<BigEndian<u16>>());
|
||||
horizontal_capture_grid_resolution_denominator = TRY(stream.read_value<BigEndian<u16>>());
|
||||
vertical_capture_grid_resolution_exponent = TRY(stream.read_value<i8>());
|
||||
horizontal_capture_grid_resolution_exponent = TRY(stream.read_value<i8>());
|
||||
return {};
|
||||
}
|
||||
|
||||
void JPEG2000CaptureResolutionBox::dump(String const& prepend) const
|
||||
{
|
||||
Box::dump(prepend);
|
||||
outln("{}- vertical_capture_grid_resolution = {}/{} * 10^{}", prepend, vertical_capture_grid_resolution_numerator, vertical_capture_grid_resolution_denominator, vertical_capture_grid_resolution_exponent);
|
||||
outln("{}- horizontal_capture_grid_resolution = {}/{} * 10^{}", prepend, horizontal_capture_grid_resolution_numerator, horizontal_capture_grid_resolution_denominator, horizontal_capture_grid_resolution_exponent);
|
||||
}
|
||||
|
||||
ErrorOr<void> JPEG2000SignatureBox::read_from_stream(BoxStream& stream)
|
||||
{
|
||||
signature = TRY(stream.read_value<BigEndian<u32>>());
|
||||
|
@ -43,6 +43,18 @@ struct JPEG2000ResolutionBox final : public SuperBox {
|
||||
BOX_SUBTYPE(JPEG2000ResolutionBox);
|
||||
};
|
||||
|
||||
// I.5.3.7.1 Capture Resolution box
|
||||
struct JPEG2000CaptureResolutionBox final : public Box {
|
||||
BOX_SUBTYPE(JPEG2000CaptureResolutionBox);
|
||||
|
||||
u16 vertical_capture_grid_resolution_numerator { 0 };
|
||||
u16 vertical_capture_grid_resolution_denominator { 0 };
|
||||
u16 horizontal_capture_grid_resolution_numerator { 0 };
|
||||
u16 horizontal_capture_grid_resolution_denominator { 0 };
|
||||
i8 vertical_capture_grid_resolution_exponent { 0 };
|
||||
i8 horizontal_capture_grid_resolution_exponent { 0 };
|
||||
};
|
||||
|
||||
struct JPEG2000SignatureBox final : public Box {
|
||||
BOX_SUBTYPE(JPEG2000SignatureBox);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user