/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AAF_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Aaf.h" #include "MediaInfo/Multiple/File__ReferenceFilesHelper.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "ZenLib/FileName.h" #if defined(MEDIAINFO_REFERENCES_YES) #include "ZenLib/File.h" #endif //defined(MEDIAINFO_REFERENCES_YES) #include "tinyxml2.h" using namespace ZenLib; using namespace tinyxml2; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Info //*************************************************************************** static const char* AAf_tagSTGTY (int8u tagSTGTY) { switch (tagSTGTY) { case 0 : return "unknown"; case 1 : return "storage"; case 2 : return "stream"; case 3 : return "ILockBytes"; case 4 : return "IPropertyStorage"; case 5 : return "root"; default: return ""; } } static const char* AAf_tagDECOLOR (int8u tagDECOLOR) { switch (tagDECOLOR) { case 0 : return "red"; case 1 : return "black"; default: return ""; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Aaf::File_Aaf() :File__Analyze(), File__HasReferences() { #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Aaf; StreamIDs_Width[0]=16; #endif //MEDIAINFO_EVENTS } //--------------------------------------------------------------------------- File_Aaf::~File_Aaf() { for (size_t Pos=0; Pos109?109:csectFat); Pos++) { int32u sectFat; Get_L4 (sectFat, "sectFat"); sectsFat.push_back(sectFat); } if (csectFat<109) Skip_XX((109-csectFat)*4, "unused sectsFat"); Element_End(); Element_End(); FILLING_BEGIN(); Fill("Aaf"); Step=Step_Fat; sectsFat_Pos=0; if (sectsFat.empty()) { Finish(); } else GoTo((1+sectsFat[0])*(1<Size>SectorShift)-1; if (Pointers_PosStreamOffsets[0]); } } else Finish(); } else Finish(); } //--------------------------------------------------------------------------- void File_Aaf::Fat() { //Parsing while (Element_Offset>(SectorShift-MiniSectorShift); int32u MiniSectPos=Pointers_Pos&((((size_t)1)<<(SectorShift-MiniSectorShift))-1); Stream->StreamOffsets.push_back(((1+sectsMiniStream[SectPos])<StreamOffsets.push_back((1+Pointers_Pos)<=Streams.size() || Streams[Streams_Pos]->Size>=0x1000000) //TODO: more serious test about size return; //Incoherancy //Saving data if (Streams[Streams_Pos]->StreamOffsets.size()!=1) { Skip_XX(Element_Size, "Stream data"); int16u Shift=(Streams[Streams_Pos]->SizeBuffer==NULL) Streams[Streams_Pos]->Buffer=new int8u[(size_t)((1+(Streams[Streams_Pos]->Size>>Shift))<Buffer+Streams_Pos2*(((int64u)1)<=Streams[Streams_Pos]->StreamOffsets.size()) { Element_Offset=0; StreamElement_Parse(); Streams_Pos++; Streams_Pos2=0; } if (Streams_PosStreamOffsets[Streams_Pos2]); else Finish(); } //--------------------------------------------------------------------------- void File_Aaf::StreamElement_Parse() { //Searching emulation_prevention_three_byte const int8u* Save_Buffer=Buffer; int64u Save_File_Offset=File_Offset; size_t Save_Buffer_Offset=Buffer_Offset; int64u Save_Element_Size=Element_Size; if (Streams[Streams_Pos]->Buffer) { //We must change the buffer for keeping out Element_Size=Streams[Streams_Pos]->Size; File_Offset=Streams[Streams_Pos]->StreamOffsets[0]; Buffer_Offset=0; Buffer=Streams[Streams_Pos]->Buffer; } //Parsing Element_Info1(Streams[Streams_Pos]->Directory_Pos); Element_Info1(Streams[Streams_Pos]->Name); int16u Count; Skip_L2( "0x204C?"); Get_L2 (Count, "Count"); vector Sizes; vector Keys; for (int16u Pos=0; PosBuffer) { //We must change the buffer for keeping out Element_Size=Save_Element_Size; File_Offset=Save_File_Offset; Buffer_Offset=Save_Buffer_Offset; delete[] Buffer; Buffer=Save_Buffer; Element_Offset=Element_Size; } } //--------------------------------------------------------------------------- void File_Aaf::MetaDictionary() { Skip_UTF16L(xxxSize, "Data"); } //--------------------------------------------------------------------------- void File_Aaf::Header() { Skip_UTF16L(xxxSize, "Data"); } //--------------------------------------------------------------------------- void File_Aaf::ClassDefinitions() { Skip_UTF16L(xxxSize, "Data"); } //--------------------------------------------------------------------------- void File_Aaf::TypeDefinitions() { Skip_UTF16L(xxxSize, "Data"); } //--------------------------------------------------------------------------- void File_Aaf::Identification() { Skip_B8( "Part2"); Skip_B8( "Part1"); } //--------------------------------------------------------------------------- void File_Aaf::Name() { Skip_UTF16L(xxxSize, "Data"); } //--------------------------------------------------------------------------- void File_Aaf::MetaDefinition() { Skip_UTF16L(xxxSize, "Data"); } //--------------------------------------------------------------------------- void File_Aaf::ParentClass() { Skip_B5( "WeakReference"); Skip_B8( "Part2"); Skip_B8( "Part1"); } //--------------------------------------------------------------------------- void File_Aaf::Properties() { Skip_UTF16L(xxxSize, "Data"); } //--------------------------------------------------------------------------- void File_Aaf::IsConcrete() { Skip_L1( "Data"); } //--------------------------------------------------------------------------- void File_Aaf::Type() { Skip_B8( "Part2"); Skip_B8( "Part1"); } //--------------------------------------------------------------------------- void File_Aaf::IsOptional() { Skip_L1( "Data"); } //--------------------------------------------------------------------------- void File_Aaf::LocalIdentification() { Skip_L2( "Data"); } //--------------------------------------------------------------------------- void File_Aaf::IsUniqueIdentifier() { Skip_L1( "Data"); } //--------------------------------------------------------------------------- void File_Aaf::Size() { Skip_L1( "Data"); } //--------------------------------------------------------------------------- void File_Aaf::Locked() { Skip_L1( "Data"); //Descriptors[Streams[Streams_Pos]->Directory_Pos].StreamKind=Stream_Audio; } //--------------------------------------------------------------------------- void File_Aaf::NetworkLocator() { Ztring Data; Get_UTF16L(xxxSize, Data, "Data"); #if defined(MEDIAINFO_REFERENCES_YES) sequence* Sequence=new sequence; Sequence->AddFileName(Data); ReferenceFiles->AddSequence(Sequence); #endif //MEDIAINFO_REFERENCES_YES //Locators[Streams[Streams_Pos]->Directory_Pos].EssenceLocator=Data; } } //NameSpace #endif //MEDIAINFO_AAF_YES