Retain the Encoded Library information stored in a tag (fix #1267)#1268
Retain the Encoded Library information stored in a tag (fix #1267)#1268eugenesvk wants to merge 1 commit intoMediaArea:masterfrom
Conversation
|
I see that this Travis CI job failed with Not sure what these are and how I can turn them on on my side to test (I was only using the MSVC2019 project), so will wait for your input |
|
@eugenesvk thanks for the PR. I don't want to have more source file for this unique item, I'll adapt your patch proposal. |
|
That's totally fine, it was just the simplest way I found to fix it (I was also thinking of disabling the split into name/version as at first glance it only seemed to be useful to remove a "-" in "x265 - ..." :), but then it was more complicated to trying to figure out all of its uses |
2937009 to
4c4ab2f
Compare
|
Any chance you can add it as is so that it's usable and then adapt it later when you have time not to wait 5 more years with a bug? |
We owe you this one, definitely not right that we have let it open (it felt in the too long todo-list), you don't deserve that. |
|
Better solution? diff --git a/Source/MediaInfo/File__Analyze_Streams_Finish.cpp b/Source/MediaInfo/File__Analyze_Streams_Finish.cpp
index ccfc8f566..098e333b8 100644
--- a/Source/MediaInfo/File__Analyze_Streams_Finish.cpp
+++ b/Source/MediaInfo/File__Analyze_Streams_Finish.cpp
@@ -2119,6 +2119,10 @@ extern size_t DolbyVision_Compatibility_Pos(const Ztring& Value);
//---------------------------------------------------------------------------
Ztring File__Analyze_Encoded_Library_String (const Ztring &CompanyName, const Ztring &Name, const Ztring &Version, const Ztring &Date, const Ztring &Encoded_Library)
{
+ if (!Encoded_Library.empty()) {
+ if (Encoded_Library.find(MediaInfoLib::Config.TagSeparator_Get()) != std::string::npos) // there are multiple tags, do not mess with it
+ return Encoded_Library;
+ }
if (!Name.empty())
{
Ztring String;
diff --git a/Source/MediaInfo/Multiple/File_Mk.cpp b/Source/MediaInfo/Multiple/File_Mk.cpp
index d89ab22a2..cd49b2088 100644
--- a/Source/MediaInfo/Multiple/File_Mk.cpp
+++ b/Source/MediaInfo/Multiple/File_Mk.cpp
@@ -1305,7 +1305,13 @@ void File_Mk::Streams_Finish()
}
#endif //MEDIAINFO_PCM_YES
Finish(Temp->second.Parser);
+ auto encoded_library_from_container = Retrieve_Const(Stream_Video, 0, "Encoded_Library");
Merge(*Temp->second.Parser, StreamKind_Last, 0, StreamPos_Last);
+ auto encoded_library_after_merge = Retrieve_Const(Stream_Video, 0, "Encoded_Library");
+ if (!encoded_library_from_container.empty() && encoded_library_from_container != encoded_library_after_merge) {
+ auto encoded_library = encoded_library_from_container + MediaInfoLib::Config.TagSeparator_Get() + encoded_library_after_merge;
+ Fill(StreamKind_Last, StreamPos_Last, "Encoded_Library", encoded_library, true);
+ }
//if (!Duration_Temp.empty()) Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Duration), Duration_Temp, true);
if (Temp->second.StreamKind==Stream_Video && !Codec_Temp.empty())
Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), Codec_Temp, true);Result (for FFmpeg generated file): |
|
Even better one? diff --git a/Source/MediaInfo/File__Analyze_Streams_Finish.cpp b/Source/MediaInfo/File__Analyze_Streams_Finish.cpp
index ccfc8f566..cf1b4de32 100644
--- a/Source/MediaInfo/File__Analyze_Streams_Finish.cpp
+++ b/Source/MediaInfo/File__Analyze_Streams_Finish.cpp
@@ -5120,7 +5120,11 @@ void File__Analyze::Streams_Finish_HumanReadable_PerStream(stream_t StreamKind,
Ztring Version=Retrieve(StreamKind, StreamPos, "Encoded_Library_Version");
Ztring Date=Retrieve(StreamKind, StreamPos, "Encoded_Library_Date");
Ztring Encoded_Library=Retrieve(StreamKind, StreamPos, "Encoded_Library");
- Fill(StreamKind, StreamPos, "Encoded_Library/String", File__Analyze_Encoded_Library_String(CompanyName, Name, Version, Date, Encoded_Library), true);
+ Ztring Encoded_Library_FromContainer = Retrieve(StreamKind, StreamPos, "Encoded_Library_FromContainer");
+ Ztring Encoded_Library_ToFill = File__Analyze_Encoded_Library_String(CompanyName, Name, Version, Date, Encoded_Library);
+ if (!Encoded_Library_FromContainer.empty() && Encoded_Library_ToFill != Encoded_Library_FromContainer)
+ Encoded_Library_ToFill = Encoded_Library_FromContainer + MediaInfoLib::Config.TagSeparator_Get() + Encoded_Library_ToFill;
+ Fill(StreamKind, StreamPos, "Encoded_Library/String", Encoded_Library_ToFill, true);
}
//Format_Settings_Matrix
diff --git a/Source/MediaInfo/Multiple/File_Mk.cpp b/Source/MediaInfo/Multiple/File_Mk.cpp
index d89ab22a2..cf459229c 100644
--- a/Source/MediaInfo/Multiple/File_Mk.cpp
+++ b/Source/MediaInfo/Multiple/File_Mk.cpp
@@ -1305,7 +1305,12 @@ void File_Mk::Streams_Finish()
}
#endif //MEDIAINFO_PCM_YES
Finish(Temp->second.Parser);
+ Ztring encoded_library_from_container = Retrieve_Const(Stream_Video, 0, "Encoded_Library");
+ if (!encoded_library_from_container.empty())
+ Fill(StreamKind_Last, StreamPos_Last, "Encoded_Library_FromContainer", encoded_library_from_container);
Merge(*Temp->second.Parser, StreamKind_Last, 0, StreamPos_Last);
+ if (Retrieve_Const(Stream_Video, 0, "Encoded_Library") == encoded_library_from_container) // no change, Encoded_Library_FromContainer not needed
+ Clear(Stream_Video, 0, "Encoded_Library_FromContainer");
//if (!Duration_Temp.empty()) Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Duration), Duration_Temp, true);
if (Temp->second.StreamKind==Stream_Video && !Codec_Temp.empty())
Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), Codec_Temp, true);Result (for FFmpeg generated file): |
|
Actually I think if this behaviour is desired it should be done in the merging and curation part to ensure consistency between container formats. There should be no need to make changes in MKV parser. |
This fixes #1267