From: Alexey K. <akh...@us...> - 2007-02-28 18:29:29
|
Update of /cvsroot/aaf/AAF/test/com/ComModTestAAF/ModuleTests In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv28847 Modified Files: CAAFHeaderTest.cpp Log Message: Ensure that all essence containers declared in the header are used by the mobs in the file and that each mob's container definition is declared in the header. Index: CAAFHeaderTest.cpp =================================================================== RCS file: /cvsroot/aaf/AAF/test/com/ComModTestAAF/ModuleTests/CAAFHeaderTest.cpp,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** CAAFHeaderTest.cpp 28 Feb 2007 18:25:24 -0000 1.47 --- CAAFHeaderTest.cpp 28 Feb 2007 18:29:27 -0000 1.48 *************** *** 116,119 **** --- 116,120 ---- int formatMobName(aafUInt32 itemNumber, wchar_t* mobName); + aafUID_t getMobContainerFormatID(aafUInt32 itemNumber); void cleanupReferences(); void check(HRESULT hr); *************** *** 936,946 **** check(AAFRESULT_TEST_FAILED); aafBoolean_t isPresent = false; ! if(_pHeader2->IsEssenceContainerPresent(pContIDs[0], &isPresent) != AAFRESULT_SUCCESS) check(AAFRESULT_TEST_FAILED); //ensure the container was found if(isPresent == false) check(AAFRESULT_TEST_FAILED); delete [] pContIDs; --- 937,976 ---- check(AAFRESULT_TEST_FAILED); + //check essence containers + for (aafUInt32 c = 0; c < count; ++c) + { aafBoolean_t isPresent = false; ! check(_pHeader2->IsEssenceContainerPresent(pContIDs[c], &isPresent)); ! ! //ensure the container was found ! if(isPresent == false) check(AAFRESULT_TEST_FAILED); + //ensure the container is used by at least one of the mobs + bool found = false; + for (aafUInt32 item = 0; item < gMaxMobCount; ++item) + { + aafUID_t containerFormatID = getMobContainerFormatID(item); + if(containerFormatID == pContIDs[c]) + { + found = true; + break; + } + } + if(found != true) + check(AAFRESULT_TEST_FAILED); + } + + // For each file mob ensure that the container definition it + // references is among essence containers in the header. + for (aafUInt32 item = 0; item < gMaxMobCount; ++item) + { + aafUID_t containerFormatID = getMobContainerFormatID(item); + aafBoolean_t isPresent = false; + check(_pHeader2->IsEssenceContainerPresent(containerFormatID, &isPresent)); //ensure the container was found if(isPresent == false) check(AAFRESULT_TEST_FAILED); + } delete [] pContIDs; *************** *** 948,951 **** --- 978,1041 ---- } + aafUID_t HeaderTest::getMobContainerFormatID(aafUInt32 itemNumber) + { + assert(_pHeader); + assert(0 <= itemNumber && gMaxMobCount > itemNumber); + + IAAFMob* pMob = NULL; + check(_pHeader->LookupMob(_mobID[itemNumber], &pMob)); + + IAAFSourceMob* pSourceMob = NULL; + check(pMob->QueryInterface(IID_IAAFSourceMob, reinterpret_cast<void**>(&pSourceMob))); + + IAAFEssenceDescriptor* pEssenceDescriptor = NULL; + check(pSourceMob->GetEssenceDescriptor(&pEssenceDescriptor)); + + IAAFFileDescriptor* pFileDescriptor = NULL; + check(pEssenceDescriptor->QueryInterface(IID_IAAFFileDescriptor, reinterpret_cast<void**>(&pFileDescriptor))); + + IAAFContainerDef* pContainerDef = 0; + check(pFileDescriptor->GetContainerFormat(&pContainerDef)); + + IAAFDefObject* pDefObject = NULL; + check(pContainerDef->QueryInterface(IID_IAAFDefObject, reinterpret_cast<void**>(&pDefObject))); + + aafUID_t containerDefID; + check(pDefObject->GetAUID(&containerDefID)); + + if (NULL != pMob) + { + pMob->Release(); + pMob = NULL; + } + if (NULL != pSourceMob) + { + pSourceMob->Release(); + pSourceMob = NULL; + } + if (NULL != pEssenceDescriptor) + { + pEssenceDescriptor->Release(); + pEssenceDescriptor = NULL; + } + if (NULL != pFileDescriptor) + { + pFileDescriptor->Release(); + pFileDescriptor = NULL; + } + if (NULL != pContainerDef) + { + pContainerDef->Release(); + pContainerDef = NULL; + } + if (NULL != pDefObject) + { + pDefObject->Release(); + pDefObject = NULL; + } + + return containerDefID; + } + void HeaderTest::checkDescriptiveSchemes() { |