Skip to content

Commit

Permalink
* Mediainfo Version 20.03, 2020-04-03
Browse files Browse the repository at this point in the history
-------------
+ AC-4 full featured support (presentations, groups, substreams)
+ MPEG-H 3D Audio basic support
+ MPEG-TS: audio preselection descriptor support
+ Dolby Vision v2 detection
+ MPEG-4: support of colr/nclx (color information) box
x URL encoding option fixes, permitting to use URL encoded or non URL encoded links
x AAC: fix SBR frequency when in ADIF
x DPX: ColorimetricSpecification and TransferCharacteristic were inverted
x Some API calls were not thread safe
x Several crash and memory leaks fixes
  • Loading branch information
pavel-pimenov committed Apr 3, 2020
1 parent 7563606 commit ec8cc81
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 42 deletions.
13 changes: 13 additions & 0 deletions MediaInfoLib/History_DLL.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ x Correction
bug reports and feature request are here:
https://sourceforge.net/p/mediainfo/_list/tickets

Version 20.03, 2020-04-03
-------------
+ AC-4 full featured support (presentations, groups, substreams)
+ MPEG-H 3D Audio basic support
+ MPEG-TS: audio preselection descriptor support
+ Dolby Vision v2 detection
+ MPEG-4: support of colr/nclx (color information) box
x URL encoding option fixes, permitting to use URL encoded or non URL encoded links
x AAC: fix SBR frequency when in ADIF
x DPX: ColorimetricSpecification and TransferCharacteristic were inverted
x Some API calls were not thread safe
x Several crash and memory leaks fixes

Version 19.09, 2019-09-10
-------------
+ AC-4: basic detection, raw, in MP4 or TS
Expand Down
92 changes: 63 additions & 29 deletions MediaInfoLib/Source/MediaInfo/Audio/File_Ac4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ string Value(const sized_array_string Array, size_t Pos)
return Ztring::ToZtring(Pos-1).To_UTF8();
return Array[Pos];
}
bool Value_IsEmpty(const sized_array_string Array, size_t Pos)
{
if (Pos++>=(size_t)Array[0] || !Array[Pos])
return false;
return !Array[Pos][0];
}

