本文整理汇总了C++中IAAFDictionary类的典型用法代码示例。如果您正苦于以下问题:C++ IAAFDictionary类的具体用法?C++ IAAFDictionary怎么用?C++ IAAFDictionary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IAAFDictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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()
示例2: 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;
IAAFCompositionMob* pCompMob=NULL;
IAAFMob* pMob = NULL;
IAAFTimelineMobSlot* pNewSlot = NULL;
IAAFSourceClip* pSourceClip = NULL;
IAAFSourceReference* pSourceRef = NULL;
IAAFTransition* pTransition = NULL;
IAAFOperationGroup* pOperationGroup = NULL;
IAAFSegment* pSegment = NULL;
IAAFSegment* pEffectFiller = NULL;
IAAFComponent* pComponent = NULL;
IAAFFiller* pFiller = NULL;
IAAFSequence* pSequence = NULL;
IAAFOperationDef* pOperationDef = NULL;
IAAFParameter *pParm = NULL;
IAAFParameterDef* pParamDef = NULL;
IAAFConstantValue* pConstantValue = NULL;
HRESULT hr = S_OK;
aafLength_t transitionLength;
aafPosition_t cutPoint = 0;
aafLength_t effectLen = TEST_EFFECT_LEN;
aafUID_t effectID = kTestEffectID;
aafUID_t parmID = kTestParmID;
transitionLength = 100;
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);
// Create the effect and parameter definitions
checkResult(defs.cdOperationDef()->
CreateInstance(IID_IAAFOperationDef,
(IUnknown **)&pOperationDef));
checkResult(defs.cdParameterDef()->
CreateInstance(IID_IAAFParameterDef,
(IUnknown **)&pParamDef));
checkResult(pOperationDef->Initialize (effectID, TEST_EFFECT_NAME, TEST_EFFECT_DESC));
checkResult(pDictionary->RegisterOperationDef(pOperationDef));
checkResult(pParamDef->Initialize (parmID, TEST_PARAM_NAME, TEST_PARAM_DESC, defs.tdRational ()));
checkResult(pParamDef->SetDisplayUnits(TEST_PARAM_UNITS));
checkResult(pDictionary->RegisterParameterDef(pParamDef));
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));
// ------------------------------------------------------------
// 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
//.........这里部分代码省略.........
示例3: 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;
}
示例4: ReadAAFFile
static HRESULT ReadAAFFile(const aafWChar * pFileName, testType_t testType)
{
IAAFFile * pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFEssenceAccess* pEssenceAccess = NULL;
IAAFEssenceMultiAccess* pMultiEssence = NULL;
IAAFEssenceFormat *fmtTemplate = NULL;
IEnumAAFMobs* pMobIter = NULL;
IAAFMob* pMob = NULL;
IAAFMasterMob* pMasterMob = NULL;
IAAFEssenceFormat* pFormat = NULL;
aafNumSlots_t numMobs, numSlots;
aafSearchCrit_t criteria;
aafRational_t readSampleRate;
aafMobID_t mobID;
aafWChar namebuf[1204];
unsigned char AAFDataBuf[4096];
aafUInt32 AAFBytesRead, samplesRead;
FILE* pWavFile = NULL;
unsigned char WAVDataBuf[4096], *dataPtr;
size_t WAVBytesRead;
aafUInt32 dataOffset, dataLen;
aafUInt16 bitsPerSample, numCh;
check(AAFFileOpenExistingRead ( pFileName, 0, &pFile));
check(pFile->GetHeader(&pHeader));
// Get the AAF Dictionary so that we can create valid AAF objects.
check(pHeader->GetDictionary(&pDictionary));
// Here we check on the number of mobs in the file.
// Get the number of master mobs in the file (should be one)
check(pHeader->CountMobs(kAAFMasterMob, &numMobs));
// ** causes leak
if (1 == numMobs )
{
printf("Found %d Master Mobs\n", numMobs);
criteria.searchTag = kAAFByMobKind;
criteria.tags.mobKind = kAAFMasterMob;
check(pHeader->GetMobs(&criteria, &pMobIter));
while(AAFRESULT_SUCCESS == pMobIter->NextOne(&pMob))
{
char mobIDstr[256];
char mobName[256];
check(pMob->GetMobID (&mobID));
check(pMob->GetName (namebuf, sizeof(namebuf)));
convert(mobName, sizeof(mobName), namebuf);
MobIDtoString(mobID, mobIDstr);
printf(" MasterMob Name = '%s'\n", mobName);
printf(" (mobID %s)\n", mobIDstr);
// Make sure we have two slots
check(pMob->CountSlots(&numSlots));
if (2 == numSlots)
{
// The essence data is in SlotID 1
// Get a Master Mob interface
check(pMob->QueryInterface(IID_IAAFMasterMob, (void **)&pMasterMob));
// Open the Essence Data
check(pMasterMob->OpenEssence( 1, // SlotID 1
NULL, // mediaCriteria (Don't care)
kAAFMediaOpenReadOnly, // Open mode
kAAFCompressionDisable,// Compress disabled
&pEssenceAccess));
// Open and read the Wave file (for comparison)
pWavFile = fopen("Laser.wav", "r");
if (pWavFile)
{
// read in the essence data
WAVBytesRead = fread(WAVDataBuf, sizeof(unsigned char), sizeof(WAVDataBuf), pWavFile);
fclose(pWavFile);
pWavFile = NULL;
check(loadWAVEHeader(WAVDataBuf,
&bitsPerSample,
&numCh,
&readSampleRate,
&dataOffset,
&dataLen));
dataPtr = WAVDataBuf + dataOffset;
aafUInt32 sampleBits;
aafInt32 bytesRead;
check(pEssenceAccess->GetEmptyFileFormat (&fmtTemplate));
check(fmtTemplate->AddFormatSpecifier (kAAFAudioSampleBits, 0, NULL));
check(pEssenceAccess->GetFileFormat (fmtTemplate, &pFormat));
fmtTemplate->Release();
fmtTemplate = NULL;
check(pFormat->GetFormatSpecifier (kAAFAudioSampleBits, sizeof(sampleBits),
(aafDataBuffer_t)&sampleBits, &bytesRead));
pFormat->Release();
pFormat = NULL;
//.........这里部分代码省略.........
示例5: 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;
IAAFMob* pMob = NULL;
IAAFMob* pReferencedMob = NULL;
IAAFTimelineMobSlot* newSlot = NULL;
IAAFSegment* seg = NULL;
bool bFileOpen = false;
HRESULT hr = AAFRESULT_SUCCESS;
IAAFComponent* pComponent = NULL;
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 MOB to be referenced
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pReferencedMob));
checkResult(pReferencedMob->SetMobID(TEST_referencedMobID));
checkResult(pReferencedMob->SetName(L"AAFSourceClipTest::ReferencedMob"));
// Create a Mob
checkResult(defs.cdCompositionMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
checkResult(pMob->SetName(L"AAFSourceClipTest"));
// Create a SourceClip
checkResult(defs.cdSourceClip()->
CreateInstance(IID_IAAFSegment,
(IUnknown **)&seg));
checkResult(seg->QueryInterface(IID_IAAFComponent, (void **)&pComponent));
checkResult(pComponent->SetDataDef(defs.ddkAAFPicture()));
pComponent->Release();
pComponent = NULL;
aafRational_t editRate = { 0, 1};
checkResult(pMob->AppendNewTimelineSlot (editRate,
seg,
1,
slotName,
0,
&newSlot));
checkResult(pHeader->AddMob(pMob));
checkResult(pHeader->AddMob(pReferencedMob));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (newSlot)
newSlot->Release();
if (pComponent)
pComponent->Release();
if (seg)
seg->Release();
if (pMob)
pMob->Release();
if (pReferencedMob)
pReferencedMob->Release();
if (pDictionary)
pDictionary->Release();
if (pHeader)
pHeader->Release();
if (pFile)
{
if (bFileOpen)
{
pFile->Save();
//.........这里部分代码省略.........
示例6: 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;
IAAFMob* pMob = NULL;
IAAFRIFFChunk* pRIFFChunk = NULL;
IAAFRIFFChunk* pRIFFChunk2 = NULL;
IAAFSourceMob* pSourceMob = NULL;
IAAFEssenceDescriptor* pEssDesc = NULL;
IAAFBWFImportDescriptor* pBWFImportDesc = NULL;
aafUInt32 testNum;
HRESULT hr = S_OK;
// 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);
checkResult(defs.cdSourceMob()->
CreateInstance(IID_IAAFSourceMob,
(IUnknown **)&pSourceMob));
pSourceMob->QueryInterface(IID_IAAFMob, (void **)&pMob);
pMob->SetMobID(TEST_MobID);
pMob->SetName(L"BWFImportDescriptorTest");
//Create BWFImportDescriptor to hold the RIFFChunk
checkResult( defs.cdBWFImportDescriptor()->
CreateInstance(IID_IAAFBWFImportDescriptor, (IUnknown **)&pBWFImportDesc));
// Create RIFFChunks and append them to BWFImportDescriptor
checkResult(defs.cdRIFFChunk()->CreateInstance(IID_IAAFRIFFChunk,
(IUnknown **)&pRIFFChunk));
checkResult(defs.cdRIFFChunk()->CreateInstance(IID_IAAFRIFFChunk,
(IUnknown **)&pRIFFChunk2));
checkResult(pBWFImportDesc->AppendUnknownBWFChunk(pRIFFChunk));
checkResult(pBWFImportDesc->AppendUnknownBWFChunk(pRIFFChunk2));
checkExpression(pBWFImportDesc->AppendUnknownBWFChunk(pRIFFChunk)==AAFRESULT_OBJECT_ALREADY_ATTACHED, AAFRESULT_TEST_FAILED);
checkResult(pBWFImportDesc->SetFileSecurityReport(TEST_FileSecurityReport));
checkResult(pBWFImportDesc->SetFileSecurityWave(TEST_FileSecurityWave));
checkResult(pBWFImportDesc->SetCodingHistory(TEST_CodingHistory));
checkResult(pBWFImportDesc->SetBasicData(TEST_BasicData));
checkResult(pBWFImportDesc->SetStartOfModulation(TEST_StartOfModulation));
checkResult(pBWFImportDesc->SetQualityEvent(TEST_QualityEvent));
checkResult(pBWFImportDesc->SetEndOfModulation(TEST_EndOfModulation));
checkResult(pBWFImportDesc->SetQualityParameter(TEST_QualityParameter));
checkResult(pBWFImportDesc->SetOperatorComment(TEST_OperatorComment));
checkResult(pBWFImportDesc->SetCueSheet(TEST_CueSheet));
checkResult( pBWFImportDesc->QueryInterface(IID_IAAFEssenceDescriptor, (void **)&pEssDesc));
checkResult(pSourceMob->SetEssenceDescriptor(pEssDesc));
//Add the MOB to the file
checkResult(pHeader->AddMob(pMob));
testNum = 0;
checkResult(pRIFFChunk->Initialize(chunkID));
checkResult(pRIFFChunk->Write(sizeof(RIFFChunksmiley), (unsigned char *)RIFFChunksmiley, &testNum));
checkExpression(testNum == sizeof(RIFFChunksmiley), AAFRESULT_TEST_FAILED);
testNum = 0;
checkResult(pRIFFChunk2->Initialize(chunkID2));
checkResult(pRIFFChunk2->Write(sizeof(RIFFChunkfrowney), (unsigned char *)RIFFChunkfrowney, &testNum));
checkExpression(testNum == sizeof(RIFFChunkfrowney), AAFRESULT_TEST_FAILED);
pFile->Save();
pEssDesc->Release();
pEssDesc = NULL;
pBWFImportDesc->Release();
pBWFImportDesc = NULL;
pRIFFChunk->Release();
pRIFFChunk = NULL;
pRIFFChunk2->Release();
pRIFFChunk2 = NULL;
pMob->Release();
pMob = NULL;
pSourceMob->Release();
pSourceMob = NULL;
//.........这里部分代码省略.........
示例7: 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));
//.........这里部分代码省略.........
示例8: 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
//.........这里部分代码省略.........
示例9: 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);
//.........这里部分代码省略.........
示例10: testRestore
static bool testRestore(const wchar_t* fileName)
{
bool passed = true;
IAAFFile* pFile = 0;
IAAFHeader* pHeader = 0;
IAAFDictionary* pDictionary = 0;
IAAFContentStorage* pStorage = 0;
IEnumAAFMobs* pMobs = 0;
IAAFMob* pMob = 0;
try
{
pFile = openFileForReading(fileName);
}
catch (...)
{
return false;
}
try
{
// get the Mob containing the test data
checkResult(pFile->GetHeader(&pHeader));
checkResult(pHeader->GetDictionary(&pDictionary));
checkResult(pHeader->GetContentStorage(&pStorage));
aafSearchCrit_t searchCrit;
searchCrit.searchTag = kAAFByMobKind;
searchCrit.tags.mobKind = kAAFAllMob;
checkResult(pStorage->GetMobs(&searchCrit, &pMobs));
checkResult(pMobs->NextOne(&pMob));
IAAFObject* pObject = 0;
IAAFClassDef* pClassDef = 0;
IAAFPropertyDef* pPropertyDef = 0;
IAAFPropertyValue* pPropertyValue = 0;
IAAFTypeDef* pType = 0;
IAAFTypeDefEnum* pEnumType = 0;
try
{
printf(" * Baseline: ");
const aafUID_t propId =
{0x00000000,0x0000,0x0000,{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
aafUInt8 testValue = 5;
const wchar_t* testName = L"VersionPrivateBuild";
checkResult(pMob->QueryInterface(IID_IAAFObject, (void **)&pObject));
checkResult(pDictionary->LookupClassDef(kAAFClassID_Mob, &pClassDef));
checkResult(pClassDef->LookupPropertyDef(propId, &pPropertyDef));
checkResult(pObject->GetPropertyValue(pPropertyDef, &pPropertyValue));
checkResult(pPropertyValue->GetType(&pType));
checkResult(pType->QueryInterface(IID_IAAFTypeDefEnum, (void **)&pEnumType));
aafInt64 value;
aafCharacter name[256];
checkResult(pEnumType->GetIntegerValue(pPropertyValue, &value));
checkResult(pEnumType->GetNameFromValue(pPropertyValue, name, 256));
if (value == testValue && wcscmp(name, testName) == 0)
{
printf("passed\n");
}
else
{
printf("FAILED\n");
passed = false;
}
}
catch (...)
{
printf("FAILED\n");
passed = false;
}
release(pEnumType);
release(pType);
release(pPropertyValue);
release(pPropertyDef);
release(pClassDef);
release(pObject);
try
{
printf(" * Enum element size 1 : ");
const aafUID_t propId =
{0x10000000,0x0000,0x0000,{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
aafUInt8 testValue = 1;
const wchar_t* testName = L"AAA";
checkResult(pMob->QueryInterface(IID_IAAFObject, (void **)&pObject));
checkResult(pDictionary->LookupClassDef(kAAFClassID_Mob, &pClassDef));
checkResult(pClassDef->LookupPropertyDef(propId, &pPropertyDef));
checkResult(pObject->GetPropertyValue(pPropertyDef, &pPropertyValue));
checkResult(pPropertyValue->GetType(&pType));
//.........这里部分代码省略.........
示例11: 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;
}
示例12: 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
//.........这里部分代码省略.........
示例13: 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;
//.........这里部分代码省略.........
示例14: 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();
//.........这里部分代码省略.........
示例15: CreateAAFFile
static HRESULT CreateAAFFile(aafWChar *filename, aafUID_constref fileKind)
{
TestProductID.companyName = companyName;
TestProductID.productName = productName;
TestProductID.productVersionString = NULL;
TestProductID.productID = UnitTestProductID;
TestProductID.platform = NULL;
TestProductID.productVersion = &TestVersion;
HRESULT hr = S_OK;
try
{
RemoveTestFile(filename);
// Open new file
IAAFFile *pFile = NULL;
TestProductID.productVersionString = const_cast<aafWChar*>(L"CreateAAFFile");
checkResult( AAFFileOpenNewModifyEx(
filename,
&fileKind,
0,
&TestProductID,
&pFile) );
// Get the header & dictionary
IAAFHeader *pHeader = NULL;
IAAFDictionary *pDictionary = NULL;
checkResult(pFile->GetHeader(&pHeader));
checkResult(pHeader->GetDictionary(&pDictionary));
// Create a MasterMob
IAAFMob *pMob = NULL;
IAAFClassDef *classDef = NULL;
checkResult(pDictionary->LookupClassDef(AUID_AAFMasterMob, &classDef));
checkResult(classDef->CreateInstance(IID_IAAFMob, (IUnknown **)&pMob));
classDef->Release();
checkResult(pMob->SetMobID(TEST_MobID));
checkResult(pMob->SetName(L"CreateAAFFile - MasterMob"));
checkResult(pHeader->AddMob(pMob));
pMob->Release();
// Create a SourceMob
IAAFSourceMob *pSourceMob = NULL;
checkResult(pDictionary->LookupClassDef(AUID_AAFSourceMob, &classDef));
checkResult(classDef->CreateInstance(IID_IAAFSourceMob, (IUnknown **)&pSourceMob));
classDef->Release();
checkResult(pSourceMob->QueryInterface(IID_IAAFMob, (void **)&pMob));
checkResult(pMob->SetMobID(TEST_SourceMobID));
checkResult(pMob->SetName(L"CreateAAFFile - SourceMob"));
IAAFEssenceDescriptor *edesc = NULL;
IAAFAIFCDescriptor *pAIFCDesc = NULL;
checkResult(pDictionary->LookupClassDef(AUID_AAFAIFCDescriptor, &classDef));
checkResult(classDef->CreateInstance(IID_IAAFEssenceDescriptor, (IUnknown **)&edesc));
classDef->Release();
checkResult(edesc->QueryInterface(IID_IAAFAIFCDescriptor, (void **)&pAIFCDesc));
aafUInt8 buf[] = {0x00};
checkResult(pAIFCDesc->SetSummary(sizeof(buf), buf));
checkResult(pSourceMob->SetEssenceDescriptor(edesc));
checkResult(pHeader->AddMob(pMob));
pAIFCDesc->Release();
edesc->Release();
pSourceMob->Release();
pMob->Release();
pDictionary->Release();
pHeader->Release();
// Save & close the file
checkResult(pFile->Save());
checkResult(pFile->Close());
checkResult(pFile->Release());
cout << "CreateAAFFile() - created new file" << endl;
}
catch (HRESULT& rResult)
{
hr = rResult;
cout << "*** CreateAAFFile: caught error hr=0x" << hex << hr << dec << endl;
}
return hr;
}