Skip to content

Commit 666aa16

Browse files
committed
JXL: Parse Exif and XMP
1 parent c75d2c8 commit 666aa16

File tree

3 files changed

+74
-1
lines changed

3 files changed

+74
-1
lines changed

Source/MediaInfo/Multiple/File_Mpeg4.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,18 @@ private :
7777
//Elements
7878
void bloc();
7979
void cdat();
80+
void Exif();
8081
void cdt2() {cdat();}
8182
void free();
8283
void ftyp();
84+
void hrgm();
8385
void idat();
8486
void idsc();
8587
void jp2c();
8688
void jp2h();
8789
void jp2h_colr();
8890
void jp2h_ihdr();
91+
void JXL_();
8992
void jp2h_ricc() {jp2h_colr(); }
9093
void mdat();
9194
void mdat_xxxx();
@@ -416,6 +419,7 @@ private :
416419
void skip();
417420
void sidx();
418421
void wide();
422+
void xml_();
419423

420424
//Helpers
421425
Ztring Language_Get(int16u Language);

Source/MediaInfo/Multiple/File_Mpeg4_Elements.cpp

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,7 @@ namespace Elements
705705
const int64u bloc=0x626C6F63;
706706
const int64u cdat=0x63646174;
707707
const int64u cdt2=0x63647432;
708+
const int64u Exif=0x45786966;
708709
const int64u free=0x66726565;
709710
const int64u ftyp=0x66747970;
710711
const int64u ftyp_qt=0x71742020;
@@ -715,13 +716,15 @@ namespace Elements
715716
const int64u ftyp_dash=0x64617368;
716717
const int64u ftyp_isom=0x69736F6D;
717718
const int64u ftyp_caqv=0x63617176;
719+
const int64u hrgm=0x6872676D;
718720
const int64u idat=0x69646174;
719721
const int64u idsc=0x69647363;
720722
const int64u jp2c=0x6A703263;
721723
const int64u jp2h=0x6A703268;
722724
const int64u jp2h_colr=0x636F6C72;
723725
const int64u jp2h_ihdr=0x69686472;
724726
const int64u jp2h_ricc=0x72696363;
727+
const int64u JXL_=0x4A584C20;
725728
const int64u mdat=0x6D646174;
726729
const int64u meta=0x6D657461;
727730
const int64u meta_grpl=0x6772706C;
@@ -1086,6 +1089,7 @@ namespace Elements
10861089
const int64u skip=0x736B6970;
10871090
const int64u sidx=0x73696478;
10881091
const int64u wide=0x77696465;
1092+
const int64u xml_=0x786D6C20;
10891093
}
10901094

10911095
//---------------------------------------------------------------------------
@@ -1126,8 +1130,10 @@ void File_Mpeg4::Data_Parse()
11261130
ATOM(bloc)
11271131
ATOM(cdat)
11281132
ATOM(cdt2)
1133+
ATOM(Exif)
11291134
LIST_SKIP(free)
11301135
ATOM(ftyp)
1136+
ATOM(hrgm)
11311137
ATOM(idat)
11321138
ATOM(idsc)
11331139
ATOM(jp2c)
@@ -1137,6 +1143,7 @@ void File_Mpeg4::Data_Parse()
11371143
ATOM(jp2h_ihdr)
11381144
ATOM(jp2h_ricc)
11391145
ATOM_END
1146+
ATOM(JXL_)
11401147
LIST(mdat)
11411148
ATOM_DEFAULT_ALONE(mdat_xxxx)
11421149
LIST(meta)
@@ -1586,6 +1593,7 @@ void File_Mpeg4::Data_Parse()
15861593
LIST_SKIP(skip)
15871594
ATOM(sidx)
15881595
LIST_SKIP(wide)
1596+
ATOM(xml_)
15891597
DATA_END
15901598
}
15911599

@@ -1745,6 +1753,29 @@ void File_Mpeg4::cdat()
17451753
}
17461754
}
17471755

