/* Copyright (c) MediaArea.net SARL. All Rights Reserved. * * Use of this source code is governed by a BSD-style license that can * be found in the License.html file in the root of the source tree. */ // RegressionTest.cpp : Defines the entry point for the console application. // #include #include #include "tchar.h" #include "MediaInfoDLL/MediaInfoDLL.h" #include "ZenLib/ZtringListListF.h" #include "ZenLib/File.h" #include "ZenLib/Dir.h" extern "C" { #include "md5.h" } #include "RegressionTest/RegressionTest.h" using namespace MediaInfoDLL; using namespace ZenLib; using namespace std; void WriteMd5Info(const Ztring &FileName, MediaInfo &MI, const Ztring &DataBaseDirectory) { int8u* Buffer=new int8u[0x1000000]; File F; String MD5_FromMI=MI.Get(Stream_General, 0, __T("MD5")); String Format=MI.Get(Stream_General, 0, __T("Format")); Ztring MD5_FromFile; if (!MD5_FromMI.empty()) { F.Open(FileName); MD5Context Context; MD5Init(&Context); size_t Size; do { Size=F.Read(Buffer, 0x1000000); MD5Update(&Context, Buffer, Size); } while (Size==0x1000000); unsigned char Digest[16]; MD5Final(Digest, &Context); MD5_FromFile+=Ztring().From_CC2(BigEndian2int16u(Digest+ 0)); MD5_FromFile+=Ztring().From_CC2(BigEndian2int16u(Digest+ 2)); MD5_FromFile+=Ztring().From_CC2(BigEndian2int16u(Digest+ 4)); MD5_FromFile+=Ztring().From_CC2(BigEndian2int16u(Digest+ 6)); MD5_FromFile+=Ztring().From_CC2(BigEndian2int16u(Digest+ 8)); MD5_FromFile+=Ztring().From_CC2(BigEndian2int16u(Digest+10)); MD5_FromFile+=Ztring().From_CC2(BigEndian2int16u(Digest+12)); MD5_FromFile+=Ztring().From_CC2(BigEndian2int16u(Digest+14)); MD5_FromFile.MakeLowerCase(); } bool EmptyNormal=false; if (MD5_FromMI.empty() && Format==__T("MXF") && MI.Get(Stream_General, 0, __T("Format_Settings")).find(__T("Open / "))!=string::npos) { Format+=__T(" ")+MI.Get(Stream_General, 0, __T("Format_Settings")); EmptyNormal=true; } if (MD5_FromMI.empty() && Format.empty()) { EmptyNormal=true; } if (MD5_FromMI.empty() || EmptyNormal) { F.Open(DataBaseDirectory+(EmptyNormal?__T("\\MD5.EmptyNormal.csv"):__T("\\MD5.________________Missing.csv")), File::Access_Write_Append); F.Write(FileName+__T(";")+MI.Get(Stream_General, 0, __T("Format"))+EOL); } else if (MD5_FromMI==MD5_FromFile) { F.Open(DataBaseDirectory+__T("\\MD5.Success.csv"), File::Access_Write_Append); F.Write(FileName+__T(";")+Format+__T(";")+MD5_FromMI+EOL); } else { F.Open(DataBaseDirectory+__T("\\MD5.________________Fail.csv"), File::Access_Write_Append); F.Write(FileName+__T(";")+MI.Get(Stream_General, 0, __T("Format"))+__T(";")+MD5_FromMI+__T(";")+MD5_FromFile+EOL); } delete[] Buffer; } void RegressionTest_Md5(Ztring Files, Ztring DataBaseDirectory, int32u Scenario) { cout<<" Analyzing"<Percentage) { cout<<" "<