Skip to content

Commit 8230a81

Browse files
+ MPEG-4: Handle correctly mett track format
1 parent 162c3b4 commit 8230a81

6 files changed

+71
-5
lines changed

Source/MediaInfo/File__Analyze.h

+1
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,7 @@ public :
894894
#define Info_UTF8(_BYTES, _INFO, _NAME) Ztring _INFO; Get_UTF8 (_BYTES, _INFO, _NAME)
895895
#define Info_UTF16B(_BYTES, _INFO, _NAME) Ztring _INFO; Get_UTF16B(_BYTES, _INFO, _NAME)
896896
#define Info_UTF16L(_BYTES, _INFO, _NAME) Ztring _INFO; Get_UTF16L(_BYTES, _INFO, _NAME)
897+
size_t SizeUpTo0();
897898

898899
//***************************************************************************
899900
// PAscal strings

Source/MediaInfo/File__Analyze_Buffer.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -2023,6 +2023,17 @@ void File__Analyze::Skip_UTF16L(int64u Bytes, const char* Name)
20232023
Element_Offset+=Bytes;
20242024
}
20252025

2026+
//---------------------------------------------------------------------------
2027+
size_t File__Analyze::SizeUpTo0()
2028+
{
2029+
auto Buffer_Begin=Buffer+Buffer_Offset+(size_t)Element_Offset;
2030+
auto Buffer_Current=Buffer_Begin;
2031+
auto Buffer_End=Buffer+Buffer_Offset+(size_t)Element_Size;
2032+
while (Buffer_Current<Buffer_End && *Buffer_Current)
2033+
Buffer_Current++;
2034+
return Buffer_Current-Buffer_Begin;
2035+
}
2036+
20262037
//***************************************************************************
20272038
// Text
20282039
//***************************************************************************

Source/MediaInfo/File__Analyze_Buffer_MinimizeSize.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,17 @@ void File__Analyze::Get_UTF16L(int64u Bytes, Ztring &Info)
14491449
Element_Offset+=Bytes;
14501450
}
14511451

1452+
//---------------------------------------------------------------------------
1453+
size_t File__Analyze::SizeUpTo0()
1454+
{
1455+
auto Buffer_Begin=Buffer+Buffer_Offset+(size_t)Element_Offset;
1456+
auto Buffer_Current=Buffer_Begin;
1457+
auto Buffer_End=Buffer+Buffer_Offset+(size_t)Element_Size;
1458+
while (Buffer_Current<Buffer_End && *Buffer_Current)
1459+
Buffer_Current++;
1460+
return Buffer_Current-Buffer_Begin;
1461+
}
1462+
14521463
//***************************************************************************
14531464
// Text
14541465
//***************************************************************************

Source/MediaInfo/File__Analyze_MinimizeSize.h

+1
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,7 @@ public :
760760
#define Info_UTF8(_BYTES, _INFO, _NAME) Ztring _INFO; Get_UTF8 (_BYTES, _INFO, _NAME)
761761
#define Info_UTF16B(_BYTES, _INFO, _NAME) Ztring _INFO; Get_UTF16B(_BYTES, _INFO, _NAME)
762762
#define Info_UTF16L(_BYTES, _INFO, _NAME) Ztring _INFO; Get_UTF16L(_BYTES, _INFO, _NAME)
763+
size_t SizeUpTo0();
763764

764765
//***************************************************************************
765766
// Pascal strings

Source/MediaInfo/Multiple/File_Mpeg4.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ private :
217217
void moov_trak_mdia_minf_stbl_stsd_xxxxSound();
218218
void moov_trak_mdia_minf_stbl_stsd_xxxxText();
219219
void moov_trak_mdia_minf_stbl_stsd_xxxxVideo();
220-
void moov_trak_mdia_minf_stbl_stsd_xxxxOthers();
220+
void moov_trak_mdia_minf_stbl_stsd_xxxxOthers(const string& CodecIDAddition);
221221
void moov_trak_mdia_minf_stbl_stsd_xxxx_alac();
222222
void moov_trak_mdia_minf_stbl_stsd_xxxx_AALP();
223223
void moov_trak_mdia_minf_stbl_stsd_xxxx_ACLR();

Source/MediaInfo/Multiple/File_Mpeg4_Elements.cpp