1756+
//---------------------------------------------------------------------------
1757+
void File_Mpeg4::Exif()
1758+
{
1759+
Element_Name("Exif box");
1760+
1761+
//Parsing
1762+
#if defined(MEDIAINFO_EXIF_YES)
1763+
File_Exif MI{};
1764+
MI.FromHeif = true;
1765+
Open_Buffer_Init(&MI);
1766+
Open_Buffer_Continue(&MI);
1767+
Open_Buffer_Finalize(&MI);
1768+
Merge(MI, Stream_General, 0, 0, false);
1769+
Merge(MI, Stream_Image, 0, 0, false);
1770+
size_t Count = MI.Count_Get(Stream_Image);
1771+
for (size_t i = 1; i < Count; ++i) {
1772+
Merge(MI, Stream_Image, i, StreamPos_Last + 1, false);
1773+
}
1774+
#else
1775+
Skip_UTF8(Element_Size - Element_Offset, "EXIF Tags");
1776+
#endif
1777+
}
1778+
17481779
//---------------------------------------------------------------------------
17491780
void File_Mpeg4::free()
17501781
{
@@ -1839,6 +1870,13 @@ void File_Mpeg4::ftyp()
18391870
FILLING_END();
18401871
}
18411872

1873+
//---------------------------------------------------------------------------
1874+
void File_Mpeg4::hrgm()
1875+
{
1876+
Element_Name("HDR Gain Map");
1877+
Skip_XX(Element_Size, "Data");
1878+
}
1879+
18421880
//---------------------------------------------------------------------------
18431881
void File_Mpeg4::idat()
18441882
{
@@ -2006,6 +2044,18 @@ void File_Mpeg4::jp2h_ihdr()
20062044
FILLING_END()
20072045
}
20082046

2047+
//---------------------------------------------------------------------------
2048+
void File_Mpeg4::JXL_()
2049+
{
2050+
Element_Name("JPEG XL Signature box");
2051+
int32u signature;
2052+
Get_B4(signature, "Signature");
2053+
FILLING_BEGIN_PRECISE()
2054+
if (signature == 0x0D0A870A)
2055+
Fill(Stream_General, 0, General_Format, "JPEG XL");
2056+
FILLING_END()
2057+
}
2058+
20092059
//---------------------------------------------------------------------------
20102060
void File_Mpeg4::mdat()
20112061
{
@@ -11319,6 +11369,25 @@ void File_Mpeg4::wide()
1131911369
Skip_XX(Element_Size, "Free");
1132011370
}
1132111371

11372+
//---------------------------------------------------------------------------
11373+
void File_Mpeg4::xml_()
11374+
{
11375+
Element_Name("XML box");
11376+
11377+
//Parsing
11378+
#if defined(MEDIAINFO_XMP_YES)
11379+
File_Xmp MI{};
11380+
Open_Buffer_Init(&MI);
11381+
auto Element_Offset_Sav = Element_Offset;
11382+
Open_Buffer_Continue(&MI);
11383+
Element_Offset = Element_Offset_Sav;
11384+
Open_Buffer_Finalize(&MI);
11385+
Element_Show(); //TODO: why is it needed?
11386+
Merge(MI, Stream_General, 0, 0, false);
11387+
#endif
11388+
Skip_UTF8(Element_Size - Element_Offset, "XMP metadata");
11389+
}
11390+
1132211391
//***************************************************************************
1132311392
// C++
1132411393
//***************************************************************************

Source/MediaInfo/Tag/File_Exif.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1995,7 +1995,7 @@ void File_Exif::FileHeader_Parse()
19951995
//HEIF
19961996
if (FromHeif) {
19971997
int32u Size;
1998-
Get_B4 (Size, "Exif header length");
1998+
Get_B4 (Size, "exif_tiff_header_offset");
19991999
string Identifier;
20002000
Get_String(Size, Identifier, "Identifier");
20012001
if (!(Size == 0 || (Size == 6 && !strncmp(Identifier.c_str(), "Exif\0", 6)))) {

0 commit comments

Comments
 (0)