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