mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:07:46 +00:00
LibGfx: Add initial ISO BMFF parsing and a utility to print file info
Currently, the `isobmff` utility will only print the media file type info from the FileTypeBox (major brand and compatible brands), as well as the names and sizes of top-level boxes.
This commit is contained in:
parent
9caa0bda7d
commit
66c9696687
13 changed files with 510 additions and 0 deletions
28
Userland/Utilities/isobmff.cpp
Normal file
28
Userland/Utilities/isobmff.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Gregory Bertilson <Zaggy1024@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/MemoryStream.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibGfx/ImageFormats/ISOBMFF/Reader.h>
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
Core::ArgsParser args_parser;
|
||||
|
||||
StringView path;
|
||||
args_parser.add_positional_argument(path, "Path to ISO Base Media File Format file", "FILE");
|
||||
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto file = TRY(Core::MappedFile::map(path));
|
||||
auto reader = TRY(Gfx::ISOBMFF::Reader::create(TRY(try_make<FixedMemoryStream>(file->bytes()))));
|
||||
auto boxes = TRY(reader.read_entire_file());
|
||||
|
||||
for (auto& box : boxes)
|
||||
box->dump();
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue