Skip to content

Commit

Permalink
Retain the Encoded Library information stored in a tag
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenesvk committed May 25, 2020
1 parent 84fc9d1 commit 4c4ab2f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions Project/MSVC2019/Library/MediaInfoLib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@
<ClInclude Include="..\..\..\Source\MediaInfo\File__Analyze.h" />
<ClInclude Include="..\..\..\Source\MediaInfo\File__Analyze_Element.h" />
<ClInclude Include="..\..\..\Source\MediaInfo\File__Analyze_MinimizeSize.h" />
<ClInclude Include="..\..\..\Source\MediaInfo\File__Analyze_Streams.h" />
<ClInclude Include="..\..\..\Source\MediaInfo\File__Base.h" />
<ClInclude Include="..\..\..\Source\MediaInfo\File__Duplicate.h" />
<ClInclude Include="..\..\..\Source\MediaInfo\File__HasReferences.h" />
Expand Down
3 changes: 3 additions & 0 deletions Project/MSVC2019/Library/MediaInfoLib.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1489,5 +1489,8 @@
<ClInclude Include="..\..\..\Source\MediaInfo\Audio\File_Mpegh3da.h">
<Filter>Header Files\Audio</Filter>
</ClInclude>
<ClInclude Include="..\..\..\Source\MediaInfo\File__Analyze_Streams.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
15 changes: 15 additions & 0 deletions Source/MediaInfo/File__Analyze_Streams.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//---------------------------------------------------------------------------
#ifndef File__Analyze_StreamsH
#define File__Analyze_StreamsH
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
#include "ZenLib/Ztring.h"
using namespace ZenLib;
//---------------------------------------------------------------------------

namespace MediaInfoLib
{
extern Ztring Encoded_Library_Tag;
}
#endif
7 changes: 7 additions & 0 deletions Source/MediaInfo/File__Analyze_Streams_Finish.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#endif
//---------------------------------------------------------------------------

#include "MediaInfo/File__Analyze_Streams.h" //declaration of Encoded_Library_Tag
//---------------------------------------------------------------------------
#include "MediaInfo/Setup.h"
//---------------------------------------------------------------------------
Expand Down Expand Up @@ -73,6 +74,8 @@ Ztring File__Analyze_Encoded_Library_String (const Ztring &CompanyName, const Zt
String+=Date;
String+=__T(")");
}
if (!Encoded_Library_Tag.empty())
String+=MediaInfoLib::Config.TagSeparator_Get()+Encoded_Library_Tag; //add discarded Encoder tag back
return String;
}
else
Expand Down Expand Up @@ -1448,9 +1451,13 @@ void File__Analyze::Streams_Finish_HumanReadable()
{
//Generic
for (size_t StreamKind=Stream_General; StreamKind<Stream_Max; StreamKind++)
{
if(StreamKind>Stream_Video || StreamKind==Stream_Max)
Encoded_Library_Tag = __T(""); //reset tag for new files
for (size_t StreamPos=0; StreamPos<Count_Get((stream_t)StreamKind); StreamPos++)
for (size_t Parameter=0; Parameter<Count_Get((stream_t)StreamKind, StreamPos); Parameter++)
Streams_Finish_HumanReadable_PerStream((stream_t)StreamKind, StreamPos, Parameter);
}
}

//---------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions Source/MediaInfo/Multiple/File_Mk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
#if MEDIAINFO_EVENTS
#include "MediaInfo/MediaInfo_Events.h"
#endif //MEDIAINFO_EVENTS
#include "MediaInfo/File__Analyze_Streams.h" //declaration of Encoded_Library_Tag
#include "MediaInfo/MediaInfo_Config_MediaInfo.h"
#include <cstring>
#include <cmath>
Expand All @@ -105,6 +106,7 @@
namespace MediaInfoLib
{

Ztring Encoded_Library_Tag;
//***************************************************************************
// Constants
//***************************************************************************
Expand Down Expand Up @@ -1010,6 +1012,8 @@ void File_Mk::Streams_Finish()
}
if ((Tag->first!=__T("Language") || Retrieve(StreamKind_Last, StreamPos_Last, "Language").empty())) // Prioritize Tracks block over tags
Fill(StreamKind_Last, StreamPos_Last, Tag->first.To_UTF8().c_str(), Tag->second);
if (Tag->first==__T("Encoded_Library") && StreamKind_Last==Stream_Video && Encoded_Library_Tag.empty())
Encoded_Library_Tag = Tag->second; //save video Encoder tag value in a shared variable (once)
}
}
}
Expand Down

0 comments on commit 4c4ab2f

Please sign in to comment.