本文整理汇总了C++中IAAFSourceMob::GetEssenceDescriptor方法的典型用法代码示例。如果您正苦于以下问题:C++ IAAFSourceMob::GetEssenceDescriptor方法的具体用法?C++ IAAFSourceMob::GetEssenceDescriptor怎么用?C++ IAAFSourceMob::GetEssenceDescriptor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAAFSourceMob
的用法示例。
在下文中一共展示了IAAFSourceMob::GetEssenceDescriptor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
//.........这里部分代码省略.........
示例2: 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();
//.........这里部分代码省略.........
示例3: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar * pFileName)
{
// IAAFSession * pSession = NULL;
IAAFFile * pFile = NULL;
IAAFHeader * pHeader = NULL;
IEnumAAFMobs *mobIter = NULL;
IAAFMob *aMob = NULL;
IAAFEssenceDescriptor *pEdesc = NULL;
IAAFSourceMob *pSourceMob = NULL;
IEnumAAFLocators * pEnum = NULL;
IAAFLocator * pLocator = NULL;
aafUInt32 numLocators;
aafNumSlots_t numMobs, n;
HRESULT hr = AAFRESULT_SUCCESS;
bool bFileOpen = false;
try
{
// Open the file
checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
bFileOpen = true;
// We can't really do anthing in AAF without the header.
checkResult(pFile->GetHeader(&pHeader));
checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
checkExpression (1 == numMobs, AAFRESULT_TEST_FAILED);
checkResult(pHeader->GetMobs (NULL, &mobIter));
for(n = 0; n < numMobs; n++)
{
aafWChar name[500];
aafMobID_t mobID;
checkResult(mobIter->NextOne (&aMob));
checkResult(aMob->GetName (name, sizeof(name)));
checkResult(aMob->GetMobID (&mobID));
checkResult(aMob->QueryInterface (IID_IAAFSourceMob, (void **)&pSourceMob));
checkResult(pSourceMob->GetEssenceDescriptor (&pEdesc));
// Verify that there is now one locator
checkResult(pEdesc->CountLocators(&numLocators));
checkExpression(20 == numLocators, AAFRESULT_TEST_FAILED);
checkResult(pEdesc->GetLocators(&pEnum));
// This should read the one real locator
for ( n=0; n<numLocators; n++)
{
checkResult(pEnum->NextOne(&pLocator));
pLocator->Release();
pLocator = NULL;
}
// We had better not succeed or get an unknown failure.
checkExpression(AAFRESULT_NO_MORE_OBJECTS == pEnum->NextOne(&pLocator),
AAFRESULT_TEST_FAILED);
pEnum->Release();
pEnum = NULL;
pEdesc->Release();
pEdesc = NULL;
pSourceMob->Release();
pSourceMob = NULL;
aMob->Release();
aMob = NULL;
}
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup object references
if (pLocator)
pLocator->Release();
if (pEnum)
pEnum->Release();
if (pEdesc)
pEdesc->Release();
if (pSourceMob)
pSourceMob->Release();
if (aMob)
aMob->Release();
if (mobIter)
mobIter->Release();
if (pHeader)
//.........这里部分代码省略.........
示例4: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar * pFileName)
{
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IEnumAAFMobs* pMobIter = NULL;
IAAFMob* pMob = NULL;
IAAFSourceMob* pSourceMob = NULL;
IAAFEssenceDescriptor* pEssDesc = NULL;
IAAFDataEssenceDescriptor* pDataEssenceDesc = NULL;
aafNumSlots_t numMobs = 0;
aafUID_t dataEssenceCoding, dataEssTestVal;
HRESULT hr = AAFRESULT_SUCCESS;
try
{
memset(&dataEssTestVal, 0, sizeof(aafUID_t));
// Open the AAF file
checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
// Get the AAF file header.
checkResult(pFile->GetHeader(&pHeader));
checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
checkExpression(1 == numMobs, AAFRESULT_TEST_FAILED);
checkResult(pHeader->GetMobs(NULL, &pMobIter));
checkResult(pMobIter->NextOne(&pMob));
checkResult(pMob->QueryInterface(IID_IAAFSourceMob, (void **)&pSourceMob));
// Back into testing mode
checkResult(pSourceMob->GetEssenceDescriptor(&pEssDesc));
// if there is an Essence Descriptor then it MUST be an (essence) DataEssence Descriptor
checkResult(pEssDesc->QueryInterface(IID_IAAFDataEssenceDescriptor, (void **) &pDataEssenceDesc));
checkResult(pDataEssenceDesc->GetDataEssenceCoding(&dataEssenceCoding));
checkExpression(memcmp(&dataEssenceCoding, &dataEssTestVal, sizeof(aafUID_t)) == 0,
AAFRESULT_TEST_FAILED);
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pDataEssenceDesc)
pDataEssenceDesc->Release();
if (pEssDesc)
pEssDesc->Release();
if (pSourceMob)
pSourceMob->Release();
if (pMob)
pMob->Release();
if (pMobIter)
pMobIter->Release();
if (pHeader)
pHeader->Release();
if (pFile)
{
pFile->Close();
pFile->Release();
}
return hr;
}
示例5: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar * pFileName)
{
// IAAFSession * pSession = NULL;
IAAFFile * pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFEssenceDescriptor *pEdesc = NULL;
IAAFSourceMob *pSourceMob = NULL;
IEnumAAFLocators * pEnum = NULL;
IAAFLocator * pLocator = NULL;
IEnumAAFMobs *mobIter = NULL;
IAAFMob *aMob = NULL;
aafUInt32 numLocators;
aafUInt32 readLen;
aafNumSlots_t numMobs, n;
HRESULT hr = AAFRESULT_SUCCESS;
aafWChar readBuf[1024];
bool bFileOpen = false;
try
{
// Open the file.
checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
bFileOpen = true;
checkResult(pFile->GetHeader(&pHeader));
checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
if (1 != numMobs )
checkResult(AAFRESULT_TEST_FAILED);
//!!! aafSearchCrit_t criteria;
//!!! criteria.searchTag = kAAFNoSearch;
checkResult(pHeader->GetMobs (NULL, &mobIter));
for(n = 0; n < numMobs; n++)
{
aafWChar name[500];
aafMobID_t mobID;
checkResult(mobIter->NextOne (&aMob));
checkResult(aMob->GetName (name, sizeof(name)));
checkResult(aMob->GetMobID (&mobID));
checkResult(aMob->QueryInterface (IID_IAAFSourceMob, (void **)&pSourceMob));
checkResult(pSourceMob->GetEssenceDescriptor (&pEdesc));
// Verify that there is now one locator
checkResult(pEdesc->CountLocators(&numLocators));
if (1 != numLocators)
checkResult(AAFRESULT_TEST_FAILED);
checkResult(pEdesc->GetLocators(&pEnum));
// This should read the one real locator
checkResult(pEnum->NextOne(&pLocator));
checkResult(pLocator->GetPathBufLen (&readLen));
// if(readLen != strlen(TEST_PATH))
checkResult(pLocator->GetPath (readBuf, readLen));
// This should run off the end
pLocator->Release();
pLocator = NULL;
hr = pEnum->NextOne(&pLocator);
if (AAFRESULT_NO_MORE_OBJECTS != hr)
checkResult(hr);
else
hr = AAFRESULT_SUCCESS; // reset result
}
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup...
if (pLocator)
pLocator->Release();
if (pEnum)
pEnum->Release();
if (pEdesc)
pEdesc->Release();
if (pSourceMob)
pSourceMob->Release();
if (aMob)
aMob->Release();
if (mobIter)
mobIter->Release();
//.........这里部分代码省略.........
示例6: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar * pFileName)
{
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IEnumAAFMobs* pMobIter = NULL;
IAAFMob* pMob = NULL;
IAAFSourceMob* pSourceMob = NULL;
IAAFEssenceDescriptor* pEssDesc = NULL;
IAAFTIFFDescriptor* pTIFFDesc = NULL;
aafNumSlots_t numMobs = 0;
HRESULT hr = AAFRESULT_SUCCESS;
aafBool isContiguous, isUniform;
aafInt32 leadingLines, trailingLines;
aafUInt32 size;
aafUInt8 summary[512];
try
{
// Open the AAF file
checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
// Get the AAF file header.
checkResult(pFile->GetHeader(&pHeader));
checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
checkExpression(1 == numMobs, AAFRESULT_TEST_FAILED);
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_IAAFTIFFDescriptor, (void **)&pTIFFDesc));
checkResult(pTIFFDesc->GetIsContiguous(&isContiguous));
checkResult(pTIFFDesc->GetIsUniform(&isUniform));
checkResult(pTIFFDesc->GetLeadingLines(&leadingLines));
checkResult(pTIFFDesc->GetTrailingLines(&trailingLines));
checkResult(pTIFFDesc->GetSummaryBufferSize(&size));
checkExpression(size == 34, AAFRESULT_TEST_FAILED);
checkResult(pTIFFDesc->GetSummary(size, summary));
checkExpression(isContiguous == kAAFTrue, AAFRESULT_TEST_FAILED);
checkExpression(isUniform == kAAFFalse, AAFRESULT_TEST_FAILED);
checkExpression(leadingLines == 10, AAFRESULT_TEST_FAILED);
checkExpression(trailingLines == 20, AAFRESULT_TEST_FAILED);
// The next statement is not true when doing cross-platform tests
//#if defined( OS_WINDOWS )
// checkExpression(memcmp(summary, "II", 2) == 0, AAFRESULT_TEST_FAILED);
//#else
// checkExpression(memcmp(summary, "MM", 2) == 0, AAFRESULT_TEST_FAILED);
//#endif
// NOTE: The elements in the summary structure need to be byte swapped
// on Big Endian system (i.e. the MAC).
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pEssDesc)
pEssDesc->Release();
if (pTIFFDesc)
pTIFFDesc->Release();
if (pMob)
pMob->Release();
if (pSourceMob)
pSourceMob->Release();
if (pHeader)
pHeader->Release();
if (pMobIter)
pMobIter->Release();
if (pFile)
{
pFile->Close();
pFile->Release();
}
return hr;
}
示例7: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar * pFileName)
{
IAAFFile * pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFSourceMob* pSourceMob = NULL;
IAAFMob* pMob = NULL;
IAAFEssenceDescriptor* pEssDesc = NULL;
IAAFBWFImportDescriptor* pBWFImportDesc = NULL;
IEnumAAFRIFFChunks* pEnum = NULL;
IAAFRIFFChunk* pRIFFChunk = NULL;
IEnumAAFMobs* pMobIter = NULL;
aafUInt32 numData, bytesRead, com, testID;
aafLength_t testLength, testRIFFLen;
aafPosition_t dataPos;
aafNumSlots_t numMobs;
char Value[sizeof(RIFFChunksmiley)];
char Value2[sizeof(RIFFChunkfrowney)];
HRESULT hr = AAFRESULT_SUCCESS;
checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
checkResult( pFile->GetHeader(&pHeader));
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->CountUnknownBWFChunks(&numData));
checkExpression(1 == numData, AAFRESULT_TEST_FAILED);
checkResult(pBWFImportDesc->GetUnknownBWFChunks(&pEnum));
for(com = 0; com < numData; com++)
{
checkResult(pEnum->NextOne(&pRIFFChunk));
checkResult(pRIFFChunk->GetLength(&testRIFFLen));
checkExpression((sizeof(RIFFChunksmiley)+sizeof(RIFFChunkfrowney)) == testRIFFLen, AAFRESULT_TEST_FAILED);
checkResult(pRIFFChunk->Read( sizeof(Value), (unsigned char *)Value, &bytesRead));
checkExpression(memcmp(Value, RIFFChunksmiley, sizeof(RIFFChunksmiley)) == 0, AAFRESULT_TEST_FAILED);
checkResult(pRIFFChunk->Read( sizeof(Value2), (unsigned char *)Value2, &bytesRead));
checkExpression(memcmp(Value2, RIFFChunkfrowney, sizeof(RIFFChunkfrowney)) == 0, AAFRESULT_TEST_FAILED);
checkResult(pRIFFChunk->GetPosition(&dataPos));
checkExpression(dataPos==(sizeof(RIFFChunksmiley)+sizeof(RIFFChunkfrowney)), AAFRESULT_TEST_FAILED);
checkResult(pRIFFChunk->SetPosition(0));
checkResult(pRIFFChunk->Read( sizeof(Value), (unsigned char *)Value, &bytesRead));
checkExpression(memcmp(Value, RIFFChunksmiley, sizeof(RIFFChunksmiley)) == 0, AAFRESULT_TEST_FAILED);
pRIFFChunk->GetChunkID(&testID);
checkExpression(testID==chunkID, AAFRESULT_TEST_FAILED);
pRIFFChunk->GetLength(&testLength);
checkExpression(testLength == sizeof(RIFFChunksmiley) + sizeof(RIFFChunkfrowney), AAFRESULT_TEST_FAILED);
pRIFFChunk->Release();
pRIFFChunk = NULL;
}
pEnum->Release();
pEnum = NULL;
pEssDesc->Release();
pEssDesc = NULL;
pBWFImportDesc->Release();
pBWFImportDesc = NULL;
pSourceMob->Release();
pSourceMob = NULL;
pMobIter->Release();
pMobIter = NULL;
}
pMob->Release();
pMob = NULL;
pHeader->Release();
pHeader = NULL;
pFile->Close();
pFile->Release();
pFile = NULL;
return hr;
}
示例8: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar * pFileName)
{
// IAAFSession * pSession = NULL;
IAAFFile * pFile = NULL;
IAAFHeader * pHeader = NULL;
IEnumAAFMobs *mobIter = NULL;
IAAFMob *aMob = NULL;
IAAFEssenceDescriptor *pEdesc = NULL;
IAAFSourceMob *pSourceMob = NULL;
IEnumAAFLocators * pEnum = NULL;
IEnumAAFLocators * pCloneEnum = NULL;
IAAFLocator * pLocator = NULL;
aafUInt32 numLocators;
aafNumSlots_t numMobs, n;
HRESULT hr = AAFRESULT_SUCCESS;
bool bFileOpen = false;
wchar_t testname[256];
IAAFLocator * pArray[2] = { NULL, NULL };
IAAFLocator ** pArrayPoint = pArray;
aafUInt32 resultCount;
try
{
// Open the file
checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
bFileOpen = true;
// We can't really do anthing in AAF without the header.
checkResult(pFile->GetHeader(&pHeader));
checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
checkExpression (1 == numMobs, AAFRESULT_TEST_FAILED);
checkResult(pHeader->GetMobs (NULL, &mobIter));
for(n = 0; n < numMobs; n++)
{
aafWChar name[500];
aafMobID_t mobID;
checkResult(mobIter->NextOne (&aMob));
checkResult(aMob->GetName (name, sizeof(name)));
checkResult(aMob->GetMobID (&mobID));
checkResult(aMob->QueryInterface (IID_IAAFSourceMob, (void **)&pSourceMob));
checkResult(pSourceMob->GetEssenceDescriptor (&pEdesc));
// Verify that there is now two locators
checkResult(pEdesc->CountLocators(&numLocators));
checkExpression(2 == numLocators, AAFRESULT_TEST_FAILED);
checkResult(pEdesc->GetLocators(&pEnum));
/* Read and check the first element */
checkResult(pEnum->NextOne(&pLocator));
checkResult(pLocator->GetPath (testname, sizeof(testname)));
checkExpression(wcscmp(testname, locator1) == 0, AAFRESULT_TEST_FAILED);
pLocator->Release();
pLocator = NULL;
/**/
/* Read and check the second element */
checkResult(pEnum->NextOne(&pLocator));
checkResult(pLocator->GetPath (testname, sizeof(testname)));
checkExpression(wcscmp(testname, locator2) == 0, AAFRESULT_TEST_FAILED);
pLocator->Release();
pLocator = NULL;
/*****/
/* Reset, and check the first element again*/
checkResult(pEnum->Reset());
checkResult(pEnum->NextOne(&pLocator));
checkResult(pLocator->GetPath (testname, sizeof(testname)));
checkExpression(wcscmp(testname, locator1) == 0, AAFRESULT_TEST_FAILED);
pLocator->Release();
pLocator = NULL;
/* Reset, Skip, and check the second element again*/
checkResult(pEnum->Reset());
checkResult(pEnum->Skip(1));
checkResult(pEnum->NextOne(&pLocator));
checkResult(pLocator->GetPath (testname, sizeof(testname)));
checkExpression(wcscmp(testname, locator2) == 0, AAFRESULT_TEST_FAILED);
pLocator->Release();
pLocator = NULL;
/* Reset, and read both elements */
checkResult(pEnum->Reset());
checkResult(pEnum->Next (2, (IAAFLocator **)&pArray, &resultCount));
checkExpression (resultCount == 2, AAFRESULT_TEST_FAILED);
checkResult(pArrayPoint[0]->GetPath (testname, sizeof(testname)));
checkExpression(wcscmp(testname, locator1) == 0, AAFRESULT_TEST_FAILED);
pArrayPoint[0]->Release();
pArrayPoint[0] = NULL;
checkResult(pArrayPoint[1]->GetPath (testname, sizeof(testname)));
checkExpression(wcscmp(testname, locator2) == 0, AAFRESULT_TEST_FAILED);
pArrayPoint[1]->Release();
pArrayPoint[1] = NULL;
//.........这里部分代码省略.........