LibGfx/ISOBMFF: Start creating JPEG2000 box types
`isobmff` can now dump the id in a JPEG2000SignatureBox. Creates JPEG2000Boxes.{h,cpp} to house JPEG2000 box types.
This commit is contained in:
parent
a073b2d047
commit
65bd090815
Notes:
sideshowbarker
2024-07-17 05:58:46 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/65bd090815 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 ✅
5 changed files with 49 additions and 0 deletions
|
@ -72,6 +72,7 @@ shared_library("LibGfx") {
|
|||
"ImageFormats/ICOLoader.cpp",
|
||||
"ImageFormats/ILBMLoader.cpp",
|
||||
"ImageFormats/ISOBMFF/Boxes.cpp",
|
||||
"ImageFormats/ISOBMFF/JPEG2000Boxes.cpp",
|
||||
"ImageFormats/ISOBMFF/Reader.cpp",
|
||||
"ImageFormats/ImageDecoder.cpp",
|
||||
"ImageFormats/JBIG2Loader.cpp",
|
||||
|
|
|
@ -46,6 +46,7 @@ set(SOURCES
|
|||
ImageFormats/ILBMLoader.cpp
|
||||
ImageFormats/ImageDecoder.cpp
|
||||
ImageFormats/ISOBMFF/Boxes.cpp
|
||||
ImageFormats/ISOBMFF/JPEG2000Boxes.cpp
|
||||
ImageFormats/ISOBMFF/Reader.cpp
|
||||
ImageFormats/JBIG2Loader.cpp
|
||||
ImageFormats/JPEGLoader.cpp
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Nico Weber <thakis@chromium.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "JPEG2000Boxes.h"
|
||||
|
||||
namespace Gfx::ISOBMFF {
|
||||
|
||||
ErrorOr<void> JPEG2000SignatureBox::read_from_stream(BoxStream& stream)
|
||||
{
|
||||
signature = TRY(stream.read_value<BigEndian<u32>>());
|
||||
return {};
|
||||
}
|
||||
|
||||
void JPEG2000SignatureBox::dump(String const& prepend) const
|
||||
{
|
||||
Box::dump(prepend);
|
||||
outln("{}- signature = {:#08x}", prepend, signature);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Nico Weber <thakis@chromium.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Boxes.h"
|
||||
|
||||
namespace Gfx::ISOBMFF {
|
||||
|
||||
struct JPEG2000SignatureBox final : public Box {
|
||||
BOX_SUBTYPE(JPEG2000SignatureBox);
|
||||
|
||||
u32 signature { 0 };
|
||||
};
|
||||
|
||||
}
|
|
@ -5,6 +5,8 @@
|
|||
*/
|
||||
|
||||
#include "Reader.h"
|
||||
#include "JPEG2000Boxes.h"
|
||||
#include <AK/Function.h>
|
||||
|
||||
namespace Gfx::ISOBMFF {
|
||||
|
||||
|
@ -34,6 +36,9 @@ ErrorOr<BoxList> Reader::read_entire_file()
|
|||
case BoxType::JPEG2000HeaderBox:
|
||||
TRY(top_level_boxes.try_append(TRY(SuperBox::create_from_stream(box_header.type, box_stream))));
|
||||
break;
|
||||
case BoxType::JPEG2000SignatureBox:
|
||||
TRY(top_level_boxes.try_append(TRY(JPEG2000SignatureBox::create_from_stream(box_stream))));
|
||||
break;
|
||||
default:
|
||||
TRY(top_level_boxes.try_append(TRY(UnknownBox::create_from_stream(box_header.type, box_stream))));
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue