本文整理汇总了C++中CAAFBuiltinDefs类的典型用法代码示例。如果您正苦于以下问题:C++ CAAFBuiltinDefs类的具体用法?C++ CAAFBuiltinDefs怎么用?C++ CAAFBuiltinDefs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CAAFBuiltinDefs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defs
IAAFInterpolationDef *AAFDomainUtils::CreateInterpolationDefinition(IAAFDictionary *dict, aafUID_t interpolationDefID)
{
IAAFInterpolationDef *interpDef;
AAFRESULT rc;
CAAFBuiltinDefs defs (dict);
rc = dict->LookupInterpolationDef(interpolationDefID,&interpDef);
if(rc == AAFRESULT_SUCCESS && interpDef != NULL)
return interpDef;
// dprintf("AEffect::CreateInterpolationDefinition()\n"); //JeffB:
(void)(defs.cdInterpolationDefinition()->
CreateInstance(IID_IAAFInterpolationDef,
(IUnknown **)&interpDef));
if(memcmp(&interpolationDefID, &LinearInterpolator, sizeof(aafUID_t)) == 0)
{
(void)(interpDef->Initialize(interpolationDefID, L"LinearInterp", L"Linear keyframe interpolation"));
dict->RegisterInterpolationDef(interpDef);
}
else
{
interpDef->Release();
interpDef = NULL;
}
//cleanup:
return(interpDef);
}
示例2: CreateAAFSequence
static HRESULT CreateAAFSequence(IAAFDictionary *pDictionary,
IAAFSequence** ppSequence)
{
IAAFSequence* pSequence = NULL;
HRESULT hr = S_OK;
aafUInt32 i;
CAAFBuiltinDefs defs (pDictionary);
hr = defs.cdSequence()->
CreateInstance(IID_IAAFSequence,
(IUnknown **)&pSequence);
if (SUCCEEDED(hr))
{
pSequence->Initialize(defs.ddkAAFSound());
//
// Add some segments. Need to test failure conditions
// (i.e. starting/ending w/ transition, two trans back
// to bacl).
//
for(i = 0; i < kNumComponents; i++)
{
IAAFComponent* pComponent = NULL;
aafLength_t len = 10;
hr = defs.cdFiller()->
CreateInstance(IID_IAAFComponent,
(IUnknown **)&pComponent);
if (FAILED(hr))
break;
pComponent->SetDataDef(defs.ddkAAFSound());
pComponent->SetLength(len);
hr = pSequence->AppendComponent(pComponent);
pComponent->Release();
pComponent = NULL;
if (FAILED(hr))
break;
}
}
if (SUCCEEDED(hr))
{
*ppSequence = pSequence;
}
else
{
pSequence->Release();
*ppSequence = NULL;
}
return hr;
}
示例3: assert
void EssenceDataTest::createFileMob(unsigned int mobid_Index)
{
assert(_pFile && _pHeader && _pDictionary);
assert(NULL == _pSourceMob);
assert(NULL == _pMob);
assert(NULL == _pFileDescriptor);
assert(NULL == _pEssenceDescriptor);
assert(NULL == _pSourceMob);
CAAFBuiltinDefs defs (_pDictionary);
// Create a Mob
check(defs.cdSourceMob()->CreateInstance(IID_IAAFSourceMob,
(IUnknown **)&_pSourceMob));
check(_pSourceMob->QueryInterface (IID_IAAFMob, (void **)&_pMob));
check(_pMob->SetMobID(TEST_MobIDs[mobid_Index]));
check(_pMob->SetName(L"EssenceDataTest File Mob"));
// instantiate a concrete subclass of FileDescriptor
check(defs.cdAIFCDescriptor()->
CreateInstance(IID_IAAFFileDescriptor,
(IUnknown **)&_pFileDescriptor));
IAAFAIFCDescriptor* pAIFCDesc = NULL;
check(_pFileDescriptor->QueryInterface (IID_IAAFAIFCDescriptor, (void **)&pAIFCDesc));
check(pAIFCDesc->SetSummary (5, (unsigned char*)"TEST"));
pAIFCDesc->Release();
pAIFCDesc = NULL;
check(_pFileDescriptor->QueryInterface (IID_IAAFEssenceDescriptor,
(void **)&_pEssenceDescriptor));
check(_pSourceMob->SetEssenceDescriptor (_pEssenceDescriptor));
check(_pHeader->AddMob(_pMob));
createEssenceData(_pSourceMob);
// Cleanup instance data for reuse...
_pEssenceDescriptor->Release();
_pEssenceDescriptor = NULL;
_pFileDescriptor->Release();
_pFileDescriptor = NULL;
_pMob->Release();
_pMob = NULL;
_pSourceMob->Release();
_pSourceMob = NULL;
}
示例4: Test_CreateEssenceData
// Create a SourceMob with the specified ID and name,
// then create an EssenceData object associating it
// with the new SourceMob.
static void Test_CreateEssenceData(
CAAFBuiltinDefs& defs,
IAAFHeader* pHeader,
const aafMobID_t& mobID,
aafCharacter_constptr mobName,
IAAFEssenceData** pResult)
{
IAAFSourceMobSP pSourceMob;
IAAFMobSP pMob;
IAAFEssenceDescriptorSP pEssenceDesciptor;
IAAFEssenceDataSP pEssenceData;
// Create a Mob
CheckResult(defs.cdSourceMob()->CreateInstance(IID_IAAFSourceMob,
(IUnknown **)&pSourceMob));
CheckResult(pSourceMob->QueryInterface(IID_IAAFMob, (void **)&pMob));
CheckResult(pMob->SetMobID(mobID));
CheckResult(pMob->SetName(mobName));
// Create a concrete subclass of EssenceDescriptor
CheckResult(defs.cdAIFCDescriptor()->CreateInstance(IID_IAAFEssenceDescriptor,
(IUnknown **)&pEssenceDesciptor));
IAAFAIFCDescriptor* pAIFCDesc = NULL;
CheckResult(pEssenceDesciptor->QueryInterface (IID_IAAFAIFCDescriptor, (void **)&pAIFCDesc));
CheckResult(pAIFCDesc->SetSummary (5, (unsigned char*)"TEST"));
pAIFCDesc->Release();
pAIFCDesc = NULL;
CheckResult(pSourceMob->SetEssenceDescriptor (pEssenceDesciptor));
CheckResult(pHeader->AddMob(pMob));
// Attempt to create an AAFEssenceData.
CheckResult(defs.cdEssenceData()->CreateInstance(IID_IAAFEssenceData,
(IUnknown **)&pEssenceData));
CheckResult(pEssenceData->SetFileMob(pSourceMob));
CheckResult(pHeader->AddEssenceData(pEssenceData));
*pResult = pEssenceData;
(*pResult)->AddRef();
}
示例5: assert
void EnumEssenceDataTest::createEssenceData(IAAFSourceMob *pSourceMob)
{
assert(_pFile && _pHeader && _pDictionary);
assert(pSourceMob);
assert(NULL == _pEssenceData);
CAAFBuiltinDefs defs (_pDictionary);
// Attempt to create an AAFEssenceData.
check(defs.cdEssenceData()->
CreateInstance(IID_IAAFEssenceData,
(IUnknown **)&_pEssenceData));
check(_pEssenceData->SetFileMob(pSourceMob));
check(_pHeader->AddEssenceData(_pEssenceData));
_pEssenceData->Release();
_pEssenceData = NULL;
}
示例6: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
HRESULT hr = AAFRESULT_SUCCESS;
IAAFFile* pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFDictionary * pDict = NULL;
IAAFCompositionMob * pCMob = NULL;
IAAFMob * pMob = NULL;
IAAFObject * pObj = NULL;
try
{
//Do the usual ...
RemoveTestFile (pFileName);
checkResult (CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
assert (pFile);
checkResult (pFile->GetHeader (&pHeader));
assert (pHeader);
checkResult (pHeader->GetDictionary (&pDict));
assert (pDict);
CAAFBuiltinDefs defs (pDict);
//Create a composition ...
checkResult (defs.cdCompositionMob()->
CreateInstance (IID_IAAFCompositionMob,
(IUnknown **) &pCMob));
assert (pCMob);
checkResult (pCMob->Initialize (TEST_NAME));
//... Get its mob, and add it to the header info
checkResult (pCMob->QueryInterface (IID_IAAFMob,
(void **) &pMob));
assert (pMob);
checkResult (pHeader->AddMob (pMob));
}
catch (HRESULT & rResult)
{
hr = rResult;
}
if (pCMob) pCMob->Release();
if (pMob) pCMob->Release();
if (pObj) pObj->Release();
if (pDict) pDict->Release();
if (pHeader) pHeader->Release();
if (pFile)
{
AAFRESULT temphr = pFile->Save();
if (! SUCCEEDED (temphr)) return temphr;
temphr = pFile->Close();
if (! SUCCEEDED (temphr)) return temphr;
pFile->Release();
}
return hr;
}
示例7: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile* pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFParameterDef* pParamDef = NULL;
bool bFileOpen = false;
HRESULT hr = S_OK;
aafUID_t testParmID = kParmID;
aafInt32 index;
IAAFOperationDef *pOperationDef = NULL, *defResults[3] = { NULL, NULL, NULL };
/* 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.cdParameterDef()->
CreateInstance(IID_IAAFParameterDef,
(IUnknown **)&pParamDef));
checkResult(pParamDef->Initialize (testParmID, TEST_PARAM_NAME, TEST_PARAM_DESC, defs.tdRational()));
checkResult(pDictionary->RegisterParameterDef(pParamDef));
for(index = 0; index < 3; index++)
{
checkResult(defs.cdOperationDef()->
CreateInstance(IID_IAAFOperationDef,
(IUnknown **)&pOperationDef));
checkResult(pOperationDef->Initialize (effectID[index], effectNames[index], effectDesc[index]));
checkResult(pDictionary->RegisterOperationDef(pOperationDef));
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));
defResults[index] = pOperationDef;
pOperationDef = NULL;
}
checkResult(defResults[1]->AppendDegradeToOperation (defResults[1]));
checkResult(defResults[2]->AppendDegradeToOperation (defResults[2]));
checkResult(defResults[0]->AppendDegradeToOperation (defResults[1]));
checkResult(defResults[0]->PrependDegradeToOperation (defResults[2]));
// Add an extra one to delete for the test
//!!! checkResult(defResults[0]->CountDegradeToOperations(&numDegrade));
// checkExpression(2 == numDegrade, AAFRESULT_TEST_FAILED);
// checkResult(defResults[0]->AppendDegradeToOperation (defResults[1]));
// checkResult(defResults[0]->CountDegradeToOperations(&numDegrade));
// checkExpression(3 == numDegrade, AAFRESULT_TEST_FAILED);
// checkResult(defResults[0]->RemoveDegradeToOperationAt (2));
// checkResult(defResults[0]->CountDegradeToOperations(&numDegrade));
// checkExpression(2 == numDegrade, AAFRESULT_TEST_FAILED);
for(index = 0; index < 3; index++)
{
defResults[index]->Release();
defResults[index] = NULL;
}
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pOperationDef)
pOperationDef->Release();
if (pParamDef)
pParamDef->Release();
if (pDictionary)
pDictionary->Release();
if (pHeader)
pHeader->Release();
//.........这里部分代码省略.........
示例8: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar* pFileName)
{
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IEnumAAFOperationDefs *pEffectEnum = NULL;
IEnumAAFOperationDefs *pDegradeEnum = NULL;
IEnumAAFParameterDefs *pParmDefEnum = NULL;
IAAFOperationDef *pOperationDef = NULL;
IAAFParameterDef *pParmDef = NULL;
IAAFDefObject* pDefObject = NULL;
bool bFileOpen = false;
IAAFDataDefSP pReadDataDef;
aafBool readIsTimeWarp;
aafInt32 checkNumInputs;
aafUInt32 checkBypass;
HRESULT hr = S_OK;
wchar_t checkName[256];
aafUID_t checkCat;
aafBool bResult = kAAFFalse;
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));
CAAFBuiltinDefs defs (pDictionary);
checkResult(pDictionary->GetOperationDefs(&pEffectEnum));
checkResult(pEffectEnum->NextOne (&pOperationDef));
checkResult(pOperationDef->GetDataDef(&pReadDataDef));
checkResult(pOperationDef->QueryInterface(IID_IAAFDefObject, (void **) &pDefObject));
checkResult(pDefObject->GetName (checkName, sizeof(checkName)));
checkExpression(wcscmp(checkName, effectNames[0]) == 0, AAFRESULT_TEST_FAILED);
checkResult(pDefObject->GetDescription (checkName, sizeof(checkName)));
checkExpression(wcscmp(checkName, effectDesc[0]) == 0, AAFRESULT_TEST_FAILED);
pDefObject->Release();
pDefObject = NULL;
checkResult(pReadDataDef->IsDataDefOf(defs.ddkAAFPicture(), &bResult));
checkExpression(bResult == kAAFTrue, AAFRESULT_TEST_FAILED);
checkResult(pOperationDef->IsTimeWarp (&readIsTimeWarp));
checkExpression(readIsTimeWarp == kAAFFalse, AAFRESULT_TEST_FAILED);
checkResult(pOperationDef->GetCategory (&checkCat));
checkExpression(memcmp(&checkCat, &TEST_CATEGORY, sizeof(aafUID_t)) == 0, AAFRESULT_TEST_FAILED);
checkResult(pOperationDef->GetBypass (&checkBypass));
checkExpression(checkBypass == TEST_BYPASS, AAFRESULT_TEST_FAILED);
checkResult(pOperationDef->GetNumberInputs (&checkNumInputs));
checkExpression(checkNumInputs == TEST_NUM_INPUTS, AAFRESULT_TEST_FAILED);
checkResult(pOperationDef->GetParameterDefs (&pParmDefEnum));
checkResult(pParmDefEnum->NextOne (&pParmDef));
checkResult(pParmDef->QueryInterface(IID_IAAFDefObject, (void **) &pDefObject));
checkResult(pDefObject->GetName (checkName, sizeof(checkName)));
checkExpression(wcscmp(checkName, TEST_PARAM_NAME) == 0, AAFRESULT_TEST_FAILED);
checkResult(pDefObject->GetDescription (checkName, sizeof(checkName)));
checkExpression(wcscmp(checkName, TEST_PARAM_DESC) == 0, AAFRESULT_TEST_FAILED);
pDefObject->Release();
pDefObject = NULL;
checkResult(pOperationDef->GetDegradeToOperations (&pDegradeEnum));
pOperationDef->Release();
pOperationDef = NULL;
// Check for prepended one first
checkResult(pDegradeEnum->NextOne (&pOperationDef));
checkResult(pOperationDef->QueryInterface(IID_IAAFDefObject, (void **) &pDefObject));
checkResult(pDefObject->GetName (checkName, sizeof(checkName)));
checkExpression(wcscmp(checkName, effectNames[2]) == 0, AAFRESULT_TEST_FAILED);
checkResult(pDefObject->GetDescription (checkName, sizeof(checkName)));
checkExpression(wcscmp(checkName, effectDesc[2]) == 0, AAFRESULT_TEST_FAILED);
pDefObject->Release();
pDefObject = NULL;
pOperationDef->Release();
pOperationDef = NULL;
// Check for appended one second
checkResult(pDegradeEnum->NextOne (&pOperationDef));
checkResult(pOperationDef->QueryInterface(IID_IAAFDefObject, (void **) &pDefObject));
checkResult(pDefObject->GetName (checkName, sizeof(checkName)));
checkExpression(wcscmp(checkName, effectNames[1]) == 0, AAFRESULT_TEST_FAILED);
checkResult(pDefObject->GetDescription (checkName, sizeof(checkName)));
checkExpression(wcscmp(checkName, effectDesc[1]) == 0, AAFRESULT_TEST_FAILED);
pDefObject->Release();
pDefObject = NULL;
pOperationDef->Release();
pOperationDef = NULL;
}
catch (HRESULT& rResult)
{
hr = rResult;
}
//.........这里部分代码省略.........
示例9: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile* pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFDefObject* pDef = NULL;
IAAFContainerDef* pContainerDef = NULL;
bool bFileOpen = false;
HRESULT hr = S_OK;
/* 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.cdContainerDef()->
CreateInstance(IID_IAAFContainerDef,
(IUnknown **)&pContainerDef));
checkResult(pContainerDef->QueryInterface (IID_IAAFDefObject,
(void **)&pDef));
checkResult(pContainerDef->Initialize (testUID, sName, sDescription));
checkResult(pDictionary->RegisterContainerDef(pContainerDef));
//
// test Append, Prepend, and enum plugin descriptor using same type def
//
IAAFPluginDescriptorSP pd1;
checkResult (defs.cdPluginDef()->
CreateInstance (IID_IAAFPluginDef,
(IUnknown **)&pd1));
checkResult (pd1->Initialize (kTestPluginDescID1,
L"PluginDesc1",
L"Plugin Descriptor 1 description"));
checkResult(pd1->SetDefinitionObjectID(kTestPluginDescID1));
checkResult (pDictionary->RegisterPluginDef (pd1));
IAAFPluginDescriptorSP pd2;
checkResult (defs.cdPluginDef()->
CreateInstance (IID_IAAFPluginDef,
(IUnknown **)&pd2));
checkResult (pd2->Initialize (kTestPluginDescID2,
L"PluginDesc2",
L"Plugin Descriptor 2 description"));
checkResult(pd2->SetDefinitionObjectID(kTestPluginDescID2));
checkResult (pDictionary->RegisterPluginDef (pd2));
IAAFPluginDescriptorSP pd3;
checkResult (defs.cdPluginDef()->
CreateInstance (IID_IAAFPluginDef,
(IUnknown **)&pd3));
checkResult (pd3->Initialize (kTestPluginDescID3,
L"PluginDesc3",
L"Plugin Descriptor 3 description"));
checkResult(pd3->SetDefinitionObjectID(kTestPluginDescID3));
checkResult (pDictionary->RegisterPluginDef (pd3));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pDef)
pDef->Release();
if (pContainerDef)
pContainerDef->Release();
if (pDictionary)
pDictionary->Release();
if (pHeader)
pHeader->Release();
if (pFile)
{ // Close file
if (bFileOpen)
{
//.........这里部分代码省略.........
示例10: 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;
IAAFLocator * pLocator = NULL;
IAAFNetworkLocator * pNetLocator = NULL;
IAAFSourceMob *pSourceMob = NULL;
IAAFMob *pMob = NULL;
IAAFEssenceDescriptor *edesc = NULL;
aafUInt32 numLocators;
HRESULT hr = AAFRESULT_SUCCESS;
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));
checkResult(pSourceMob->QueryInterface (IID_IAAFMob, (void **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
checkResult(pMob->SetName(L"SourceMOBTest"));
// Create 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;
// Verify that there are no locators
checkResult(edesc->CountLocators(&numLocators));
checkExpression(0 == numLocators, AAFRESULT_TEST_FAILED);
// Make a locator, and attach it to the EssenceDescriptor
checkResult(defs.cdNetworkLocator()->
CreateInstance(IID_IAAFNetworkLocator,
(IUnknown **)&pNetLocator));
checkResult(pNetLocator->QueryInterface (IID_IAAFLocator, (void **)&pLocator));
checkResult(pLocator->SetPath (TEST_PATH));
checkResult(edesc->AppendLocator(pLocator));
checkResult(pSourceMob->SetEssenceDescriptor (edesc));
// Verify that there is now one locator
checkResult(edesc->CountLocators(&numLocators));
checkExpression(1 == numLocators, AAFRESULT_TEST_FAILED);
// Add the source mob into the tree
checkResult(pHeader->AddMob(pMob));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// cleanup
if (pLocator)
pLocator->Release();
if (pNetLocator)
pNetLocator->Release();
if (edesc)
edesc->Release();
if (pMob)
pMob->Release();
//.........这里部分代码省略.........
示例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: 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));
//.........这里部分代码省略.........
示例13: 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
//.........这里部分代码省略.........
示例14: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType)
{
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
IAAFDictionary *pDictionary = NULL;
IAAFIdentification *pIdent = NULL;
IAAFIdentification *pTestIdent = NULL;
aafUInt32 readNumIdents;
char testName[35];
aafCharacter *myBuffer;
aafUInt32 bufSize = 0;
aafUInt32 bufSize2 = 0;
aafProductIdentification_t ProductInfo;
memset(&ProductInfo, 0, sizeof(ProductInfo));
ProductInfo.companyName = const_cast<aafWChar*>(COMPANY_NAME);
ProductInfo.productName = const_cast<aafWChar*>(PRODUCT_NAME);
ProductInfo.productVersionString = const_cast<aafWChar*>(TEST_VERSION);
ProductInfo.productID = UnitTestProductID;
ProductInfo.productVersion = &testVersion;
hr = S_OK;
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the file.
checkResult(CreateTestFile(pFileName, fileKind,
rawStorageType, ProductInfo, &pFile));
bFileOpen = true;
// We can't really do anthing in AAF without the header.
checkResult(pFile->GetHeader(&pHeader));
checkResult(pHeader->GetDictionary(&pDictionary));
CAAFBuiltinDefs defs (pDictionary);
checkResult(pHeader->CountIdentifications(&readNumIdents));
checkExpression(1 == readNumIdents, AAFRESULT_TEST_FAILED);
checkResult(pHeader->GetLastIdentification (&pIdent));
checkResult(defs.cdIdentification()->
CreateInstance(IID_IAAFIdentification,
(IUnknown **)&pTestIdent));
/* Initialize */
localhr = AAFRESULT_SUCCESS;
strcpy(testName, "Initialize()");
TestMethod(pTestIdent->Initialize(NULL,
PRODUCT_NAME,
TEST_VERSION,
UnitTestProductID), AAFRESULT_NULL_PARAM);
TestMethod(pTestIdent->Initialize(COMPANY_NAME,
NULL,
TEST_VERSION,
UnitTestProductID), AAFRESULT_NULL_PARAM);
TestMethod(pTestIdent->Initialize(COMPANY_NAME,
PRODUCT_NAME,
NULL,
UnitTestProductID), AAFRESULT_NULL_PARAM);
TestMethod(pTestIdent->Initialize(COMPANY_NAME,
PRODUCT_NAME,
TEST_VERSION,
UnitTestProductID), AAFRESULT_SUCCESS);
TestMethod(pTestIdent->Initialize(COMPANY_NAME,
PRODUCT_NAME,
TEST_VERSION,
UnitTestProductID), AAFRESULT_ALREADY_INITIALIZED);
pTestIdent->Release();
PrintTestResult(testName);
/* GetCompanyNameBufLen *****/
localhr = AAFRESULT_SUCCESS;
strcpy(testName, "GetCompanyNameBufLen()");
bufSize = sizeof(COMPANY_NAME);
bufSize2 = 0;
TestMethod(pIdent->GetCompanyNameBufLen(NULL), AAFRESULT_NULL_PARAM);
TestMethod(pIdent->GetCompanyNameBufLen(&bufSize2), AAFRESULT_SUCCESS);
if (bufSize != bufSize2)
localhr = AAFRESULT_TEST_FAILED;
PrintTestResult(testName);
/* GetCompanyName *****/
localhr = AAFRESULT_SUCCESS;
strcpy(testName, "GetCompanyName()");
myBuffer = new aafCharacter [bufSize];
TestMethod(pIdent->GetCompanyName(NULL, bufSize), AAFRESULT_NULL_PARAM);
TestMethod(pIdent->GetCompanyName(myBuffer, bufSize-1), AAFRESULT_SMALLBUF);
TestMethod(pIdent->GetCompanyName(myBuffer, bufSize), AAFRESULT_SUCCESS);
if (wcscmp(myBuffer, COMPANY_NAME))
localhr = AAFRESULT_TEST_FAILED;
delete [] myBuffer;
//.........这里部分代码省略.........
示例15: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile* pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFContainerDef* pContainerDef = NULL;
bool bFileOpen = false;
aafUID_t uid = testUID;
HRESULT hr = S_OK;
/* 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.cdContainerDef()->
CreateInstance(IID_IAAFContainerDef,
(IUnknown **)&pContainerDef));
checkResult(pContainerDef->Initialize(uid, L"Test Container", L"Test Container Definition"));
checkResult(pContainerDef->SetEssenceIsIdentified (kAAFTrue));
checkResult(pDictionary->RegisterContainerDef(pContainerDef));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pContainerDef)
pContainerDef->Release();
if (pDictionary)
pDictionary->Release();
if (pHeader)
pHeader->Release();
if (pFile)
{ // Close file
if (bFileOpen)
{
pFile->Save();
pFile->Close();
}
pFile->Release();
}
return hr;
}