mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-16 22:42:18 +00:00
LibGfx/ISOBMFF: Implement UserExtensionBox
.jpf (JPEG2000) files written by Photoshop contain a whole bunch of these boxes. fileformats.archiveteam.org/wiki/Boxes/atoms_format lists a few UUID types. Of those 3, these are in Photoshop-written .jpf files: * 0537cdab-9d0c-4431-a72a-fa561f2a113e Exif * 2c4c0100-8504-40b9-a03e-562148d6dfeb Photoshop Image Resource * be7acfcb-97a9-42e8-9c71-999491e3afac XMP
This commit is contained in:
parent
45fa6249df
commit
a971625c49
Notes:
sideshowbarker
2024-07-17 07:25:39 +09:00
Author: https://github.com/nico
Commit: a971625c49
Pull-request: https://github.com/SerenityOS/serenity/pull/23725
3 changed files with 33 additions and 0 deletions
|
@ -120,4 +120,28 @@ void SuperBox::dump(String const& prepend) const
|
||||||
child_box->dump(indented_prepend);
|
child_box->dump(indented_prepend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ErrorOr<void> UserExtensionBox::read_from_stream(BoxStream& stream)
|
||||||
|
{
|
||||||
|
// unsigned int(8)[16] uuid;
|
||||||
|
TRY(stream.read_until_filled(uuid));
|
||||||
|
// unsigned int(8) data[];
|
||||||
|
data = TRY(ByteBuffer::create_uninitialized(stream.remaining()));
|
||||||
|
TRY(stream.read_until_filled(data));
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserExtensionBox::dump(String const& prepend) const
|
||||||
|
{
|
||||||
|
Box::dump(prepend);
|
||||||
|
|
||||||
|
auto indented_prepend = add_indent(prepend);
|
||||||
|
|
||||||
|
out("{}- uuid = ", prepend);
|
||||||
|
for (auto byte : uuid)
|
||||||
|
out("{:02x}"sv, byte);
|
||||||
|
outln();
|
||||||
|
|
||||||
|
outln("{}- data = [ {} bytes ]", prepend, data.size());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,4 +106,11 @@ private:
|
||||||
BoxList m_child_boxes;
|
BoxList m_child_boxes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct UserExtensionBox final : public Box {
|
||||||
|
BOX_SUBTYPE(UserExtensionBox);
|
||||||
|
|
||||||
|
Array<u8, 16> uuid;
|
||||||
|
ByteBuffer data;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ ErrorOr<BoxList> Reader::read_entire_file()
|
||||||
return TRY(JPEG2000SignatureBox::create_from_stream(stream));
|
return TRY(JPEG2000SignatureBox::create_from_stream(stream));
|
||||||
case BoxType::JPEG2000UUIDInfoBox:
|
case BoxType::JPEG2000UUIDInfoBox:
|
||||||
return TRY(JPEG2000UUIDInfoBox::create_from_stream(stream));
|
return TRY(JPEG2000UUIDInfoBox::create_from_stream(stream));
|
||||||
|
case BoxType::UserExtensionBox:
|
||||||
|
return TRY(UserExtensionBox::create_from_stream(stream));
|
||||||
default:
|
default:
|
||||||
return OptionalNone {};
|
return OptionalNone {};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue