Skip to content

Commit

Permalink
Merge pull request #2001 from JeromeMartinez/Misc
Browse files Browse the repository at this point in the history
Miscellaneous fixes
  • Loading branch information
JeromeMartinez authored Apr 15, 2024
2 parents ddd9716 + 5667ba0 commit c8f5fd7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
15 changes: 11 additions & 4 deletions Source/MediaInfo/Audio/File_DolbyE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ void File_DolbyE::Streams_Fill()
Stream_Prepare(Stream_Audio);
Fill(Stream_Audio, program, Audio_Format, "Dolby E");
if (DolbyE_Programs[program_config]>1)
Fill(Stream_Audio, program, Audio_ID, Count_Get(Stream_Audio));
Fill(Stream_Audio, program, Audio_ID, program+1);
Fill(Stream_Audio, program, Audio_Channel_s_, DolbyE_Channels_PerProgram(program_config, program));
Fill(Stream_Audio, program, Audio_ChannelPositions, DolbyE_ChannelPositions_PerProgram(program_config, program));
Fill(Stream_Audio, program, Audio_ChannelPositions_String2, DolbyE_ChannelPositions2_PerProgram(program_config, program));
Expand Down Expand Up @@ -1052,8 +1052,8 @@ void File_DolbyE::Streams_Fill_PerProgram(size_t program)

if (SMPTE_time_code_StartTimecode!=(int64u)-1)
{
Fill(StreamKind_Last, program, Audio_Delay, SMPTE_time_code_StartTimecode);
Fill(StreamKind_Last, program, Audio_Delay_Source, "Stream");
Fill(Stream_Audio, program, Audio_Delay, SMPTE_time_code_StartTimecode);
Fill(Stream_Audio, program, Audio_Delay_Source, "Stream");
}

Fill(Stream_Audio, program, Audio_FrameRate, Mpegv_frame_rate[frame_rate_code]);
Expand Down Expand Up @@ -1092,7 +1092,14 @@ void File_DolbyE::Streams_Fill_PerProgram(size_t program)
//---------------------------------------------------------------------------
void File_DolbyE::Streams_Fill_ED2()
{
Stream_Prepare(Stream_Audio);
if (Count_Get(Stream_Audio))
{
while (Count_Get(Stream_Audio)>1)
Stream_Erase(Stream_Audio, Count_Get(Stream_Audio)-1); // We may have several streams due to metadata, we keep one
StreamPos_Last=0;
}
else
Stream_Prepare(Stream_Audio);
Fill(Stream_Audio, StreamPos_Last, Audio_Format, "Dolby ED2");
if (Guardband_EMDF_PresentAndSize)
Fill(Stream_Audio, StreamPos_Last, Audio_BitRate, Guardband_EMDF_PresentAndSize*8*Mpegv_frame_rate[frame_rate_code], 0);
Expand Down
7 changes: 5 additions & 2 deletions Source/MediaInfo/File__Analyze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1032,8 +1032,11 @@ void File__Analyze::Open_Buffer_Continue (File__Analyze* Sub, const int8u* ToAdd
int8u* Temp=Sub->OriginalBuffer;
Sub->OriginalBuffer_Capacity=(size_t)(Sub->OriginalBuffer_Size+Element_Size-Element_Offset);
Sub->OriginalBuffer=new int8u[Sub->OriginalBuffer_Capacity];
memcpy_Unaligned_Unaligned(Sub->OriginalBuffer, Temp, Sub->OriginalBuffer_Size);
delete[] Temp;
if (Temp)
{
memcpy_Unaligned_Unaligned(Sub->OriginalBuffer, Temp, Sub->OriginalBuffer_Size);
delete[] Temp;
}
}
memcpy_Unaligned_Unaligned(Sub->OriginalBuffer+Sub->OriginalBuffer_Size, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset));
Sub->OriginalBuffer_Size+=(size_t)(Element_Size-Element_Offset);
Expand Down
2 changes: 1 addition & 1 deletion Source/MediaInfo/File__Analyze_Streams_Finish.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ void File__Analyze::Streams_Finish_StreamOnly_Audio(size_t Pos)
if (Audio_Begin!=List[2].size())
{
for (size_t j=0; j<6; j++)
if (!List[j].empty())
if (!List[j].empty() && Audio_Begin+i<List[j].size())
List[j].erase(List[j].begin()+Audio_Begin+i);
size_t Audio_End;
for (Audio_End=Audio_Begin+1; Audio_End<List[2].size(); Audio_End++)
Expand Down
4 changes: 2 additions & 2 deletions Source/MediaInfo/TimeCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ namespace ZenLib
// Class bitset8
//***************************************************************************

#if __cplusplus >= 201400 || (_MSC_VER >= 1910 && _MSVC_LANG >= 201400)
#if __cplusplus >= 201400 || (defined(_MSC_VER) && _MSC_VER >= 1910 && _MSVC_LANG >= 201400)
#define constexpr14 constexpr
#else
#define constexpr14
#endif
#if __cplusplus >= 202000 || (_MSC_VER >= 1910 && _MSVC_LANG >= 202000)
#if __cplusplus >= 202000 || (defined(_MSC_VER) && _MSC_VER >= 1910 && _MSVC_LANG >= 202000)
#define constexpr20 constexpr
#else
#define constexpr20
Expand Down
7 changes: 6 additions & 1 deletion Source/MediaInfo/Video/File_Hevc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1711,6 +1711,8 @@ void File_Hevc::video_parameter_set()
int8u ViewOrderIdx[64];
//int8u DependencyId[64];
//int8u AuxId[64];
memset(ScalabilityId, -1, 64 * 16 * sizeof(int8u));
memset(ViewOrderIdx, -1, 64 * sizeof(int8u));
for (int i = 0; i <= MaxLayersMinus1; i++)
{
auto lId = layer_id_in_nuh[i];
Expand Down Expand Up @@ -1738,7 +1740,10 @@ void File_Hevc::video_parameter_set()
{
view_id_val.resize(64, -1);
for (int i=0; i<NumViews; i++)
Get_S2 (view_id_len, view_id_val[ViewOrderIdx[i]], "view_id_val");
if (ViewOrderIdx[i]!=(int8u)-1)
Get_S2 (view_id_len, view_id_val[ViewOrderIdx[i]], "view_id_val");
else
Trusted_IsNot("ViewOrderIdx");
}
bool direct_dependency_flag[64][64];
memset(direct_dependency_flag, 0, sizeof(direct_dependency_flag));
Expand Down

0 comments on commit c8f5fd7

Please sign in to comment.