//! Read any index table segments from a file MDObjectListPtr mxflib::Partition::ReadIndex(MXFFilePtr File, UInt64 Size) { MDObjectListPtr Ret = new MDObjectList; while(Size) { UInt64 Location = File->Tell(); UInt64 Bytes; MDObjectPtr NewIndex = File->ReadObject(NULL); if(NewIndex) { if((NewIndex->Name() == "IndexTableSegment") || (NewIndex->Name() == "V10IndexTableSegment")) { Ret->push_back(NewIndex); Bytes = File->Tell() - Location; } else if( NewIndex->IsA(KLVFill_UL) ) { // Skip over the filler Bytes = File->Tell() - Location; } else { error("Expected to find an IndexTableSegment - found %s at %s\n", NewIndex->FullName().c_str(), NewIndex->GetSourceLocation().c_str()); break; } } else { error("Error reading IndexTableSegment at 0x%s in %s\n", Int64toHexString(Location,8).c_str(), File->Name.c_str()); break; } if(Bytes > Size) break; Size -= Bytes; } return Ret; }