Skip to content

Commit b6af6d3

Browse files
+ MP4: improve display of operating system and hardware
Focused on Android (Samsung and Google) and iOS but also handle some cameras
1 parent 87bc00c commit b6af6d3

7 files changed

+208
-17
lines changed

Source/MediaInfo/File__Analyse_Automatic.h

+10
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,16 @@ enum general
460460
General_Encoded_Library_Date,
461461
General_Encoded_Library_Settings,
462462
General_Encoded_OperatingSystem,
463+
General_Encoded_OperatingSystem_String,
464+
General_Encoded_OperatingSystem_CompanyName,
465+
General_Encoded_OperatingSystem_Name,
466+
General_Encoded_OperatingSystem_Version,
467+
General_Encoded_Hardware,
468+
General_Encoded_Hardware_String,
469+
General_Encoded_Hardware_CompanyName,
470+
General_Encoded_Hardware_Name,
471+
General_Encoded_Hardware_Model,
472+
General_Encoded_Hardware_Version,
463473
General_Cropped,
464474
General_Dimensions,
465475
General_DotsPerInch,

Source/MediaInfo/File__Analyze_Streams_Finish.cpp

+145-7
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,147 @@ void File__Analyze::Streams_Finish_StreamOnly_General(size_t StreamPos)
991991
if (Channels_Total)
992992
Fill(Stream_General, StreamPos, General_Audio_Channels_Total, Channels_Total);
993993
}
994+
995+
//Exceptions (empriric)
996+
{
997+
const auto& Application_Name=Retrieve_Const(Stream_General, StreamPos, General_Encoded_Application_Name);
998+
if (Application_Name.size()>=5 && Application_Name.find(__T(", LLC"))==Application_Name.size()-5)
999+
{
1000+
Fill(Stream_General, 0, General_Encoded_Application_CompanyName, Application_Name.substr(0, Application_Name.size()-5));
1001+
Clear(Stream_General, StreamPos, General_Encoded_Application_Name);
1002+
}
1003+
}
1004+
{
1005+
const auto& Application_Name=Retrieve_Const(Stream_General, StreamPos, General_Encoded_Application_Name);
1006+
if (Application_Name.size()>=5 && Application_Name.rfind(__T("Mac OS X "), 0)==0)
1007+
{
1008+
Fill(Stream_General, 0, General_Encoded_Application_Version, Application_Name.substr(9), true);
1009+
const auto& Application_CompanyName=Retrieve_Const(Stream_General, StreamPos, General_Encoded_Application_CompanyName);
1010+
if (Application_CompanyName.empty())
1011+
Fill(Stream_General, 0, General_Encoded_Application_CompanyName, "Apple");
1012+
Fill(Stream_General, StreamPos, General_Encoded_Application_Name, "Mac OS X", Unlimited, true, true);
1013+
}
1014+
if (Application_Name.size()>=5 && Application_Name.rfind(__T("Sorenson "), 0)==0)
1015+
{
1016+
auto Application_Name_Max=Application_Name.find(__T(" / "));
1017+
if (Application_Name_Max!=(size_t)-1)
1018+
Application_Name_Max-=9;
1019+
Fill(Stream_General, 0, General_Encoded_Application_Name, Application_Name.substr(9, Application_Name_Max), true);
1020+
const auto& Application_CompanyName=Retrieve_Const(Stream_General, StreamPos, General_Encoded_Application_CompanyName);
1021+
if (Application_CompanyName.empty())
1022+
Fill(Stream_General, 0, General_Encoded_Application_CompanyName, "Sorenson");
1023+
}
1024+
}
1025+
{
1026+
const auto& Application_Name=Retrieve_Const(Stream_General, StreamPos, General_Encoded_Application_Name);
1027+
const auto& OperatingSystem_Version=Retrieve_Const(Stream_General, StreamPos, General_Encoded_OperatingSystem_Version);
1028+
const auto& Hardware_Name=Retrieve_Const(Stream_General, StreamPos, General_Encoded_Hardware_Name);
1029+
if (OperatingSystem_Version.empty() && !Application_Name.empty() && Application_Name.find_first_not_of(__T("0123456789."))==string::npos && Hardware_Name.rfind(__T("iPhone "), 0)==0)
1030+
{
1031+
Fill(Stream_General, 0, General_Encoded_OperatingSystem_Version, Application_Name);
1032+
Fill(Stream_General, 0, General_Encoded_OperatingSystem_Name, "iOS", Unlimited, true, true);
1033+
const auto& OperatingSystem_CompanyName=Retrieve_Const(Stream_General, StreamPos, General_Encoded_OperatingSystem_CompanyName);
1034+
if (OperatingSystem_CompanyName.empty())
1035+
Fill(Stream_General, 0, General_Encoded_OperatingSystem_CompanyName, "Apple");
1036+
Clear(Stream_General, StreamPos, General_Encoded_Application_Name);
1037+
}
1038+
}
1039+
{
1040+
const auto& Hardware_CompanyName=Retrieve_Const(Stream_General, StreamPos, General_Encoded_Hardware_CompanyName);
1041+
const auto& Hardware_Name=Retrieve_Const(Stream_General, StreamPos, General_Encoded_Hardware_Name);
1042+
if (Hardware_Name.rfind(Hardware_CompanyName+__T(' '), 0) == 0)
1043+
Fill(Stream_General, StreamPos, General_Encoded_Hardware_Name, Hardware_Name.substr(Hardware_CompanyName.size()+1), true);
1044+
}
1045+
{
1046+
const auto& Performer=Retrieve_Const(Stream_General, StreamPos, General_Performer);
1047+
const auto& Hardware_CompanyName=Retrieve_Const(Stream_General, StreamPos, General_Encoded_Hardware_CompanyName);
1048+
ZtringList PerformerList;
1049+
PerformerList.Separator_Set(0, __T(" / "));
1050+
PerformerList.Write(Performer);
1051+
for (size_t i=0; i<PerformerList.size(); i++)
1052+
{
1053+
const auto& PerformerItem=PerformerList[i];
1054+
if (PerformerItem.size()-Hardware_CompanyName.size()<=16 && PerformerItem.rfind(Hardware_CompanyName+__T(' '), 0)==0)
1055+
{
1056+
//Performer is likely not the actual performer
1057+
Fill(Stream_General, StreamPos, General_Encoded_Hardware_Name, PerformerItem.substr(Hardware_CompanyName.size()+1), true);
1058+
Clear(Stream_General, StreamPos, General_Performer);
1059+
PerformerList.erase(PerformerList.begin()+i);
1060+
Fill(Stream_General, StreamPos, General_Performer, PerformerList.Read(), true);
1061+
}
1062+
}
1063+
}
1064+
{
1065+
const auto& Performer=Retrieve_Const(Stream_General, StreamPos, General_Performer);
1066+
const auto& Hardware_CompanyName=Retrieve_Const(Stream_General, StreamPos, General_Encoded_Hardware_CompanyName);
1067+
if (Hardware_CompanyName==__T("Samsung") && Performer.rfind(__T("Galaxy "), 0)==0)
1068+
{
1069+
//Performer is actually not the actual performer
1070+
Fill(Stream_General, StreamPos, General_Encoded_Hardware_Name, Performer, true);
1071+
Clear(Stream_General, StreamPos, General_Performer);
1072+
}
1073+
}
1074+
{
1075+
const auto& Name=Retrieve_Const(Stream_General, StreamPos, General_Encoded_Hardware_Name);
1076+
const auto& Model=Retrieve_Const(Stream_General, StreamPos, General_Encoded_Hardware_Model);
1077+
if (Name==Model)
1078+
{
1079+
//Name is actually the model (technical name), keeping only model
1080+
Clear(Stream_General, StreamPos, General_Encoded_Hardware_Name);
1081+
}
1082+
}
1083+
1084+
//OperatingSystem
1085+
if (Retrieve_Const(Stream_General, StreamPos, General_Encoded_OperatingSystem_String).empty())
1086+
{
1087+
//Filling
1088+
const auto& CompanyName=Retrieve_Const(Stream_General, StreamPos, General_Encoded_OperatingSystem_CompanyName);
1089+
const auto& Name=Retrieve_Const(Stream_General, StreamPos, General_Encoded_OperatingSystem_Name);
1090+
const auto& Version=Retrieve_Const(Stream_General, StreamPos, General_Encoded_OperatingSystem_Version);
1091+
Ztring OperatingSystem=CompanyName;
1092+
if (!Name.empty())
1093+
{
1094+
if (!OperatingSystem.empty())
1095+
OperatingSystem+=' ';
1096+
OperatingSystem+=Name;
1097+
if (!Version.empty())
1098+
{
1099+
OperatingSystem+=' ';
1100+
OperatingSystem+=Version;
1101+
}
1102+
}
1103+
Fill(Stream_General, StreamPos, General_Encoded_OperatingSystem_String, OperatingSystem);
1104+
}
1105+
1106+
//Hardware
1107+
if (Retrieve_Const(Stream_General, StreamPos, General_Encoded_Hardware_String).empty())
1108+
{
1109+
//Filling
1110+
const auto& CompanyName=Retrieve_Const(Stream_General, StreamPos, General_Encoded_Hardware_CompanyName);
1111+
const auto& Name=Retrieve_Const(Stream_General, StreamPos, General_Encoded_Hardware_Name);
1112+
const auto& Model=Retrieve_Const(Stream_General, StreamPos, General_Encoded_Hardware_Model);
1113+
const auto& Version=Retrieve_Const(Stream_General, StreamPos, General_Encoded_Hardware_Version);
1114+
Ztring Hardware=CompanyName;
1115+
if (!Name.empty())
1116+
{
1117+
if (!Hardware.empty())
1118+
Hardware+=' ';
1119+
Hardware+=Name;
1120+
}
1121+
if (!Model.empty())
1122+
{
1123+
if (!Hardware.empty())
1124+
Hardware+=' ';
1125+
if (!Name.empty())
1126+
Hardware+='(';
1127+
Hardware+=Model;
1128+
if (!Name.empty())
1129+
Hardware+=')';
1130+
}
1131+
if (!Hardware.empty() && !Version.empty())
1132+
Hardware+=Version;
1133+
Fill(Stream_General, StreamPos, General_Encoded_Hardware_String, Hardware);
1134+
}
9941135
}
9951136

