Skip to content

Commit

Permalink
* mediainfo
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-pimenov committed Aug 25, 2019
1 parent 9bf9a16 commit 61663fa
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 20 deletions.
1 change: 0 additions & 1 deletion MediaInfoLib/Source/MediaInfo/Audio/File_Ac3.cpp
Expand Up @@ -1119,7 +1119,6 @@ void File_Ac3::Streams_Fill()
Fill(Stream_Audio, 0, Audio_Format, "AC-3");
Fill(Stream_Audio, 0, Audio_Codec, "AC3");
}
Fill(Stream_Audio, 0, Audio_BitDepth, 16);

const int32u Divider=bsid_Max==9?2:1; // Unofficial hack for low sample rate (e.g. 22.05 kHz)
if (Ztring::ToZtring(AC3_SamplingRate[fscod]/Divider)!=Retrieve(Stream_Audio, 0, Audio_SamplingRate))
Expand Down
2 changes: 2 additions & 0 deletions MediaInfoLib/Source/MediaInfo/Audio/File_Pcm.cpp
Expand Up @@ -404,6 +404,8 @@ void File_Pcm::Data_Parse()
{
Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream);
}
if (Frame_Count_NotParsedIncluded!=(int64u)-1 && !Demux_Items.empty())
Frame_Count_NotParsedIncluded+=Demux_Items.size()-1;
#endif //MEDIAINFO_DEMUX

//Parsing
Expand Down
1 change: 0 additions & 1 deletion MediaInfoLib/Source/MediaInfo/Audio/File_Usac.cpp
Expand Up @@ -859,7 +859,6 @@ void File_Aac::drcInstructionsUniDrc(bool V1)
}

set<int8s> DrcChannelGroups=set<int8s>(gainSetIndex.begin(), gainSetIndex.end());
size_t nDrcChannelGroups=DrcChannelGroups.size();

for (set<int8s>::iterator DrcChannelGroup=DrcChannelGroups.begin(); DrcChannelGroup!=DrcChannelGroups.end(); ++DrcChannelGroup)
{
Expand Down
2 changes: 1 addition & 1 deletion MediaInfoLib/Source/MediaInfo/File__Analyze.h
Expand Up @@ -489,7 +489,7 @@ public :
inline void Param (const char* Parameter, const int8u* Value, size_t Value_Size, bool Utf8=true) {Param(Parameter, (const char*)Value, Value_Size, Utf8);}
inline void Param_GUID (const char* Parameter, int128u Value){Param(Parameter, Ztring().From_GUID(Value));}
inline void Param_UUID (const char* Parameter, int128u Value){Param(Parameter, Ztring().From_UUID(Value));}
inline void Param_CC (const char* Parameter, const int8u* Value, int8u Value_Size){Ztring Name2; for (int8s i=0; i<Value_Size; i++) Name2.append(1, (Char)(Value[i])); Param(Parameter, Name2);}
inline void Param_CC (const char* Parameter, const int8u* Value, int8u Value_Size){Ztring Name2; for (int8s i=0; i<Value_Size; i++) Name2.append(1, (ZenLib::Char)(Value[i])); Param(Parameter, Name2);}
/* #ifdef SIZE_T_IS_LONG */
/* inline void Param (const char* Parameter, size_t Value, intu Radix) {if (Trace_Activated) Param(Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase()+__T(" (")+Ztring::ToZtring(Value, 10).MakeUpperCase()+__T(")"));} */
/* #endif //SIZE_T_IS_LONG */
Expand Down
15 changes: 0 additions & 15 deletions MediaInfoLib/Source/MediaInfo/Multiple/File_Mxf.cpp
Expand Up @@ -8060,21 +8060,6 @@ void File_Mxf::SoundfieldGroupLabelSubDescriptor()
if (Descriptors[InstanceUID].Type==descriptor::Type_Unknown)
Descriptors[InstanceUID].Type=descriptor::Type_SoundfieldGroupLabelSubDescriptor;

if (Code2>=0x8000)
{
// Not a short code
std::map<int16u, int128u>::iterator Primer_Value=Primer_Values.find(Code2);
if (Primer_Value!=Primer_Values.end())
{
int32u Code_Compare1=Primer_Value->second.hi>>32;
int32u Code_Compare2=(int32u)Primer_Value->second.hi;
int32u Code_Compare3=Primer_Value->second.lo>>32;
int32u Code_Compare4=(int32u)Primer_Value->second.lo;
if(0);
ELEMENT_UUID(GroupOfSoundfieldGroupsLinkID, "Group Of Soundfield Groups Link ID")
}
}

//switch(Code2)
//{
// default:
Expand Down
4 changes: 2 additions & 2 deletions MediaInfoLib/Source/MediaInfo/Multiple/File_Riff.cpp
Expand Up @@ -707,9 +707,9 @@ void File_Riff::Read_Buffer_Continue()
if (Demux_Parser)
{
Open_Buffer_Continue(Demux_Parser, Buffer+Buffer_Offset, 0, false);
if (Config->Demux_EventWasSent)
return;
Demux_Parser=NULL;
//if (Config->Demux_EventWasSent)
// return;
}
}
#endif //MEDIAINFO_DEMUX
Expand Down
79 changes: 79 additions & 0 deletions MediaInfoLib/Source/MediaInfo/Video/File_Avc.cpp
Expand Up @@ -930,6 +930,57 @@ void File_Avc::Streams_Fill(std::vector<seq_parameter_set_struct*>::iterator seq
Fill(Stream_Video, 0, Video_ChromaSubsampling, Avc_ChromaSubsampling_format_idc((*seq_parameter_set_Item)->chroma_format_idc));
if ((*seq_parameter_set_Item)->bit_depth_luma_minus8==(*seq_parameter_set_Item)->bit_depth_chroma_minus8)
Fill(Stream_Video, 0, Video_BitDepth, (*seq_parameter_set_Item)->bit_depth_luma_minus8+8);

hdr::iterator EtsiTs103433 = HDR.find(HdrFormat_EtsiTs103433);
if (EtsiTs103433 != HDR.end())
{
for (std::map<video, Ztring>::iterator Item = EtsiTs103433->second.begin(); Item != EtsiTs103433->second.end(); ++Item)
{
Fill(Stream_Video, 0, Item->first, Item->second);
}
}
hdr::iterator SmpteSt209440 = HDR.find(HdrFormat_SmpteSt209440);
if (SmpteSt209440 != HDR.end())
{
for (std::map<video, Ztring>::iterator Item = SmpteSt209440->second.begin(); Item != SmpteSt209440->second.end(); ++Item)
{
switch (Item->first)
{
case Video_MasteringDisplay_ColorPrimaries:
case Video_MasteringDisplay_Luminance:
if (Retrieve_Const(Stream_Video, 0, Item->first) == Item->second)
break;
// Fallthrough
default:
Fill(Stream_Video, 0, Item->first, Item->second);
}
}
}
hdr::iterator SmpteSt2086 = HDR.find(HdrFormat_SmpteSt2086);
if (SmpteSt2086 != HDR.end())
{
for (std::map<video, Ztring>::iterator Item = SmpteSt2086->second.begin(); Item != SmpteSt2086->second.end(); ++Item)
{
bool Ignore;
switch (Item->first)
{
case Video_HDR_Format:
Ignore = !Retrieve_Const(Stream_Video, 0, Item->first).empty();
break;
case Video_MasteringDisplay_ColorPrimaries:
case Video_MasteringDisplay_Luminance:
Ignore = Retrieve_Const(Stream_Video, 0, Item->first) == Item->second;
break;
}
if (!Ignore)
Fill(Stream_Video, 0, Item->first, Item->second);
}
}

if (maximum_content_light_level)
Fill(Stream_Video, 0, "MaxCLL", Ztring::ToZtring(maximum_content_light_level) + __T(" cd/m2"));
if (maximum_frame_average_light_level)
Fill(Stream_Video, 0, "MaxFALL", Ztring::ToZtring(maximum_frame_average_light_level) + __T(" cd/m2"));
}

