本文整理汇总了C++中IAAFDictionary::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ IAAFDictionary::Release方法的具体用法?C++ IAAFDictionary::Release怎么用?C++ IAAFDictionary::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAAFDictionary
的用法示例。
在下文中一共展示了IAAFDictionary::Release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Close
void EventTest::Close()
{
if (_pDictionary)
{
_pDictionary->Release();
_pDictionary = NULL;
}
if (_pHeader)
{
_pHeader->Release();
_pHeader = NULL;
}
if (_pFile)
{
if (_bWritableFile)
checkResult(_pFile->Save());
checkResult(_pFile->Close());
_pFile->Release();
_pFile = NULL;
}
}
示例2: cleanupReferences
void EnumEssenceDataTest::cleanupReferences()
{
if (NULL != _pEssenceData)
{
_pEssenceData->Release();
_pEssenceData = NULL;
}
if (NULL != _pEnumEssenceData)
{
_pEnumEssenceData->Release();
_pEnumEssenceData = NULL;
}
if (NULL != _pFileDescriptor)
{
_pFileDescriptor->Release();
_pFileDescriptor = NULL;
}
if (NULL != _pEssenceDescriptor)
{
_pEssenceDescriptor->Release();
_pEssenceDescriptor = NULL;
}
if (NULL != _pSourceMob)
{
_pSourceMob->Release();
_pSourceMob = NULL;
}
if (NULL != _pMob)
{
_pMob->Release();
_pMob = NULL;
}
if (NULL != _pDictionary)
{
_pDictionary->Release();
_pDictionary = NULL;
}
if (NULL != _pHeader)
{
_pHeader->Release();
_pHeader = NULL;
}
if (NULL != _pFile)
{
if (_bFileOpen)
_pFile->Close();
_pFile->Release();
_pFile = NULL;
}
}
示例3: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar * pFileName )
{
HRESULT hr = AAFRESULT_SUCCESS;
IAAFFile* pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFDictionary * pDict = NULL;
aafBoolean_t bFileOpen = kAAFFalse;
try
{
// Open the file
checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
bFileOpen = kAAFTrue;
checkResult (pFile->GetHeader (&pHeader));
assert (pHeader);
checkResult (pHeader->GetDictionary (&pDict));
assert (pDict);
// Read the mob, slots, etc to verify the contents ...
checkResult(verifyContents (pHeader, pDict, kAAFFalse)); //False => NOT minimal testing; i.e. test everything
}//try
catch (HRESULT & rResult)
{
hr = rResult;
}
if (pDict) pDict->Release();
if (pHeader) pHeader->Release();
if (bFileOpen && pFile)
{
stopGap(pFile->Close());
pFile->Release();
}
return hr;
}//ReadAAFFile()
示例4: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
// IAAFSession * pSession = NULL;
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFSourceMob *pSourceMob = NULL;
IAAFMob *pMob = NULL;
IAAFEssenceDescriptor *edesc = NULL;
HRESULT hr = S_OK;
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the file
checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
bFileOpen = true;
// We can't really do anthing in AAF without the header.
checkResult(pFile->GetHeader(&pHeader));
// Get the AAF Dictionary so that we can create valid AAF objects.
checkResult(pHeader->GetDictionary(&pDictionary));
CAAFBuiltinDefs defs (pDictionary);
//Make the first mob
// Create a FileMob
checkResult(defs.cdSourceMob()->
CreateInstance(IID_IAAFSourceMob,
(IUnknown **)&pSourceMob));
checkResult(pSourceMob->QueryInterface (IID_IAAFMob, (void **)&pMob));
checkResult(pMob->SetMobID(TEST_File_MobID));
checkResult(pMob->SetName(L"File Mob"));
// Check the Mob2 usage code implementations.
// Need IAAFMob2 for to do that.
{
IAAFSmartPointer<IAAFMob2> pMobInterface2;
checkResult( pMob->QueryInterface( IID_IAAFMob2, reinterpret_cast<void**>(&pMobInterface2) ) );
checkResult( pMobInterface2->SetUsageCode( kAAFUsage_Template ) );
}
// Create a concrete subclass of FileDescriptor
checkResult(defs.cdAIFCDescriptor()->
CreateInstance(IID_IAAFEssenceDescriptor,
(IUnknown **)&edesc));
IAAFAIFCDescriptor* pAIFCDesc = NULL;
checkResult(edesc->QueryInterface (IID_IAAFAIFCDescriptor, (void **)&pAIFCDesc));
checkResult(pAIFCDesc->SetSummary (5, (unsigned char*)"TEST"));
pAIFCDesc->Release();
pAIFCDesc = NULL;
checkResult(pSourceMob->SetEssenceDescriptor (edesc));
checkResult(pHeader->AddMob(pMob));
// Reusing local variable so we need to release the inteface.
pMob->Release();
pMob = NULL;
// Create a MasterMob
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult(pMob->SetMobID(TEST_Master_MobID));
checkResult(pMob->SetName(L"Master Mob"));
// Check the Mob2 usage code implementations.
// Need IAAFMob2 for to do that.
{
IAAFSmartPointer<IAAFMob2> pMobInterface2;
checkResult( pMob->QueryInterface( IID_IAAFMob2, reinterpret_cast<void**>(&pMobInterface2) ) );
checkResult( pMobInterface2->SetUsageCode( kAAFUsage_Template ) );
}
checkResult(pHeader->AddMob(pMob));
// Reusing local variable so we need to release the inteface.
pMob->Release();
pMob = NULL;
// Create a CompositionMob
checkResult(defs.cdCompositionMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
//.........这里部分代码省略.........
示例5: ModifyAAFFile
static HRESULT ModifyAAFFile(aafWChar *filename, int level)
{
HRESULT hr = S_OK;
try
{
// Open existing file for modification
IAAFFile *pFile = NULL;
TestProductID.productVersionString = const_cast<aafWChar*>(L"ModifyAAFFile");
checkResult( AAFFileOpenExistingModify(
filename,
0, // modeFlags
&TestProductID,
&pFile) );
cout << "ModifyAAFFile() - appended Identification" << endl;
// Get the header & dictionary
IAAFHeader *pHeader = NULL;
IAAFDictionary *pDictionary = NULL;
checkResult(pFile->GetHeader(&pHeader));
checkResult(pHeader->GetDictionary(&pDictionary));
// Search for Mobs
IAAFMob *pFileMob = NULL;
IEnumAAFMobs *pFileMobIter = NULL;
aafSearchCrit_t criteria;
criteria.searchTag = kAAFByMobKind;
criteria.tags.mobKind = kAAFFileMob; // Search by File Mob
checkResult(pHeader->GetMobs(&criteria, &pFileMobIter));
while (AAFRESULT_SUCCESS == pFileMobIter->NextOne(&pFileMob))
{
if (level == 0)
break;
IAAFEssenceDescriptor *edesc = NULL;
IAAFSourceMob *pSourceMob = NULL;
CR(pFileMob->QueryInterface(IID_IAAFSourceMob, (void **)&pSourceMob));
CR(pSourceMob->GetEssenceDescriptor(&edesc));
// Change the Name property
CR(pFileMob->SetName(L"ModifyAAFFile - modified Name"));
cout << "ModifyAAFFile() - changed FileMob's Name property" << endl;
if (level == 1)
break;
// Change descriptor's properties
IAAFAIFCDescriptor *pAIFCDesc = NULL;
CR(edesc->QueryInterface(IID_IAAFAIFCDescriptor, (void **)&pAIFCDesc));
aafUInt8 AIFCsum[] = {0xa1,0xfc};
CR(pAIFCDesc->SetSummary(sizeof(AIFCsum), AIFCsum));
pAIFCDesc->Release();
edesc->Release();
cout << "ModifyAAFFile() - changed AIFCDescriptor's Summary" << endl;
if (level == 2)
break;
// Change descriptor to new one (overwriting old one)
IAAFClassDef *classDef = NULL;
IAAFFileDescriptor *pFileDesc = NULL;
IAAFWAVEDescriptor *pWAVEDesc = NULL;
IAAFEssenceDescriptor *pNewEdesc = NULL;
CR(pDictionary->LookupClassDef(AUID_AAFWAVEDescriptor, &classDef));
CR(classDef->CreateInstance(IID_IAAFFileDescriptor, (IUnknown **)&pFileDesc));
CR(pFileDesc->QueryInterface(IID_IAAFWAVEDescriptor, (void **)&pWAVEDesc));
CR(pFileDesc->QueryInterface(IID_IAAFEssenceDescriptor, (void **)&pNewEdesc));
aafUInt8 WAVEsum[] = {0x1a,0x1e,0xee,0xee};
CR(pWAVEDesc->SetSummary(sizeof(WAVEsum), WAVEsum));
CR(pSourceMob->SetEssenceDescriptor(pNewEdesc));
pNewEdesc->Release();
pWAVEDesc->Release();
pFileDesc->Release();
classDef->Release();
cout << "ModifyAAFFile() - replaced AIFCDescriptor with WAVEDescriptor" << endl;
if (level == 3)
break;
// Add EssenceData
IAAFEssenceData *pEssenceData = NULL;
IAAFEssenceData2 *pEssenceData2 = NULL;
IAAFPlainEssenceData *pPlainEssenceData = NULL;
aafUInt32 bytesWritten = 0;
aafUInt8 essdata[] = "Zaphod Beeblebrox";
CR(pDictionary->LookupClassDef(AUID_AAFEssenceData, &classDef));
CR(classDef->CreateInstance(IID_IAAFEssenceData, (IUnknown **)&pEssenceData));
CR(pEssenceData->SetFileMob(pSourceMob));
CR(pHeader->AddEssenceData(pEssenceData));
CR(pEssenceData->QueryInterface(IID_IAAFEssenceData2, (void**)&pEssenceData2));
CR(pEssenceData2->GetPlainEssenceData(0, &pPlainEssenceData));
CR(pPlainEssenceData->Write(sizeof(essdata), essdata, &bytesWritten));
pEssenceData->Release();
pEssenceData2->Release();
pPlainEssenceData->Release();
classDef->Release();
//.........这里部分代码省略.........
示例6: CreateAAFFile
//.........这里部分代码省略.........
checkResult(pOperationDef->AddParameterDef (pParamDef));
checkResult(pOperationDef->SetBypass (TEST_BYPASS));
// ------------------------------------------------------------
// To test a Transition we need to create a Sequence which will
// a Filler, a transition and another Filler. I know this is not
// very interesting, but it will let us test the Transition
// interface with the least amount of other stuff.
// ------------------------------------------------------------
//
// Create a CompositionMob
checkResult(defs.cdCompositionMob()->
CreateInstance(IID_IAAFCompositionMob,
(IUnknown **)&pCompMob));
checkResult(pCompMob->Initialize(L"Transition Test"));
// Get a MOB interface
checkResult(pCompMob->QueryInterface (IID_IAAFMob, (void **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
// Create a Sequence
checkResult(defs.cdSequence()->
CreateInstance(IID_IAAFSequence,
(IUnknown **) &pSequence));
// Get a Segment interface
checkResult(pSequence->QueryInterface(IID_IAAFSegment, (void **)&pSegment));
// Get a component interface and
checkResult(pSequence->QueryInterface(IID_IAAFComponent, (void **)&pComponent));
// set the Data definition for it !
checkResult(pComponent->SetDataDef(defs.ddkAAFPicture()));
// Release the component - because we need to reuse the pointer later
pComponent->Release();
pComponent = NULL;
// Create a new Mob Slot that will contain the sequence
aafRational_t editRate = { 0, 1};
checkResult(pMob->AppendNewTimelineSlot(editRate,
pSegment,
1,
L"Transition",
0,
&pNewSlot));
// Create a Filler
checkResult(defs.cdFiller()->
CreateInstance(IID_IAAFFiller,
(IUnknown **) &pFiller));
// Get a component interface
checkResult(pFiller->QueryInterface(IID_IAAFComponent, (void **) &pComponent));
// Set values for the filler
checkResult(pFiller->Initialize(defs.ddkAAFPicture(), fillerLength));
// append the filler to the sequence
checkResult(pSequence->AppendComponent(pComponent));
// Release the component - because we need to reuse the pointer later
pFiller->Release();
pFiller = NULL;
pComponent->Release();
pComponent = NULL;
checkResult(defs.cdTransition()->
CreateInstance(IID_IAAFTransition,
示例7: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar* pFileName)
{
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IEnumAAFContainerDefs *pPlug = NULL;
IAAFContainerDef *pPlugDef = NULL;
IAAFDefObject *pDef = NULL;
bool bFileOpen = false;
aafBool testBool;
aafUID_t readUID;
HRESULT hr = S_OK;
try
{
// Open the AAF file
checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
bFileOpen = true;
// Get the AAF file header.
checkResult(pFile->GetHeader(&pHeader));
checkResult(pHeader->GetDictionary(&pDictionary));
checkResult(pDictionary->GetContainerDefs(&pPlug));
while(pPlug->NextOne (&pPlugDef) == AAFRESULT_SUCCESS)
{
checkResult(pPlugDef->QueryInterface (IID_IAAFDefObject, (void **)&pDef));
checkResult(pDef->GetAUID(&readUID));
if(memcmp(&readUID, &testUID, sizeof(aafUID_t)) == 0)
{
checkResult(pPlugDef->EssenceIsIdentified (&testBool));
checkExpression(testBool == kAAFTrue, AAFRESULT_TEST_FAILED);
break;
}
pDef->Release();
pDef = NULL;
pPlugDef->Release();
pPlugDef = NULL;
}
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pDef)
pDef->Release();
if (pPlugDef)
pPlugDef->Release();
if (pPlug)
pPlug->Release();
if (pDictionary)
pDictionary->Release();
if (pHeader)
pHeader->Release();
if (pFile)
{ // Close file
if (bFileOpen)
pFile->Close();
pFile->Release();
}
return hr;
}
示例8: TestTypeDefInt
//.........这里部分代码省略.........
pvSize = sizeTable[pvIndex];
if ((1 == pvSize) ||
(2 == pvSize) ||
(4 == pvSize) ||
(8 == pvSize))
{
td = typeDefTable[pvIndex][sign];
}
else
continue; // skip rest of the loop
aafInt64 setData = negVal ? -(aafInt32)setSize : setSize;
hr = TestOneValue (setSize,
setData,
getSize,
pvSize,
sign? kAAFTrue : kAAFFalse,
td);
//
// first test for expected failures
//
if ((setSize != 1) &&
(setSize != 2) &&
(setSize != 4) &&
(setSize != 8))
{
if (AAFRESULT_BAD_SIZE != hr)
throw AAFRESULT_TEST_FAILED;
}
else if ((getSize != 1) &&
(getSize != 2) &&
(getSize != 4) &&
(getSize != 8))
{
if (AAFRESULT_BAD_SIZE != hr)
throw AAFRESULT_TEST_FAILED;
}
else if ((setSize > pvSize) ||
(pvSize > getSize))
{
if (AAFRESULT_BAD_SIZE != hr)
throw AAFRESULT_TEST_FAILED;
}
else
{
// if we're here, it should pass.
checkResult (hr);
}
}
}
catch (HRESULT & rResult)
{
caughtHr = rResult;
}
if (ptds8)
ptds8->Release();
if (ptds16)
ptds16->Release();
if (ptds32)
ptds32->Release();
if (ptds64)
ptds64->Release();
if (ptdu8)
ptdu8->Release();
if (ptdu16)
ptdu16->Release();
if (ptdu32)
ptdu32->Release();
if (ptdu64)
ptdu64->Release();
if (pDict)
pDict->Release();
if (pHeader)
pHeader->Release();
if (pFile)
{
if(mode == kAAFUnitTestReadWrite)
{
hr = pFile->Save();
if (! SUCCEEDED (hr))
{
pFile->Release();
return hr;
}
}
hr = pFile->Close();
pFile->Release();
}
return (caughtHr != AAFRESULT_SUCCESS) ? caughtHr : hr;
}
示例9: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar* pFileName)
{
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IEnumAAFContainerDefs *pPlug = NULL;
IAAFDefObject* pDef = NULL;
IAAFContainerDef* pContainerDef = NULL;
bool bFileOpen = false;
HRESULT hr = S_OK;
aafUID_t readUID;
wchar_t testString[256];
try
{
// Open the AAF file
checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
bFileOpen = true;
// Get the AAF file header.
checkResult(pFile->GetHeader(&pHeader));
checkResult(pHeader->GetDictionary(&pDictionary));
checkResult(pDictionary->GetContainerDefs(&pPlug));
while(pPlug->NextOne (&pContainerDef) == AAFRESULT_SUCCESS)
{
checkResult(pContainerDef->QueryInterface (IID_IAAFDefObject, (void **)&pDef));
checkResult(pDef->GetAUID(&readUID));
if(memcmp(&readUID, &testUID, sizeof(aafUID_t)) == 0)
{
checkResult(pDef->GetName (testString, sizeof(testString)));
checkExpression (wcscmp(testString, sName) == 0, AAFRESULT_TEST_FAILED);
aafUInt32 nameLen;
checkResult (pDef->GetNameBufLen (&nameLen));
checkExpression (((wcslen (sName)+1) * sizeof (aafCharacter) == nameLen),
AAFRESULT_TEST_FAILED);
checkResult(pDef->GetDescription (testString, sizeof(testString)));
checkExpression (wcscmp(testString, sDescription) == 0, AAFRESULT_TEST_FAILED);
checkResult (pDef->GetDescriptionBufLen (&nameLen));
checkExpression (((wcslen (sDescription)+1) * sizeof (aafCharacter) == nameLen),
AAFRESULT_TEST_FAILED);
break;
}
pDef->Release();
pDef = NULL;
pContainerDef->Release();
pContainerDef = NULL;
}// checkResult(pPlug->NextOne(&pContainerDef));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pHeader)
pHeader->Release();
if (pPlug)
pPlug->Release();
if (pDef)
pDef->Release();
if (pContainerDef)
pContainerDef->Release();
if (pDictionary)
pDictionary->Release();
if (pFile)
{ // Close file
if (bFileOpen)
pFile->Close();
pFile->Release();
}
return hr;
}
示例10: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
// IAAFSession *pSession = NULL;
IAAFFile *pFile = NULL;
IAAFHeader *pHeader = NULL;
IAAFDictionary *pDictionary = NULL;
IAAFLocator *pLocator = NULL;
IAAFLocator *pLocator2 = NULL;
IAAFSourceMob *pSourceMob = NULL;
IAAFMob *pMob = NULL;
IAAFEssenceDescriptor *edesc = NULL;
IEnumAAFLocators *pEnumLocators = NULL;
aafUInt32 numLocators, numLocators2;
aafUInt32 i;
HRESULT hr = AAFRESULT_SUCCESS,
localhr = AAFRESULT_SUCCESS;
bool bFileOpen = false;
// aafUID_t ddef = kAAFDataDef_Sound;
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the file.
checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
bFileOpen = true;
// We can't really do anthing in AAF without the header.
checkResult(pFile->GetHeader(&pHeader));
// Get the AAF Dictionary so that we can create valid AAF objects.
checkResult(pHeader->GetDictionary(&pDictionary));
CAAFBuiltinDefs defs (pDictionary);
//Make the first mob
// Create a Mob
checkResult(defs.cdSourceMob()->
CreateInstance(IID_IAAFSourceMob,
(IUnknown **)&pSourceMob));
// Initialize mob properties:
checkResult(pSourceMob->QueryInterface (IID_IAAFMob, (void **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
checkResult(pMob->SetName(L"EssenceDescriptorTest"));
// Create the descriptor:
// instantiate a concrete subclass of EssenceDescriptor
checkResult(defs.cdAIFCDescriptor()->
CreateInstance(IID_IAAFEssenceDescriptor,
(IUnknown **)&edesc));
IAAFAIFCDescriptor* pAIFCDesc = NULL;
checkResult(edesc->QueryInterface (IID_IAAFAIFCDescriptor, (void **)&pAIFCDesc));
checkResult(pAIFCDesc->SetSummary (5, (unsigned char*)"TEST"));
pAIFCDesc->Release();
pAIFCDesc = NULL;
checkResult(pSourceMob->SetEssenceDescriptor (edesc));
/* CountLocators() ******************************************/
localhr = AAFRESULT_SUCCESS;
// Verify AAFRESULT_NULL_PARAM is returned
if (edesc->CountLocators(NULL) != AAFRESULT_NULL_PARAM)
localhr = AAFRESULT_TEST_FAILED;
// Verify that there are no locators
if (edesc->CountLocators(&numLocators) != AAFRESULT_SUCCESS)
localhr = AAFRESULT_TEST_FAILED;
if (0 != numLocators)
localhr = AAFRESULT_TEST_FAILED;
if (localhr == AAFRESULT_SUCCESS)
cout<< " CountLocators() ... Passed"<< endl;
else
{
cout<< " CountLocators() ... FAILED"<< endl;
hr = AAFRESULT_TEST_FAILED;
}
/* AppendLocator() ******************************************/
localhr = AAFRESULT_SUCCESS;
// Verify AAFRESULT_NULL_PARAM is returned
if (edesc->AppendLocator(NULL) != AAFRESULT_NULL_PARAM)
localhr = AAFRESULT_TEST_FAILED;
// Append and Count a bunch of Locators
for (i=1; i<=10; i++)
{
// Make a concrete subclass of locator, and attach it to
// the EssenceDescriptor
checkResult(defs.cdNetworkLocator()->
CreateInstance(IID_IAAFLocator,
(IUnknown **)&pLocator));
//.........这里部分代码省略.........
示例11: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar * pFileName)
{
IAAFFile * pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFSourceMob* pSourceMob = NULL;
IAAFMob* pMob = NULL;
IAAFEssenceDescriptor* pEssDesc = NULL;
IAAFBWFImportDescriptor* pBWFImportDesc = NULL;
IEnumAAFRIFFChunks* pEnum = NULL;
IAAFRIFFChunk* pRIFFChunk = NULL;
IAAFRIFFChunk* pRIFFChunkTest = NULL;
IEnumAAFMobs* pMobIter = NULL;
aafUInt32 numData, bytesRead, com, testNum;
aafLength_t testRIFFLen;
aafNumSlots_t numMobs;
char Value[sizeof(RIFFChunksmiley)];
char Value2[sizeof(RIFFChunkfrowney)];
HRESULT hr = AAFRESULT_SUCCESS;
wchar_t testString[256];
checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
checkResult( pFile->GetHeader(&pHeader));
// Get the AAF Dictionary so that we can create a fake RIFFChunk to test RemoveUnknownBWFChunks.
checkResult(pHeader->GetDictionary(&pDictionary));
CAAFBuiltinDefs defs (pDictionary);
checkResult(defs.cdRIFFChunk()->CreateInstance(IID_IAAFRIFFChunk,
(IUnknown **)&pRIFFChunkTest));
checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
if (1 == numMobs )
{
checkResult(pHeader->GetMobs(NULL, &pMobIter));
checkResult(pMobIter->NextOne(&pMob));
checkResult(pMob->QueryInterface(IID_IAAFSourceMob, (void **)&pSourceMob));
// Back into testing mode
checkResult(pSourceMob->GetEssenceDescriptor(&pEssDesc));
checkResult( pEssDesc->QueryInterface( IID_IAAFBWFImportDescriptor, (void**)&pBWFImportDesc ));
checkResult(pBWFImportDesc->GetFileSecurityReport(&testNum));
checkExpression(testNum==TEST_FileSecurityReport, AAFRESULT_TEST_FAILED);
checkResult(pBWFImportDesc->GetFileSecurityWave(&testNum));
checkExpression(testNum==TEST_FileSecurityWave, AAFRESULT_TEST_FAILED);
checkResult(pBWFImportDesc->GetCodingHistory(testString, sizeof(testString)));
checkExpression(wcscmp(testString, TEST_CodingHistory) == 0, AAFRESULT_TEST_FAILED);
checkResult(pBWFImportDesc->GetBasicData(testString, sizeof(testString)));
checkExpression(wcscmp(testString, TEST_BasicData) == 0, AAFRESULT_TEST_FAILED);
checkResult(pBWFImportDesc->GetStartOfModulation(testString, sizeof(testString)));
checkExpression(wcscmp(testString, TEST_StartOfModulation) == 0, AAFRESULT_TEST_FAILED);
checkResult(pBWFImportDesc->GetQualityEvent(testString, sizeof(testString)));
checkExpression(wcscmp(testString, TEST_QualityEvent) == 0, AAFRESULT_TEST_FAILED);
checkResult(pBWFImportDesc->GetEndOfModulation(testString, sizeof(testString)));
checkExpression(wcscmp(testString, TEST_EndOfModulation) == 0, AAFRESULT_TEST_FAILED);
checkResult(pBWFImportDesc->GetQualityParameter(testString, sizeof(testString)));
checkExpression(wcscmp(testString, TEST_QualityParameter) == 0, AAFRESULT_TEST_FAILED);
checkResult(pBWFImportDesc->GetOperatorComment(testString, sizeof(testString)));
checkExpression(wcscmp(testString, TEST_OperatorComment) == 0, AAFRESULT_TEST_FAILED);
checkResult(pBWFImportDesc->GetCueSheet(testString, sizeof(testString)));
checkExpression(wcscmp(testString, TEST_CueSheet) == 0, AAFRESULT_TEST_FAILED);
checkResult(pBWFImportDesc->CountUnknownBWFChunks(&numData));
checkExpression(2 == numData, AAFRESULT_TEST_FAILED);
checkResult(pBWFImportDesc->GetUnknownBWFChunks(&pEnum));
for(com = 0; com < numData; com++)
{
checkResult(pEnum->NextOne(&pRIFFChunk));
pRIFFChunk->GetLength(&testRIFFLen);
checkExpression(testRIFFLen!=chunkLength /*huh?*/, AAFRESULT_TEST_FAILED);
checkResult(pRIFFChunk->GetLength(&testRIFFLen));
pRIFFChunk->GetChunkID(&testNum);
if (testNum==1){
checkExpression(sizeof(RIFFChunksmiley) == testRIFFLen, AAFRESULT_TEST_FAILED);
checkResult(pRIFFChunk->Read( sizeof(Value), (unsigned char *)Value, &bytesRead));
checkExpression(memcmp(Value, RIFFChunksmiley, sizeof(RIFFChunksmiley)) == 0, AAFRESULT_TEST_FAILED);
}
else if (testNum==2){
checkExpression(sizeof(RIFFChunkfrowney) == testRIFFLen, AAFRESULT_TEST_FAILED);
checkResult(pRIFFChunk->Read( sizeof(Value2), (unsigned char *)Value2, &bytesRead));
checkExpression(memcmp(Value2, RIFFChunkfrowney, sizeof(RIFFChunkfrowney)) == 0, AAFRESULT_TEST_FAILED);
}
pRIFFChunk->Release();
pRIFFChunk = NULL;
}
checkResult(pEnum->Reset());
checkResult(pEnum->NextOne(&pRIFFChunk));
checkExpression((pBWFImportDesc->RemoveUnknownBWFChunkAt(2))==AAFRESULT_BADINDEX, AAFRESULT_TEST_FAILED);
checkResult(pBWFImportDesc->RemoveUnknownBWFChunkAt(0));
checkResult(pBWFImportDesc->CountUnknownBWFChunks(&numData));
checkExpression(1 == numData, AAFRESULT_TEST_FAILED);
pRIFFChunk->Release();
pRIFFChunk = NULL;
pEnum->Release();
pEnum = NULL;
pBWFImportDesc->Release();
//.........这里部分代码省略.........
示例12: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar* pFileName)
{
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IEnumAAFOperationDefs *pOperationGroupEnum = NULL;
IEnumAAFParameterDefs *pParmDefEnum = NULL;
IAAFOperationDef *pOperationDef = NULL;
IAAFParameterDef *pParmDef = NULL;
IAAFParameter *pParameter = NULL;
IAAFMetaDefinition* pMetaDefinition = NULL;
IAAFSegment* pSeg = NULL;
IAAFOperationGroup* pOperationGroup = NULL;
IEnumAAFMobs *mobIter = NULL;
IAAFMob* pMob = NULL;
IEnumAAFMobSlots *slotIter = NULL;
IAAFMobSlot* pSlot = NULL;
IAAFFiller* pFill = NULL;
IAAFSourceReference *pSourceRef = NULL;
IEnumAAFControlPoints *pEnumCP = NULL;
IAAFControlPoint *pControlPoint = NULL;
IAAFVaryingValue *pVaryingValue = NULL;
IAAFInterpolationDef *pInterpDef = NULL;
IAAFTypeDef *pTypeDef = NULL;
bool bFileOpen = false;
aafBool readIsTimeWarp;
aafUInt32 testNumSources, testNumParam;
HRESULT hr = S_OK;
aafNumSlots_t s;
aafNumSlots_t numSlots;
aafUInt32 readOverride;
aafBool readValidTransition;
aafRational_t testTime;
aafRational_t sampleValue1 = kTestLevel1, sampleValue2 = kTestLevel2, testValue;
aafRational_t checkTime1 = kTestTime1;
aafRational_t checkTime2 = kTestTime2;
aafEditHint_t checkEditHint;
aafUID_t testInterpDef, checkInterpDef = kAAFTypeID_Rational;
try
{
// Open the AAF file
checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
bFileOpen = true;
// Get the AAF file header.
checkResult(pFile->GetHeader(&pHeader));
aafSearchCrit_t criteria;
criteria.searchTag = kAAFNoSearch;
checkResult(pHeader->GetMobs (&criteria, &mobIter));
checkResult(mobIter->NextOne (&pMob));
checkResult(pMob->GetSlots(&slotIter));
checkResult(pMob->CountSlots (&numSlots));
for(s = 0; s < numSlots; s++)
{
checkResult(slotIter->NextOne (&pSlot));
checkResult(pSlot->GetSegment (&pSeg));
checkResult(pSeg->QueryInterface (IID_IAAFOperationGroup, (void **)&pOperationGroup));
pSeg->Release();
pSeg = NULL;
checkResult(pOperationGroup->CountSourceSegments(&testNumSources));
checkExpression(testNumSources == TEST_NUM_INPUTS, AAFRESULT_TEST_FAILED);
checkResult(pOperationGroup->CountParameters(&testNumParam));
checkExpression(testNumSources == 1, AAFRESULT_TEST_FAILED);
checkResult(pOperationGroup->IsATimeWarp (&readIsTimeWarp));
checkExpression(readIsTimeWarp == kAAFFalse, AAFRESULT_TEST_FAILED);
checkResult(pOperationGroup->GetBypassOverride (&readOverride));
checkExpression(readOverride == 1, AAFRESULT_TEST_FAILED);
checkResult(pOperationGroup->IsValidTranOperation (&readValidTransition));
checkExpression(readValidTransition == kAAFFalse, AAFRESULT_TEST_FAILED);
/**/
checkResult(pOperationGroup->GetInputSegmentAt (0, &pSeg));
checkResult(pSeg->QueryInterface(IID_IAAFFiller, (void **) &pFill));
pFill->Release();
pFill = NULL;
/**/
checkResult(pOperationGroup->LookupParameter (kTestParmID, &pParameter));
checkResult(pParameter->QueryInterface(IID_IAAFVaryingValue, (void **) &pVaryingValue));
/*** Check the VaryingValue methods **/
aafUInt32 testLen, bytesRead;
checkResult(pVaryingValue->GetControlPoints(&pEnumCP));
checkResult(pEnumCP->NextOne(&pControlPoint));
checkResult(pControlPoint->GetValueBufLen (&testLen));
checkExpression(testLen == sizeof(sampleValue1), AAFRESULT_TEST_FAILED);
checkResult(pControlPoint->GetValue (sizeof(sampleValue1), (aafDataBuffer_t)&testValue, &bytesRead));
checkExpression(testValue.numerator == sampleValue1.numerator, AAFRESULT_TEST_FAILED);
checkExpression(testValue.denominator == sampleValue1.denominator, AAFRESULT_TEST_FAILED);
checkExpression(bytesRead == sizeof(sampleValue1), AAFRESULT_TEST_FAILED);
checkResult(pControlPoint->GetTime(&testTime));
checkExpression(testTime.numerator == checkTime1.numerator, AAFRESULT_TEST_FAILED);
checkExpression(testTime.denominator == checkTime1.denominator, AAFRESULT_TEST_FAILED);
//.........这里部分代码省略.........
示例13: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile* pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFOperationDef* pOperationDef = NULL;
IAAFParameterDef* pParamDef = NULL;
IAAFDefObject* pDefObject = NULL;
IAAFOperationGroup *pOperationGroup = NULL;
IAAFMob *pMob = NULL;
IAAFSegment *pSeg = NULL;
IAAFTimelineMobSlot *pSlot = NULL;
IAAFParameter *pParm = NULL;
IAAFVaryingValue *pVaryingValue = NULL;
IAAFSegment *pFiller = NULL;
IAAFComponent *pComponent = NULL;
IAAFSourceClip *pSourceClip = NULL;
IAAFControlPoint *pControlPoint = NULL;
IAAFSourceReference *pSourceRef = NULL;
IAAFInterpolationDef *pInterpDef = NULL;
IAAFPluginManager *pMgr = NULL;
IAAFTypeDef *pTypeDef = NULL;
bool bFileOpen = false;
HRESULT hr = S_OK;
// aafUID_t testInterpDef = kAAFTypeID_Rational;
aafLength_t effectLen = TEST_EFFECT_LEN;
aafUID_t effectID = kTestEffectID;
aafUID_t parmID = kTestParmID;
aafRational_t testLevel1 = kTestLevel1;
aafRational_t testLevel2 = kTestLevel2;
aafRational_t testTime1 = kTestTime1;
aafRational_t testTime2 = kTestTime2;
/* long test;
*/
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the AAF file
checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
bFileOpen = true;
// Get the AAF file header.
checkResult(pFile->GetHeader(&pHeader));
// Get the AAF Dictionary so that we can create valid AAF objects.
checkResult(pHeader->GetDictionary(&pDictionary));
CAAFBuiltinDefs defs (pDictionary);
checkResult(defs.cdOperationDef()->
CreateInstance(IID_IAAFOperationDef,
(IUnknown **)&pOperationDef));
checkResult(defs.cdParameterDef()->
CreateInstance(IID_IAAFParameterDef,
(IUnknown **)&pParamDef));
checkResult(pDictionary->LookupTypeDef (kAAFTypeID_Rational, &pTypeDef));
checkResult(pParamDef->Initialize (parmID, TEST_PARAM_NAME, TEST_PARAM_DESC, pTypeDef));
checkResult(AAFGetPluginManager(&pMgr));
checkResult(pMgr->CreatePluginDefinition(LinearInterpolator, pDictionary, &pDefObject));
checkResult(pDefObject->QueryInterface(IID_IAAFInterpolationDef, (void **) &pInterpDef));
pDefObject->Release();
pDefObject = NULL;
checkResult(pOperationDef->Initialize (effectID, TEST_EFFECT_NAME, TEST_EFFECT_DESC));
checkResult(pDictionary->RegisterOperationDef (pOperationDef));
checkResult(pDictionary->RegisterParameterDef (pParamDef));
checkResult(pDictionary->RegisterInterpolationDef (pInterpDef));
checkResult(pOperationDef->SetDataDef (defs.ddkAAFPicture()));
checkResult(pOperationDef->SetIsTimeWarp (kAAFFalse));
checkResult(pOperationDef->SetNumberInputs (TEST_NUM_INPUTS));
checkResult(pOperationDef->SetCategory (TEST_CATEGORY));
checkResult(pOperationDef->AddParameterDef (pParamDef));
checkResult(pOperationDef->SetBypass (TEST_BYPASS));
checkResult(pParamDef->SetDisplayUnits(TEST_PARAM_UNITS));
//Make the first mob
long test;
aafRational_t videoRate = { 2997, 100 };
// Create a Mob
checkResult(defs.cdCompositionMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult(pMob->SetName(L"AAFOperationGroupTest"));
// Add some slots
//.........这里部分代码省略.........
示例14: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFSequence *pSequence = NULL;
HRESULT hr = S_OK;
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the file.
checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
bFileOpen = true;
// We can't really do anthing in AAF without the header.
checkResult(pFile->GetHeader(&pHeader));
// Get the number of mobs to force creation of the content storage.
// This is temporary as the content storage should be created by
// the call to OpenNewModify above.
aafNumSlots_t n;
checkResult(pHeader->CountMobs(kAAFAllMob, &n));
// Get the AAF Dictionary so that we can create valid AAF objects.
checkResult(pHeader->GetDictionary(&pDictionary));
// Create a sequence withou attaching it to the file.
checkResult(CreateAAFSequence(pDictionary, &pSequence));
// Test the enumeration methods.
checkResult(TestEnumerator(pSequence));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pSequence)
pSequence->Release();
if (pDictionary)
pDictionary->Release();
if (pHeader)
pHeader->Release();
if (pFile)
{ // Close file
if (bFileOpen)
{
pFile->Save();
pFile->Close();
}
pFile->Release();
}
return hr;
}
示例15: TestPropertyValue
static HRESULT TestPropertyValue (
testMode_t mode,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
// HRESULT hr = E_FAIL;
long hr = E_FAIL;
const size_t fileNameBufLen = 128;
aafWChar testFileName[ fileNameBufLen ] = L"";
GenerateTestFileName( productID.productName, fileKind, fileNameBufLen, testFileName );
IAAFFile* pFile = NULL;
if(mode == kAAFUnitTestReadWrite)
{
RemoveTestFile (testFileName);
checkResult (CreateTestFile( testFileName, fileKind, rawStorageType, productID, &pFile ));
assert (pFile);
}
else
{
checkResult (AAFFileOpenExistingRead(testFileName, 0, &pFile));
assert (pFile);
}
IAAFHeader * pHeader = NULL;
hr = pFile->GetHeader (&pHeader);
if (! SUCCEEDED (hr)) return hr;
assert (pHeader);
IAAFDictionary * pDict = NULL;
hr = pHeader->GetDictionary (&pDict);
if (! SUCCEEDED (hr)) return hr;
assert (pDict);
CAAFBuiltinDefs defs (pDict);
// Let's try to do something interesting with a type definition
IAAFTypeDefInt * pTypeDef = NULL;
hr = defs.tdInt32()->QueryInterface (IID_IAAFTypeDefInt, (void **) &pTypeDef);
if (! SUCCEEDED (hr)) return hr;
assert (pTypeDef);
if(mode == kAAFUnitTestReadWrite)
{
// Now attempt to create invalid property values; check for errors.
const aafInt32 forty_two = 42;
IAAFPropertyValue * pv = NULL;
// This is what a correct one would look like; we're not ready for that yet:
// hr = pTypeDef->CreateValue (&forty_two, 4, &pv);
// set this to -1 to see if it gets modified
pv = (IAAFPropertyValue *) (-1);
// Try null pVal
hr = pTypeDef->CreateValue (NULL, 4, &pv);
if (AAFRESULT_NULL_PARAM != hr)
return AAFRESULT_TEST_FAILED;
if ((IAAFPropertyValue *)(-1) != pv)
return AAFRESULT_TEST_FAILED;
// Try valSize too large
hr = pTypeDef->CreateValue ((aafMemPtr_t) &forty_two, 8, &pv);
if (AAFRESULT_BAD_SIZE != hr)
return AAFRESULT_TEST_FAILED;
if ((IAAFPropertyValue *)(-1) != pv)
return AAFRESULT_TEST_FAILED;
// Now try correct one
pv = NULL;
hr = pTypeDef->CreateValue ((aafMemPtr_t) &forty_two, 4, &pv);
if (! SUCCEEDED (hr)) return hr;
if (! pv)
return AAFRESULT_TEST_FAILED;
// That one worked; let's try one with a smaller init size (should
// also work)
pv->Release();
pv = NULL;
const aafInt16 fifty_seven = 57;
hr = pTypeDef->CreateValue ((aafMemPtr_t) &fifty_seven, 2, &pv);
if (! SUCCEEDED (hr)) return hr;
if (! pv)
return AAFRESULT_TEST_FAILED;
// cool. Now we should have a good property value whose value is 57.
// check GetType() for error condition
hr = pv->GetType (NULL);
if (AAFRESULT_NULL_PARAM != hr)
return AAFRESULT_TEST_FAILED;
// this GetType() call should work, and return the original type def.
IAAFTypeDef * propType = NULL;
hr = pv->GetType (&propType);
if (! SUCCEEDED (hr)) return hr;
if (! propType)
return AAFRESULT_TEST_FAILED;
// Convert both to IUnknown for comparison
//.........这里部分代码省略.........