9961137
//---------------------------------------------------------------------------
@@ -2149,14 +2290,11 @@ void File__Analyze::Streams_Finish_HumanReadable_PerStream(stream_t StreamKind,
21492290
Ztring Name=Retrieve(StreamKind, StreamPos, "Encoded_Application_Name");
21502291
Ztring Version=Retrieve(StreamKind, StreamPos, "Encoded_Application_Version");
21512292
Ztring Date=Retrieve(StreamKind, StreamPos, "Encoded_Application_Date");
2152-
if (!Name.empty())
2293+
if (!CompanyName.empty() || !Name.empty())
21532294
{
2154-
Ztring String;
2155-
if (!CompanyName.empty())
2156-
{
2157-
String+=CompanyName;
2158-
String+=__T(" ");
2159-
}
2295+
Ztring String=CompanyName;
2296+
if (!CompanyName.empty() && !Name.empty())
2297+
String+=' ';
21602298
String+=Name;
21612299
if (!Version.empty())
21622300
{

Source/MediaInfo/MediaInfo_Config_Automatic.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ void MediaInfo_Config_DefaultLanguage (Translation &Info)
215215
"Alignment_Split;Split across interleaves\n"
216216
"All;All\n"
217217
"AlternateGroup;Alternate group\n"
218-
"Android_Version;Android version\n"
219218
"Archival_Location;Archival location\n"
220219
"Arranger;Arranger\n"
221220
"ArtDirector;ArtDirector\n"
@@ -412,8 +411,10 @@ void MediaInfo_Config_DefaultLanguage (Translation &Info)
412411
"EMail;E-Mail\n"
413412
"Encoded_Application;Writing application\n"
414413
"Encoded_Date;Encoded date\n"
414+
"Encoded_Hardware;Writing hardware\n"
415415
"Encoded_Library;Writing library\n"
416416
"Encoded_Library_Settings;Encoding settings\n"
417+
"Encoded_OperatingSystem;Writing operating system\n"
417418
"Encoded_Original;Original support\n"
418419
"EncodedBy;Encoded by\n"
419420
"EPG_Positions;EPG positions (internal)\n"
@@ -1169,7 +1170,6 @@ void MediaInfo_Config_DefaultLanguage (Translation &Info)
11691170
"SamplesPerFrame;Samples per frame\n"
11701171
"SamplingCount;Samples count\n"
11711172
"SamplingRate;Sampling rate\n"
1172-
"Samsung_Model_Number;Samsung model number\n"
11731173
"Save;Save\n"
11741174
"ScanOrder;Scan order\n"
11751175
"ScanOrder_Original;Original scan order\n"
@@ -4600,6 +4600,16 @@ void MediaInfo_Config_General (ZtringListList &Info)
46004600
"Encoded_Library_Date;;;N YTY\n"
46014601
"Encoded_Library_Settings;;;Y YTY\n"
46024602
"Encoded_OperatingSystem;;;N YTY\n"
4603+
"Encoded_OperatingSystem/String;;;Y NT\n"
4604+
"Encoded_OperatingSystem_CompanyName;;;N YTY\n"
4605+
"Encoded_OperatingSystem_Name;;;N YTY\n"
4606+
"Encoded_OperatingSystem_Version;;;N YTY\n"
4607+
"Encoded_Hardware;;;N YTY\n"
4608+
"Encoded_Hardware/String;;;Y NT\n"
4609+
"Encoded_Hardware_CompanyName;;;N YTY\n"
4610+
"Encoded_Hardware_Name;;;N YTY\n"
4611+
"Encoded_Hardware_Model;;;N YTY\n"
4612+
"Encoded_Hardware_Version;;;N YTY\n"
46034613
"Cropped;;;Y YTY\n"
46044614
"Dimensions;;;Y YTY\n"
46054615
"DotsPerInch;;;Y YTY\n"

Source/MediaInfo/Multiple/File_Mpeg4_Elements.cpp

+25-2
Original file line numberDiff line numberDiff line change
@@ -3981,14 +3981,30 @@ void File_Mpeg4::moov_meta_ilst_xxxx_data()
39813981
Fill(Stream_General, 0, General_Comment, Value, true);
39823982
else if (Parameter=="com.apple.quicktime.description")
39833983
Fill(Stream_General, 0, General_Description, Value, true);
3984+
else if (Parameter == "com.apple.quicktime.creationdate")
3985+
Fill(Stream_General, 0, General_Recorded_Date, Value);
3986+
else if (Parameter == "com.apple.quicktime.make")
3987+
Fill(Stream_General, 0, General_Encoded_Hardware_CompanyName, Value);
3988+
else if (Parameter == "com.apple.quicktime.model")
3989+
Fill(Stream_General, 0, General_Encoded_Hardware_Name, Value);
3990+
else if (Parameter == "com.apple.quicktime.software")
3991+
Fill(Stream_General, 0, General_Encoded_Application_Name, Value);
39843992
else if (Parameter=="com.apple.finalcutstudio.media.uuid")
39853993
Fill(Stream_General, 0, "Media/UUID", Value);
39863994
else if (Parameter=="com.apple.finalcutstudio.media.history.uuid")
39873995
Fill(Stream_General, 0, "Media/History/UUID", Value);
39883996
else if (Parameter=="com.android.capture.fps")
39893997
FrameRate_Real=Value;
3998+
else if (Parameter == "com.android.manufacturer")
3999+
Fill(Stream_General, 0, General_Encoded_Hardware_CompanyName, Value);
4000+
else if (Parameter == "com.android.model")
4001+
Fill(Stream_General, 0, General_Encoded_Hardware_Name, Value);
39904002
else if (Parameter=="com.android.version")
3991-
Fill(Stream_General, 0, "Android_Version", Value);
4003+
{
4004+
Fill(Stream_General, 0, General_Encoded_OperatingSystem_CompanyName, "Google");
4005+
Fill(Stream_General, 0, General_Encoded_OperatingSystem_Name, "Android");
4006+
Fill(Stream_General, 0, General_Encoded_OperatingSystem_Version, Value);
4007+
}
39924008
else if (Parameter=="com.universaladid.idregistry")
39934009
{
39944010
Fill(Stream_General, 0, "UniversalAdID_Registry", Value);
@@ -4016,6 +4032,12 @@ void File_Mpeg4::moov_meta_ilst_xxxx_data()
40164032
if (i!=string::npos)
40174033
DisplayAspectRatio.From_Number(Ztring(DisplayAspectRatio.substr(0, i)).To_float64()/Ztring(DisplayAspectRatio.substr(i+1)).To_float64(), 3);
40184034
}
4035+
else if (Parameter=="Encoded_With")
4036+
{
4037+
auto A = Retrieve_Const(Stream_General, 0, General_Encoded_Application_Name);
4038+
if (Value!=Retrieve_Const(Stream_General, 0, General_Encoded_Application_Name))
4039+
Fill(Stream_General, 0, General_Encoded_Application_Name, Value);
4040+
}
40194041
else if (!Parameter.empty())
40204042
Fill(Stream_General, 0, Parameter.c_str(), Value, true);
40214043
FILLING_END();
@@ -9846,7 +9868,8 @@ void File_Mpeg4::moov_udta_smta_mdln()
98469868

98479869
//Filling
98489870
FILLING_BEGIN();
9849-
Fill(Stream_General, 0, "Samsung_Model_Number", SamsungModelNumber);
9871+
Fill(Stream_General, 0, General_Encoded_Hardware_CompanyName, "Samsung");
9872+
Fill(Stream_General, 0, General_Encoded_Hardware_Model, SamsungModelNumber);
98509873
FILLING_END();
98519874
}
98529875

Source/MediaInfo/Multiple/File_Riff_Elements.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -957,11 +957,11 @@ void File_Riff::AVI__exif_xxxx()
957957
//Filling
958958
switch (Element_Code)
959959
{
960-
case Elements::AVI__exif_ecor : Fill(Stream_General, 0, "Make", Value); break;
961-
case Elements::AVI__exif_emdl : Fill(Stream_General, 0, "Model", Value); break;
960+
case Elements::AVI__exif_ecor : Fill(Stream_General, 0, General_Encoded_Hardware_CompanyName, Value); break;
961+
case Elements::AVI__exif_emdl : Fill(Stream_General, 0, General_Encoded_Hardware_Name, Value); break;
962962
case Elements::AVI__exif_emnt : Fill(Stream_General, 0, "MakerNotes", Value); break;
963963
case Elements::AVI__exif_erel : Fill(Stream_General, 0, "RelatedImageFile", Value); break;
964-
case Elements::AVI__exif_etim : Fill(Stream_General, 0, "Written_Date", Value); break;
964+
case Elements::AVI__exif_etim : Fill(Stream_General, 0, General_Encoded_Date, Value); break;
965965
case Elements::AVI__exif_eucm : Fill(Stream_General, 0, General_Comment, Value); break;
966966
case Elements::AVI__exif_ever : break; //Exif version
967967
default: Fill(Stream_General, 0, Ztring().From_CC4((int32u)Element_Code).To_Local().c_str(), Value);

Source/Resource/Text/Language/DefaultLanguage.csv

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ Alignment_Aligned;Aligned on interleaves
186186
Alignment_Split;Split across interleaves
187187
All;All
188188
AlternateGroup;Alternate group
189-
Android_Version;Android version
190189
Archival_Location;Archival location
191190
Arranger;Arranger
192191
ArtDirector;ArtDirector
@@ -383,8 +382,10 @@ ElementCount;Count of elements
383382
EMail;E-Mail
384383
Encoded_Application;Writing application
385384
Encoded_Date;Encoded date
385+
Encoded_Hardware;Writing hardware
386386
Encoded_Library;Writing library
387387
Encoded_Library_Settings;Encoding settings
388+
Encoded_OperatingSystem;Writing operating system
388389
Encoded_Original;Original support
389390
EncodedBy;Encoded by
390391
EPG_Positions;EPG positions (internal)
@@ -1140,7 +1141,6 @@ SamplePeakLevel_Album;Sample peak level (album)
11401141
SamplesPerFrame;Samples per frame
11411142
SamplingCount;Samples count
11421143
SamplingRate;Sampling rate
1143-
Samsung_Model_Number;Samsung model number
11441144
Save;Save
11451145
ScanOrder;Scan order
11461146
ScanOrder_Original;Original scan order

Source/Resource/Text/Stream/General.csv

+11-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,17 @@ Encoded_Library_Name;;;N YTY;;;Name of the encoding software;;Technical
297297
Encoded_Library_Version;;;N YTY;;;Version of the encoding software;;Technical
298298
Encoded_Library_Date;;;N YTY;;;Release date of the encoding software, in UTC;;Technical
299299
Encoded_Library_Settings;;;Y YTY;;;Parameters used by the encoding software;;Technical
300-
Encoded_OperatingSystem;;;N YTY;;;Operating System of the encoding software;;Technical
300+
Encoded_OperatingSystem;;;N YTY;;;Operating system of the encoding software;;Technical
301+
Encoded_OperatingSystem/String;;;Y NT;;;Operating system used to create the file, in the format "CompanyName ProductName (OperatingSystem) Version (Date)";;Technical
302+
Encoded_OperatingSystem_CompanyName;;;N YTY;;;Name of the operating system company;;Technical
303+
Encoded_OperatingSystem_Name;;;N YTY;;;Name of the operating system;;Technical
304+
Encoded_OperatingSystem_Version;;;N YTY;;;Version of the operating system;;Technical
305+
Encoded_Hardware;;;N YTY;;;Hardware of the encoding software;;Technical
306+
Encoded_Hardware/String;;;Y NT;;;Hardware used to create the file, in the format "CompanyName ProductName (ModelName) Version";;Technical
307+
Encoded_Hardware_CompanyName;;;N YTY;;;Name of the hardware company;;Technical
308+
Encoded_Hardware_Name;;;N YTY;;;Name of the hardware;;Technical
309+
Encoded_Hardware_Model;;;N YTY;;;Model of the hardware;;Technical
310+
Encoded_Hardware_Version;;;N YTY;;;Version of the hardware;;Technical
301311
Cropped;;;Y YTY;;;Describes whether an image has been cropped and, if so, how it was cropped;;Technical
302312
Dimensions;;;Y YTY;;;Specifies the size of the original subject of the file (e.g. 8.5 in h, 11 in w);;Technical
303313
DotsPerInch;;;Y YTY;;;Stores dots per inch setting of the digitization mechanism used to produce the file;;Technical

0 commit comments

Comments
 (0)