//---------------------------------------------------------------------------
Expand Down Expand Up @@ -1444,6 +1495,8 @@ void File_Avc::Synched_Init()
FirstPFrameInGop_IsParsed=false;
Config_IsRepeated=false;
tc=0;
maximum_content_light_level=0;
maximum_frame_average_light_level=0;

//Default values
Streams.resize(0x100);
Expand Down Expand Up @@ -2656,6 +2709,8 @@ void File_Avc::sei_message(int32u &seq_parameter_set_id)
case 6 : sei_message_recovery_point(); break;
case 32 : sei_message_mainconcept(payloadSize); break;
case 147: sei_alternative_transfer_characteristics(); break;
case 137: sei_message_mastering_display_colour_volume(); break;
case 144: sei_message_light_level(); break;
default :
Element_Info1("unknown");
Skip_XX(payloadSize, "data");
Expand Down Expand Up @@ -3397,6 +3452,30 @@ void File_Avc::consumer_camera_2()
BS_End();
}

//---------------------------------------------------------------------------
void File_Avc::sei_message_mastering_display_colour_volume()
{
Element_Info1("mastering_display_colour_volume");

std::map<video, Ztring>& SmpteSt2086 = HDR[HdrFormat_SmpteSt2086];
Ztring& HDR_Format = SmpteSt2086[Video_HDR_Format];
if (HDR_Format.empty())
{
HDR_Format = __T("SMPTE ST 2086");
SmpteSt2086[Video_HDR_Format_Compatibility] = "HDR10";
}
Get_MasteringDisplayColorVolume(SmpteSt2086[Video_MasteringDisplay_ColorPrimaries], SmpteSt2086[Video_MasteringDisplay_Luminance]);
}
//---------------------------------------------------------------------------
void File_Avc::sei_message_light_level()
{
Element_Info1("light_level");

//Parsing
Get_B2(maximum_content_light_level, "maximum_content_light_level");
Get_B2(maximum_frame_average_light_level, "maximum_frame_average_light_level");
}

//---------------------------------------------------------------------------
// SEI - 6
void File_Avc::sei_message_recovery_point()
Expand Down
18 changes: 18 additions & 0 deletions MediaInfoLib/Source/MediaInfo/Video/File_Avc.h
Expand Up @@ -408,6 +408,24 @@ private :
void sei_message_user_data_unregistered_x264(int32u payloadSize);
void sei_message_user_data_unregistered_bluray(int32u payloadSize);
void sei_message_user_data_unregistered_bluray_MDPM(int32u payloadSize);
void sei_message_mastering_display_colour_volume();
void sei_message_light_level();

enum hdr_format
{
HdrFormat_EtsiTs103433,
HdrFormat_SmpteSt209440,
HdrFormat_SmpteSt2086,
};

typedef std::map<hdr_format, std::map<video, Ztring> > hdr;

hdr HDR;


int16u maximum_content_light_level;
int16u maximum_frame_average_light_level;

void consumer_camera_1();
void consumer_camera_2();
void sei_message_recovery_point();
Expand Down

0 comments on commit 61663fa

Please sign in to comment.