@@ -991,6 +991,173 @@ void File__Analyze::Streams_Finish_StreamOnly_General(size_t StreamPos)
991
991
if (Channels_Total)
992
992
Fill (Stream_General, StreamPos, General_Audio_Channels_Total, Channels_Total);
993
993
}
994
+
995
+ // Exceptions (empiric)
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
+ if (Retrieve_Const (Stream_General, StreamPos, General_Encoded_Hardware_Name).empty ())
1046
+ {
1047
+ const auto & Performer=Retrieve_Const (Stream_General, StreamPos, General_Performer);
1048
+ const auto & Hardware_CompanyName=Retrieve_Const (Stream_General, StreamPos, General_Encoded_Hardware_CompanyName);
1049
+ ZtringList PerformerList;
1050
+ PerformerList.Separator_Set (0 , __T (" / " ));
1051
+ PerformerList.Write (Performer);
1052
+ set<Ztring> HardwareName_List;
1053
+ for (size_t i=0 ; i<PerformerList.size (); i++)
1054
+ {
1055
+ const auto & PerformerItem=PerformerList[i];
1056
+ if (PerformerItem.size ()-Hardware_CompanyName.size ()<=16 && PerformerItem.rfind (Hardware_CompanyName+__T (' ' ), 0 )==0 )
1057
+ {
1058
+ HardwareName_List.insert (PerformerItem.substr (Hardware_CompanyName.size () + 1 ));
1059
+ PerformerList.erase (PerformerList.begin ()+i);
1060
+ continue ;
1061
+ }
1062
+ if (Hardware_CompanyName==__T (" Samsung" ) && PerformerItem.size ()<=32 && PerformerItem.rfind (__T (" Galaxy " ), 0 )==0 )
1063
+ {
1064
+ ZtringList Items;
1065
+ Items.Separator_Set (0 , __T (" " ));
1066
+ Items.Write (PerformerItem);
1067
+ if (Items.size ()<6 )
1068
+ {
1069
+ auto IsLikelyName=false ;
1070
+ auto LastHasOnlyDigits=false ;
1071
+ for (const auto & Item : Items)
1072
+ {
1073
+ size_t HasUpper=0 ;
1074
+ size_t HasDigit=0 ;
1075
+ for (const auto & Value : Item)
1076
+ {
1077
+ HasUpper+=IsAsciiUpper (Value);
1078
+ HasDigit+=IsAsciiDigit (Value);
1079
+ }
1080
+ LastHasOnlyDigits=HasDigit==Item.size ();
1081
+ if (Item.size ()==1 || HasUpper>=2 || (HasDigit && HasDigit<Item.size ()))
1082
+ IsLikelyName=true ;
1083
+ }
1084
+ if (IsLikelyName || LastHasOnlyDigits)
1085
+ {
1086
+ HardwareName_List.insert (PerformerItem);
1087
+ PerformerList.erase (PerformerList.begin ()+i);
1088
+ continue ;
1089
+ }
1090
+ }
1091
+ }
1092
+ }
1093
+ if (HardwareName_List.size ()==1 )
1094
+ {
1095
+ // Performer is likely the actual performer
1096
+ Fill (Stream_General, StreamPos, General_Encoded_Hardware_Name, *HardwareName_List.begin ());
1097
+ Fill (Stream_General, StreamPos, General_Performer, PerformerList.Read (), true );
1098
+ }
1099
+ }
1100
+ {
1101
+ const auto & Name=Retrieve_Const (Stream_General, StreamPos, General_Encoded_Hardware_Name);
1102
+ const auto & Model=Retrieve_Const (Stream_General, StreamPos, General_Encoded_Hardware_Model);
1103
+ if (Name==Model)
1104
+ {
1105
+ // Name is actually the model (technical name), keeping only model
1106
+ Clear (Stream_General, StreamPos, General_Encoded_Hardware_Name);
1107
+ }
1108
+ }
1109
+
1110
+ // OperatingSystem
1111
+ if (Retrieve_Const (Stream_General, StreamPos, General_Encoded_OperatingSystem_String).empty ())
1112
+ {
1113
+ // Filling
1114
+ const auto & CompanyName=Retrieve_Const (Stream_General, StreamPos, General_Encoded_OperatingSystem_CompanyName);
1115
+ const auto & Name=Retrieve_Const (Stream_General, StreamPos, General_Encoded_OperatingSystem_Name);
1116
+ const auto & Version=Retrieve_Const (Stream_General, StreamPos, General_Encoded_OperatingSystem_Version);
1117
+ Ztring OperatingSystem=CompanyName;
1118
+ if (!Name.empty ())
1119
+ {
1120
+ if (!OperatingSystem.empty ())
1121
+ OperatingSystem+=' ' ;
1122
+ OperatingSystem+=Name;
1123
+ if (!Version.empty ())
1124
+ {
1125
+ OperatingSystem+=' ' ;
1126
+ OperatingSystem+=Version;
1127
+ }
1128
+ }
1129
+ Fill (Stream_General, StreamPos, General_Encoded_OperatingSystem_String, OperatingSystem);
1130
+ }
1131
+
1132
+ // Hardware
1133
+ if (Retrieve_Const (Stream_General, StreamPos, General_Encoded_Hardware_String).empty ())
1134
+ {
1135
+ // Filling
1136
+ const auto & CompanyName=Retrieve_Const (Stream_General, StreamPos, General_Encoded_Hardware_CompanyName);
1137
+ const auto & Name=Retrieve_Const (Stream_General, StreamPos, General_Encoded_Hardware_Name);
1138
+ const auto & Model=Retrieve_Const (Stream_General, StreamPos, General_Encoded_Hardware_Model);
1139
+ const auto & Version=Retrieve_Const (Stream_General, StreamPos, General_Encoded_Hardware_Version);
1140
+ Ztring Hardware=CompanyName;
1141
+ if (!Name.empty ())
1142
+ {
1143
+ if (!Hardware.empty ())
1144
+ Hardware+=' ' ;
1145
+ Hardware+=Name;
1146
+ }
1147
+ if (!Model.empty ())
1148
+ {
1149
+ if (!Hardware.empty ())
1150
+ Hardware+=' ' ;
1151
+ if (!Name.empty ())
1152
+ Hardware+=' (' ;
1153
+ Hardware+=Model;
1154
+ if (!Name.empty ())
1155
+ Hardware+=' )' ;
1156
+ }
1157
+ if (!Hardware.empty () && !Version.empty ())
1158
+ Hardware+=Version;
1159
+ Fill (Stream_General, StreamPos, General_Encoded_Hardware_String, Hardware);
1160
+ }
994
1161
}
995
1162
996
1163
// ---------------------------------------------------------------------------
@@ -2149,14 +2316,11 @@ void File__Analyze::Streams_Finish_HumanReadable_PerStream(stream_t StreamKind,
2149
2316
Ztring Name=Retrieve (StreamKind, StreamPos, " Encoded_Application_Name" );
2150
2317
Ztring Version=Retrieve (StreamKind, StreamPos, " Encoded_Application_Version" );
2151
2318
Ztring Date=Retrieve (StreamKind, StreamPos, " Encoded_Application_Date" );
2152
- if (!Name.empty ())
2319
+ if (!CompanyName. empty () || ! Name.empty ())
2153
2320
{
2154
- Ztring String;
2155
- if (!CompanyName.empty ())
2156
- {
2157
- String+=CompanyName;
2158
- String+=__T (" " );
2159
- }
2321
+ Ztring String=CompanyName;
2322
+ if (!CompanyName.empty () && !Name.empty ())
2323
+ String+=' ' ;
2160
2324
String+=Name;
2161
2325
if (!Version.empty ())
2162
2326
{
0 commit comments