static const int16u Ac4_fs_index[2]=
{
Expand Down Expand Up @@ -1644,19 +1650,23 @@ void File_Ac4::Streams_Fill()
Fill(Stream_Audio, 0, (S+" dialnorm").c_str(), -0.25*Substream_Info->second.LoudnessInfo.dialnorm_bits, 2);
{
const preprocessing& P=Substream_Info->second.Preprocessing;
if (P.pre_dmixtyp_2ch!=(int8u)-1 || P.pre_dmixtyp_5ch!=(int8u)-1 || P.phase90_info_mc!=(int8u)-1)
bitset<3> Preprocessing_Available;
Preprocessing_Available[0]=(P.pre_dmixtyp_2ch!=(int8u)-1 && (!Value_IsEmpty(Ac4_pre_dmixtyp_2ch, P.pre_dmixtyp_2ch) || !Value_IsEmpty(Ac4_phase90_info_2ch, P.phase90_info_2ch)));
Preprocessing_Available[1]=(P.pre_dmixtyp_5ch!=(int8u)-1 && (!Value_IsEmpty(Ac4_pre_dmixtyp_5ch, P.pre_dmixtyp_5ch)));
Preprocessing_Available[2]=(P.phase90_info_mc!=(int8u)-1 && (!Value_IsEmpty(Ac4_phase90_info_mc, P.phase90_info_mc) || P.b_surround_attenuation_known || P.b_lfe_attenuation_known));
if (Preprocessing_Available.any())
{
Fill(Stream_Audio, 0, (S+" Preprocessing").c_str(), "Yes");
if (P.pre_dmixtyp_2ch!=(int8u)-1)
if (Preprocessing_Available[0])
{
Fill(Stream_Audio, 0, (S+" Preprocessing PreviousMixType2ch").c_str(), Value(Ac4_pre_dmixtyp_2ch, P.pre_dmixtyp_2ch));
Fill(Stream_Audio, 0, (S+" Preprocessing Phase90FilterInfo2ch").c_str(), Value(Ac4_phase90_info_2ch, P.phase90_info_2ch));
}
if (P.pre_dmixtyp_5ch!=(int8u)-1)
if (Preprocessing_Available[1])
{
Fill(Stream_Audio, 0, (S+" Preprocessing PreviousDownmixType5ch").c_str(), Value(Ac4_pre_dmixtyp_5ch, P.pre_dmixtyp_5ch));
}
if (P.phase90_info_mc!=(int8u)-1)
if (Preprocessing_Available[2])
{
Fill(Stream_Audio, 0, (S+" Preprocessing Phase90FilterInfo").c_str(), Value(Ac4_phase90_info_mc, P.phase90_info_mc));
Fill(Stream_Audio, 0, (S+" Preprocessing SurroundAttenuationKnown").c_str(), P.b_surround_attenuation_known?"Yes":"No");
Expand Down Expand Up @@ -1896,6 +1906,20 @@ void File_Ac4::raw_ac4_frame()
Finish();
}
FILLING_END();

if (!Presentations_IFrame.empty())
{
Presentations=Presentations_IFrame;
Presentations_IFrame.clear();
Groups=Groups_IFrame;
Groups_IFrame.clear();
for (std::map<int8u, audio_substream>::iterator AudioSubstream=AudioSubstreams_IFrame.begin(); AudioSubstream!=AudioSubstreams_IFrame.end(); ++AudioSubstream)
{
AudioSubstreams[AudioSubstream->first]=AudioSubstream->second;
AudioSubstream->second.Buffer.Data=NULL; //This is a move, Buffer moves from AudioSubstreams_IFrame to AudioSubstreams
}
AudioSubstreams_IFrame.clear();
}
}

//---------------------------------------------------------------------------
Expand Down Expand Up @@ -2061,16 +2085,25 @@ void File_Ac4::ac4_toc()
Element_Offset=Element_Size;
return;
}
Presentations.clear();
Groups.clear();
if (b_iframe_global)
{
Presentations.clear();
Groups.clear();
AudioSubstreams.clear();
}
else
{
Presentations_IFrame=Presentations;
Groups_IFrame=Groups;

for (map<int8u, audio_substream>::iterator AudioSubstream=AudioSubstreams.begin(); AudioSubstream!=AudioSubstreams.end();)
{
if (!AudioSubstream->second.Buffer_Index)
{
AudioSubstreams_IFrame[AudioSubstream->first]=AudioSubstream->second;
AudioSubstream->second.Buffer.Data=NULL; //This is a move, Buffer moves from AudioSubstreams to AudioSubstreams_IFrame
AudioSubstreams.erase(AudioSubstream++);
}
else
++AudioSubstream;
}
Expand Down Expand Up @@ -2104,8 +2137,9 @@ void File_Ac4::ac4_toc()

if (bitstream_version<=1)
{
Presentations.resize(n_presentations);
for(int8u Pos=0; Pos<n_presentations; Pos++)
ac4_presentation_info();
ac4_presentation_info(Presentations[Pos]);
}
else
{
Expand All @@ -2129,11 +2163,14 @@ void File_Ac4::ac4_toc()
TEST_SB_END();
TEST_SB_END();

Presentations.resize(n_presentations);
for (int8u Pos=0; Pos<n_presentations; Pos++)
ac4_presentation_v1_info();
ac4_presentation_v1_info(Presentations[Pos]);

for (int8u Pos=0; Pos<max_group_index+1; Pos++)
ac4_substream_group_info();
size_t max_group_Size=max_group_index+1;
Groups.resize(max_group_Size);
for (int8u Pos=0; Pos< max_group_Size; Pos++)
ac4_substream_group_info(Groups[Pos]);
}

substream_index_table();
Expand All @@ -2154,6 +2191,7 @@ void File_Ac4::ac4_toc_Compute(vector<presentation>& Ps, vector<group>& Gs, bool
{
presentation& P=Ps[p];
bool b_obj_or_ajoc=false, b_obj_or_ajoc_adaptive=false;
P.Language.clear();
for (size_t Pos=0; Pos<P.substream_group_info_specifiers.size(); Pos++)
{
int8u Group_Index=P.substream_group_info_specifiers[Pos];
Expand Down Expand Up @@ -2217,10 +2255,9 @@ void File_Ac4::ac4_toc_Compute(vector<presentation>& Ps, vector<group>& Gs, bool
}

//---------------------------------------------------------------------------
void File_Ac4::ac4_presentation_info()
void File_Ac4::ac4_presentation_info(presentation& P)
{
Presentations.resize(Presentations.size()+1);
presentation& P=Presentations.back();
P.reset_cumulative();

bool b_single_substream, b_add_emdf_substreams=false;

Expand Down Expand Up @@ -2301,7 +2338,7 @@ void File_Ac4::ac4_presentation_info()
ac4_hsf_ext_substream_info(Groups.back().Substreams[0], true); // Main HSF
break;
default:
presentation_config_ext_info(P.presentation_config);
presentation_config_ext_info(P);
}
}
Skip_SB( "b_pre_virtualized");
Expand Down Expand Up @@ -2331,12 +2368,11 @@ void File_Ac4::ac4_presentation_info()
}

//---------------------------------------------------------------------------
void File_Ac4::ac4_presentation_v1_info()
void File_Ac4::ac4_presentation_v1_info(presentation& P)
{
Presentations.resize(Presentations.size()+1);
presentation& P=Presentations.back();
P.reset_cumulative();

bool b_single_substream_group, b_add_emdf_substreams=false;
bool b_single_substream_group, b_add_emdf_substreams = false;
int8u n_substream_groups=0, b_multi_pid_PresentAndValue=(int8u)-1;

Element_Begin1( "ac4_presentation_v1_info");
Expand Down Expand Up @@ -2427,7 +2463,7 @@ void File_Ac4::ac4_presentation_v1_info()
ac4_sgi_specifier(P);
break;
default: // EMDF and other data
presentation_config_ext_info(P.presentation_config);
presentation_config_ext_info(P);
}
}
Skip_SB( "b_pre_virtualized");
Expand Down Expand Up @@ -2465,7 +2501,9 @@ void File_Ac4::ac4_sgi_specifier(presentation& P)
Element_Begin1( "ac4_sgi_specifier");
if (bitstream_version==1)
{
ac4_substream_group_info(&P);
P.substream_group_info_specifiers.push_back(Groups.size());
Groups.resize(Groups.size()+1);
ac4_substream_group_info(Groups[Groups.size()-1]);
}
else
{
Expand Down Expand Up @@ -2557,13 +2595,8 @@ void File_Ac4::ac4_substream_info(presentation& P)
}

//---------------------------------------------------------------------------
void File_Ac4::ac4_substream_group_info(presentation* P)
void File_Ac4::ac4_substream_group_info(group& G)
{
if (P)
P->substream_group_info_specifiers.push_back(Groups.size()); //For bitstream_version==1
Groups.resize(Groups.size()+1);
group& G=Groups.back();

bool b_substreams_present, b_single_substream;
int8u n_lf_substreams;

Expand Down Expand Up @@ -2925,7 +2958,7 @@ void File_Ac4::ac4_presentation_substream_info(presentation& P)
}

//---------------------------------------------------------------------------
void File_Ac4::presentation_config_ext_info(int8u presentation_config)
void File_Ac4::presentation_config_ext_info(presentation& P)
{
Element_Begin1( "presentation_config_ext_info");
int16u n_skip_bytes; // TODO: verify max size
Expand All @@ -2937,10 +2970,10 @@ void File_Ac4::presentation_config_ext_info(int8u presentation_config)
n_skip_bytes=(int8u)n_skip_bytes32<<5;
TEST_SB_END();

if (bitstream_version==1 && presentation_config==7)
if (bitstream_version==1 && P.presentation_config==7)
{
size_t Pos_Before=Data_BS_Remain();
ac4_presentation_v1_info();
ac4_presentation_v1_info(P);
size_t Pos_After=Data_BS_Remain();
size_t n_bits_read=Pos_After-Pos_Before;
if (n_bits_read%8)
Expand Down Expand Up @@ -3024,6 +3057,7 @@ void File_Ac4::content_type(content_info& ContentInfo)
TESTELSE_SB_ELSE( "b_serialized_language_tag");
int8u n_language_tag_bytes;
Get_S1 (6, n_language_tag_bytes, "n_language_tag_bytes");
ContentInfo.language_tag_bytes.clear();
for (int8u Pos=0; Pos<n_language_tag_bytes; Pos++)
{
int8u language_tag_bytes;
Expand Down
20 changes: 15 additions & 5 deletions MediaInfoLib/Source/MediaInfo/Audio/File_Ac4.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public :

struct loudness_info
{
int8u dialnorm_bits; //TODO
int8u dialnorm_bits;
int8u loud_prac_type;
int8u loud_dialgate_prac_type;
int16u max_truepk;
Expand Down Expand Up @@ -239,8 +239,16 @@ private :
b_pres_centre_present(false),
pres_top_channel_pairs(0)
{}

void reset_cumulative()
{
substream_group_info_specifiers.clear();
Substreams.clear();
frame_rate_fraction_minus1=0;
}
};
vector<presentation> Presentations;
vector<presentation> Presentations_IFrame;
vector<presentation> Presentations_dac4;

//Groups
Expand Down Expand Up @@ -294,6 +302,7 @@ private :
bool b_hsf_ext;
};
vector<group> Groups;
vector<group> Groups_IFrame;
vector<group> Groups_dac4;

//Audio substreams
Expand Down Expand Up @@ -363,6 +372,7 @@ private :
{}
};
std::map<int8u, audio_substream> AudioSubstreams;
std::map<int8u, audio_substream> AudioSubstreams_IFrame;

//Streams management
void Streams_Fill();
Expand All @@ -385,17 +395,17 @@ private :
void raw_ac4_frame();
void raw_ac4_frame_substreams();
void ac4_toc();
void ac4_presentation_info();
void ac4_presentation_v1_info();
void ac4_presentation_info(presentation& P);
void ac4_presentation_v1_info(presentation& P);
void ac4_sgi_specifier(presentation& P);
void ac4_substream_info(presentation& P);
void ac4_substream_group_info(presentation* P=NULL);
void ac4_substream_group_info(group& G);
void ac4_hsf_ext_substream_info(group_substream& G, bool b_substreams_present);
void ac4_substream_info_chan(group_substream& G, size_t Pos, bool b_substreams_present);
void ac4_substream_info_ajoc(group_substream& G, bool b_substreams_present);
void ac4_substream_info_obj(group_substream& G, bool b_substreams_present);
void ac4_presentation_substream_info(presentation& P);
void presentation_config_ext_info(int8u presentation_config);
void presentation_config_ext_info(presentation& P);
void bed_dyn_obj_assignment(group_substream& G, int8u n_signals);
void content_type(content_info& ContentInfo);
void frame_rate_multiply_info();
Expand Down
2 changes: 1 addition & 1 deletion MediaInfoLib/Source/MediaInfo/MediaInfo_Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ namespace MediaInfoLib
{

//---------------------------------------------------------------------------
const Char* MediaInfo_Version=__T("MediaInfoLib - v19.09");
const Char* MediaInfo_Version=__T("MediaInfoLib - v20.03");
const Char* MediaInfo_Url=__T("http://MediaArea.net/MediaInfo");
Ztring EmptyZtring; //Use it when we can't return a reference to a true Ztring
const Ztring EmptyZtring_Const; //Use it when we can't return a reference to a true Ztring, const version
Expand Down
Loading

0 comments on commit ec8cc81

Please sign in to comment.