本文整理汇总了C++中IAAFEssenceDescriptor::CountLocators方法的典型用法代码示例。如果您正苦于以下问题:C++ IAAFEssenceDescriptor::CountLocators方法的具体用法?C++ IAAFEssenceDescriptor::CountLocators怎么用?C++ IAAFEssenceDescriptor::CountLocators使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAAFEssenceDescriptor
的用法示例。
在下文中一共展示了IAAFEssenceDescriptor::CountLocators方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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));
//.........这里部分代码省略.........
示例2: 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)
//.........这里部分代码省略.........
示例3: 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();
//.........这里部分代码省略.........
示例4: 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();
//.........这里部分代码省略.........
示例5: 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;
//.........这里部分代码省略.........