+46-4
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ namespace Elements
789789
const int64u moov_trak_mdia_minf_stbl_stsd_mebx_keys=0x6B657973;
790790
const int64u moov_trak_mdia_minf_stbl_stsd_mebx_keys_PHDR=0x50484452;
791791
const int64u moov_trak_mdia_minf_stbl_stsd_mebx_keys_PHDR_keyd=0x6B657964;
792+
const int64u moov_trak_mdia_minf_stbl_stsd_mett=0x6D657474;
792793
const int64u moov_trak_mdia_minf_stbl_stsd_mp4a=0x6D703461;
793794
const int64u moov_trak_mdia_minf_stbl_stsd_mp4s=0x6D703473;
794795
const int64u moov_trak_mdia_minf_stbl_stsd_mp4v=0x6D703476;
@@ -5742,8 +5743,44 @@ void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_tx3g_ftab()
57425743
void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx()
57435744
{
57445745
//Parsing
5745-
Skip_B6( "Reserved");
5746-
Skip_B2( "Data reference index");
5746+
string CodecIDAddition;
5747+
if (StreamKind_Last==Stream_Max)
5748+
{
5749+
switch (Element_Code)
5750+
{
5751+
case Elements::moov_trak_mdia_minf_stbl_stsd_mett:
5752+
{
5753+
string mime_format;
5754+
Element_Name("Metadata");
5755+
Skip_String(SizeUpTo0(), "content_encoding");
5756+
Skip_B1( "zero");
5757+
Get_String(SizeUpTo0(), CodecIDAddition, "mime_format");
5758+
Skip_B1( "zero");
5759+
break;
5760+
}
5761+
default:
5762+
{
5763+
auto NotAscii=false;
5764+
if (Element_Size>=6)
5765+
{
5766+
for (auto Current=Buffer+Buffer_Offset, End=Current+6; Current<End; Current++)
5767+
{
5768+
if (!IsAsciiLower(*Current) && !IsAsciiUpper(*Current))
5769+
NotAscii=true;
5770+
}
5771+
}
5772+
if (Element_Size<6 || !NotAscii)
5773+
{
5774+
Skip_XX(Element_Size, "(Unknown)");
5775+
}
5776+
}
5777+
}
5778+
}
5779+
if (!Element_Offset)
5780+
{
5781+
Skip_B6( "Reserved");
5782+
Skip_B2( "Data reference index");
5783+
}
57475784

57485785
//Test of buggy files
57495786
if (StreamKind_Last==Stream_Other && Element_Code==0x61766331) //"avc1"
@@ -5785,7 +5822,7 @@ void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx()
57855822
case Stream_Video : moov_trak_mdia_minf_stbl_stsd_xxxxVideo(); break;
57865823
case Stream_Audio : moov_trak_mdia_minf_stbl_stsd_xxxxSound(); break;
57875824
case Stream_Text : moov_trak_mdia_minf_stbl_stsd_xxxxText (); break;
5788-
default : moov_trak_mdia_minf_stbl_stsd_xxxxOthers();
5825+
default : moov_trak_mdia_minf_stbl_stsd_xxxxOthers(CodecIDAddition);
57895826
}
57905827

57915828
if (Element_IsWaitingForMoreData())
@@ -6651,7 +6688,7 @@ void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxxVideo()
66516688
}
66526689

66536690
//---------------------------------------------------------------------------
6654-
void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxxOthers()
6691+
void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxxOthers(const string& CodecIDAddition)
66556692
{
66566693
switch (Element_Code)
66576694
{
@@ -6664,6 +6701,11 @@ void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxxOthers()
66646701
if (Element_Code)
66656702
{
66666703
CodecID_Fill(Ztring().From_CC4((int32u)Element_Code), StreamKind_Last, StreamPos_Last, InfoCodecID_Format_Mpeg4);
6704+
if (!CodecIDAddition.empty())
6705+
{
6706+
auto CodecID=Retrieve(Stream_Other, StreamPos_Last, Other_CodecID).To_UTF8();
6707+
Fill(Stream_Other, StreamPos_Last, Other_CodecID, CodecID+'-'+CodecIDAddition, true, true);
6708+
}
66676709
}
66686710

66696711
FILLING_BEGIN();

0 commit comments

Comments
 (0)