本文整理汇总了C++中IAAFFile::GetHeader方法的典型用法代码示例。如果您正苦于以下问题:C++ IAAFFile::GetHeader方法的具体用法?C++ IAAFFile::GetHeader怎么用?C++ IAAFFile::GetHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAAFFile
的用法示例。
在下文中一共展示了IAAFFile::GetHeader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
extern int main(int argc, char *argv[])
{
const char *filename_cstr = "test.aaf";
#ifndef _MSC_VER
setlocale (LC_ALL, "en_US.UTF-8");
#endif
if (argc >= 2)
{
filename_cstr = argv[1];
}
// convert C str to wide string
aafWChar filename[FILENAME_MAX];
size_t status = mbstowcs(filename, filename_cstr, sizeof(filename));
if (status == (size_t)-1) {
fprintf(stderr, "mbstowcs failed for \"%s\"\n", filename_cstr);
return 1;
}
remove(filename_cstr);
IAAFFile *pFile = NULL;
int mode = 0;
aafProductIdentification_t productID;
aafProductVersion_t TestVersion = {1, 1, 0, 0, kAAFVersionUnknown};
productID.companyName = (aafCharacter*)L"HSC";
productID.productName = (aafCharacter*)L"String Tester";
productID.productVersion = &TestVersion;
productID.productVersionString = NULL;
productID.productID = TestProductID;
productID.platform = (aafCharacter*)L"Linux";
// Create new AAF file
check(AAFFileOpenNewModify(filename, mode, &productID, &pFile));
// Create a simple Mob
IAAFClassDef *classDef = NULL;
IAAFMob *pMob = NULL;
IAAFHeader *pHeader = NULL;
IAAFDictionary *pDictionary = NULL;
check(pFile->GetHeader(&pHeader));
check(pHeader->GetDictionary(&pDictionary));
check(pDictionary->LookupClassDef(AUID_AAFMasterMob, &classDef));
check(classDef->CreateInstance(IID_IAAFMob, (IUnknown **)&pMob));
classDef->Release();
check(pMob->SetMobID(TEST_MobID));
// UTF-8 for codepoint U+1D11E (musical G Clef): 0xf0,0x9d,0x84,0x9e
// UTF-8 for codepoint U+1D122 (musical F Clef): 0xf0,0x9d,0x84,0xa2
// http://unicode.org/charts/PDF/U1D100.pdf
// http://en.wikipedia.org/wiki/UTF-8
aafCharacter *mobname;
const unsigned char inputStr[] = { 0xf0,0x9d,0x84,0x9e, // U+1D11E
0xf0,0x9d,0x84,0xa2, // U+1D122
0x4d, 0x6f, 0x62, // 'M' 'o' 'b'
0x0 };
// Convert UTF-8 inputStr to native wchar_t representation (UTF-32 Unix, UTF-16 Windows)
int wlen = 0, n;
#ifndef _MSC_VER
int ret;
char *p = (char *)inputStr;
while ((ret = mblen(p, 4)) > 0)
{ ++wlen; p+=ret; }
mobname = new aafCharacter[wlen+1];
n = mbstowcs(mobname, (const char *)inputStr, wlen+1);
if (n == -1)
{
fprintf (stderr, "mbstowcs returned -1. Invalid multibyte string\n");
exit(1);
}
#else
// Under Windows we must use MultiByteToWideChar() to get correct UTF-8 conversion to UTF-16
// since mbstowcs() is broken for UTF-8.
wlen = MultiByteToWideChar (CP_UTF8, MB_ERR_INVALID_CHARS, (LPCSTR)inputStr, -1, NULL, 0);
if (wlen == 0)
{
fprintf (stderr, "MultiByteToWideChar returned 0. Invalid multibyte string\n");
exit(1);
}
mobname = new aafCharacter[wlen];
n = MultiByteToWideChar (CP_UTF8, MB_ERR_INVALID_CHARS, (LPCSTR)inputStr, -1, mobname, wlen);
if (n == 0)
{
fprintf (stderr, "MultiByteToWideChar returned 0. Invalid multibyte string\n");
exit(1);
}
#endif
// SetName() calls OMSimpleProperty::set() which does a memcpy of the mobname string
// to an OMByte* variable 'bits()' at OMProperty.cpp:399
// Found by setting an rwatch on mobname address.
check(pMob->SetName(mobname));
aafUInt32 size_before = 0;
//.........这里部分代码省略.........
示例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;
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();
//.........这里部分代码省略.........
示例3: CreateAAFFile
static HRESULT CreateAAFFile(aafWChar * pFileName, long int N)
{
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFMob* pMob = NULL;
IAAFMob* pCompMob = NULL;
IAAFEssenceDescriptor* aDesc = NULL;
IAAFMasterMob* pMasterMob = NULL;
IAAFSourceMob* pFileMob = NULL;
IAAFSourceMob* pTapeMob = NULL;
IAAFSequence* pSequence = NULL;
IAAFComponent* aComponent = NULL;
IAAFFileDescriptor* pFileDesc = NULL;
IAAFAIFCDescriptor* pAIFCDesc = NULL;
IAAFTapeDescriptor* pTapeDesc = NULL;
IAAFTimelineMobSlot* newSlot = NULL;
IAAFSegment* seg = NULL;
IAAFSourceClip* fileSclp = NULL;
IAAFSourceClip* masterSclp = NULL;
IAAFSourceClip* compSclp = NULL;
IAAFComponent* compFill = NULL;
IAAFLocator* pLocator = NULL;
IAAFNetworkLocator* pNetLocator = NULL;
IAAFClassDef * pCDCompositionMob = 0;
IAAFClassDef * pCDSequence = 0;
IAAFClassDef * pCDSourceMob = 0;
IAAFClassDef * pCDTapeDescriptor = 0;
IAAFClassDef * pCDAIFCDescriptor = 0;
IAAFClassDef * pCDNetworkLocator = 0;
IAAFClassDef * pCDMasterMob = 0;
IAAFClassDef * pCDSourceClip = 0;
IAAFClassDef * pCDFiller = 0;
IAAFDataDef * pDdefPicture = 0;
aafRational_t videoRate = { 30000, 1001 };
aafMobID_t tapeMobID, fileMobID, masterMobID;
aafTimecode_t tapeTC = { 108000, kAAFTcNonDrop, 30};
aafLength_t fileLen = FILE1_LENGTH;
aafLength_t fillLen = FILL_LENGTH;
aafLength_t segLen = SEG_LENGTH;
aafProductIdentification_t ProductInfo;
long int i = 0;
moduleErrorTmp = S_OK;
// delete any previous test file before continuing...
char chFileName[1000];
convert(chFileName, sizeof(chFileName), pFileName);
remove(chFileName);
aafProductVersion_t v;
v.major = 1;
v.minor = 0;
v.tertiary = 0;
v.patchLevel = 0;
v.type = kAAFVersionUnknown;
ProductInfo.companyName = companyName;
ProductInfo.productName = productName;
ProductInfo.productVersion = &v;
ProductInfo.productVersionString = NULL;
ProductInfo.productID = NIL_UID;
ProductInfo.platform = NULL;
#if defined(USE_MEMORY_FILE)
check(MemoryFileOpenNewModify (0, &ProductInfo, &pFile));
#else
check(AAFFileOpenNewModifyEx (pFileName, &kAAFFileKind_Aaf4KBinary, 0, &ProductInfo, &pFile));
#endif
check(pFile->GetHeader(&pHeader));
// Get the AAF Dictionary so that we can create valid AAF objects.
check(pHeader->GetDictionary(&pDictionary));
check(pDictionary->LookupClassDef(AUID_AAFCompositionMob,
&pCDCompositionMob));
check(pDictionary->LookupClassDef(AUID_AAFSequence,
&pCDSequence));
check(pDictionary->LookupClassDef(AUID_AAFSourceMob,
&pCDSourceMob));
check(pDictionary->LookupClassDef(AUID_AAFTapeDescriptor,
&pCDTapeDescriptor));
check(pDictionary->LookupClassDef(AUID_AAFAIFCDescriptor,
&pCDAIFCDescriptor));
check(pDictionary->LookupClassDef(AUID_AAFNetworkLocator,
&pCDNetworkLocator));
check(pDictionary->LookupClassDef(AUID_AAFMasterMob,
&pCDMasterMob));
check(pDictionary->LookupClassDef(AUID_AAFSourceClip,
&pCDSourceClip));
check(pDictionary->LookupClassDef(AUID_AAFFiller,
&pCDFiller));
check(pDictionary->LookupDataDef(kAAFDataDef_Picture,
&pDdefPicture));
// IMPORTANT: major remodification is from this point onwards...
// sequence creation code pulled out of the subsequent loop.
// Create a Composition Mob
//.........这里部分代码省略.........
示例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;
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;
}
示例5: OpenAAFFile
static HRESULT OpenAAFFile(aafWChar * pFileName, bool comp_enable)
{
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFMob* pMob = NULL;
IAAFEssenceAccess* pEssenceAccess = NULL;
IEnumAAFMobs* pMobIter = NULL;
aafNumSlots_t numMobs, numSlots;
aafSearchCrit_t criteria;
aafMobID_t mobID;
IAAFDataDef *pPictureDef = NULL;
IAAFMobSlot* pMobSlot = NULL;
// Open an AAF file
check(AAFFileOpenExistingRead (pFileName, 0, &pFile));
check(pFile->GetHeader(&pHeader));
// Open raw video output file
FILE *output;
const char *output_file = comp_enable ? "raw.uyvy" : "raw.mjpeg";
if ((output = fopen(output_file, "wb")) == NULL)
{
perror(output_file);
exit(1);
}
// Get the AAF Dictionary from the file
check(pHeader->GetDictionary(&pDictionary));
/* Lookup any necessary data definitions. */
check(pDictionary->LookupDataDef(kAAFDataDef_Picture, &pPictureDef));
/* Check number of Mobs in file */
check(pHeader->CountMobs(kAAFMasterMob, &numMobs));
if (numMobs == 0)
return 0;
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];
aafWChar namebuf[1204];
IAAFTimelineMobSlot* pTimelineMobSlot = NULL;
IAAFDataDef *pDataDef = NULL;
IEnumAAFMobSlots* pMobSlotIter = NULL;
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);
// Get the number of slots
check(pMob->CountSlots(&numSlots));
// Iterating through all Mob Slots
check(pMob->GetSlots(&pMobSlotIter));
while(AAFRESULT_SUCCESS == pMobSlotIter->NextOne(&pMobSlot))
{
// Check to see if it is a Video Timeline Mob Slot
HRESULT hr;
hr = pMobSlot->QueryInterface(IID_IAAFTimelineMobSlot,(void **) &pTimelineMobSlot);
if (FAILED(hr))
{
pMobSlot->Release();
pMobSlot = NULL;
continue;
}
check(pMobSlot->GetDataDef(&pDataDef));
// Check that we have a picture data def
aafBool bIsPictureKind = kAAFFalse;
check(pDataDef->IsPictureKind(&bIsPictureKind));
if (kAAFTrue != bIsPictureKind)
{
pTimelineMobSlot->Release();
pTimelineMobSlot = NULL;
pDataDef->Release();
pDataDef = NULL;
continue; // skip non-picture data defs
}
aafUInt32 MobSlotID;
IAAFMasterMob* pMasterMob = NULL;
//.........这里部分代码省略.........
示例6: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar* pFileName)
{
IAAFFile* pFile = NULL;
bool bFileOpen = false;
IAAFHeader* pHeader = NULL;
IEnumAAFMobs* pMobIter = NULL;
IAAFMob* pMob = NULL;
IAAFMasterMob* pMasterMob = NULL;
IEnumAAFMobSlots* pSlotIter = NULL;
IAAFMobSlot* pSlot;
aafNumSlots_t numMobs;
aafSearchCrit_t criteria;
IAAFSearchSource* pSearchSource = NULL;
IAAFFindSourceInfo* pSourceInfo = NULL;
IAAFMob* si_mob = NULL; //mob used by SourceInfo intf.
HRESULT hr = S_OK;
try
{
// Open the AAF file
checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
bFileOpen = true;
// Get the AAF file header.
checkResult(pFile->GetHeader(&pHeader));
// Validate that there is on one master mob in the test file.
checkResult(pHeader->CountMobs(kAAFMasterMob, &numMobs));
checkExpression(1 == numMobs, AAFRESULT_TEST_FAILED);
// Enumerate over Master MOBs
criteria.searchTag = kAAFByMobKind;
criteria.tags.mobKind = kAAFMasterMob;
checkResult(pHeader->GetMobs(&criteria, &pMobIter));
while (pMobIter && pMobIter->NextOne(&pMob) == AAFRESULT_SUCCESS)
{
aafWChar name[500];
aafNumSlots_t numSlots = 0;
aafMobID_t mobID;
// TODO: Test Master MOB specific methods here
checkResult(pMob->QueryInterface(IID_IAAFMasterMob, (void **) &pMasterMob));
checkResult(pMob->GetName(name, sizeof(name)));
checkExpression(wcscmp(name, MobName) == 0, AAFRESULT_TEST_FAILED);
checkResult(pMob->GetMobID(&mobID));
checkExpression(0 == memcmp(&mobID, &TEST_Master_MobID, sizeof(mobID)), AAFRESULT_TEST_FAILED);
checkResult(pMob->CountSlots(&numSlots));
checkExpression(NumMobSlots == numSlots, AAFRESULT_TEST_FAILED);
//AAFRESULT STDMETHODCALLTYPE
// ImplAAFMasterMob::GetTapeNameBufLen (0,
// aafInt32* pLen)
unsigned long s = 0;
// Enumerate over all MOB slots for this MOB
checkResult(pMob->GetSlots(&pSlotIter));
while (pSlotIter && pSlotIter->NextOne(&pSlot) == AAFRESULT_SUCCESS)
{
aafWChar slotName[500];
aafSlotID_t slotID;
//aafUInt32 bufSize = 0;
// Validate the slot name
checkResult(pSlot->GetName(slotName, sizeof(slotName)));
checkExpression(wcscmp(slotName, slotNames[s]) == 0, AAFRESULT_TEST_FAILED);
// Validate the slot id.
checkResult(pSlot->GetSlotID(&slotID));
checkExpression(slotID == s+1, AAFRESULT_TEST_FAILED);
//Now, do a search source ...............
//Get a search source intf.
checkResult( pMasterMob->QueryInterface(IID_IAAFSearchSource, (void**)&pSearchSource) );
//From the searchsource inft, get a FindSourceINfo intf.
checkResult ( pSearchSource->SearchSource(
slotID,
0,
kAAFTapeMob,
NULL, //don't care about Media Criteria
NULL, //don't care about operation choice
&pSourceInfo));
//This is an important milestone! At this point, we were successful - about getting a pSourceInfo intf.
// so, release the search source intf.
if (pSearchSource)
{
pSearchSource->Release();
pSearchSource=NULL;
}
//NOw, simply test the methods on the (final) SourceInfo intf.
aafRational_t si_editRate = {-1};
//.........这里部分代码省略.........
示例7: 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;
IAAFMobSlot *newSlot = NULL;
IAAFSegment *seg = NULL;
IAAFSourceClip *sclp = NULL;
IAAFComponent *pComp = 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
long test;
// Create a concrete subclass of Mob
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
checkResult(pMob->SetName(L"MOBTest"));
// Add some slots
for(test = 0; test < 5; test++)
{
checkResult(defs.cdSourceClip()->
CreateInstance(IID_IAAFSourceClip,
(IUnknown **)&sclp));
checkResult(sclp->QueryInterface (IID_IAAFComponent, (void **)&pComp));
checkResult(pComp->SetDataDef (defs.ddkAAFPicture()));
pComp->Release();
pComp = NULL;
checkResult(sclp->QueryInterface (IID_IAAFSegment, (void **)&seg));
// Create a concrete subclass of MobSlot
checkResult(defs.cdStaticMobSlot()->
CreateInstance(IID_IAAFMobSlot,
(IUnknown **)&newSlot));
checkResult(newSlot->SetSegment(seg));
checkResult(newSlot->SetSlotID(test+1));
checkResult(newSlot->SetPhysicalNum(test+2));
checkResult(newSlot->SetName(slotNames[test]));
checkResult(pMob->AppendSlot (newSlot));
newSlot->Release();
newSlot = NULL;
seg->Release();
seg = NULL;
sclp->Release();
sclp = NULL;
}
// Add the mob to the file.
checkResult(pHeader->AddMob(pMob));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (newSlot)
newSlot->Release();
if (seg)
seg->Release();
if (sclp)
sclp->Release();
if (pComp)
pComp->Release();
//.........这里部分代码省略.........
示例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;
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)
//.........这里部分代码省略.........
示例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;
IAAFInterpolationDef* pInterpolationDef = 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;
// 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.cdInterpolationDefinition()->
CreateInstance(IID_IAAFInterpolationDef,
(IUnknown **)&pInterpolationDef));
checkResult(pInterpolationDef->QueryInterface (IID_IAAFDefObject,
(void **)&pDef));
checkResult(pInterpolationDef->Initialize(InterpDef1, sName1, sDescription1));
checkResult(pDictionary->RegisterInterpolationDef(pInterpolationDef));
pDef->Release();
pDef = NULL;
pInterpolationDef->Release();
pInterpolationDef = NULL;
checkResult(defs.cdInterpolationDefinition()->
CreateInstance(IID_IAAFInterpolationDef,
(IUnknown **)&pInterpolationDef));
checkResult(pInterpolationDef->QueryInterface (IID_IAAFDefObject,
(void **)&pDef));
checkResult(pInterpolationDef->Initialize(InterpDef2, sName2, sDescription2));
checkResult(pDictionary->RegisterInterpolationDef(pInterpolationDef));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pDef)
pDef->Release();
if (pInterpolationDef)
pInterpolationDef->Release();
if (pDictionary)
pDictionary->Release();
if (pHeader)
pHeader->Release();
if (pFile)
{ // Close file
if (bFileOpen)
{
pFile->Save();
pFile->Close();
}
pFile->Release();
}
return hr;
}
示例10: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar * pFileName)
{
IAAFFile *pFile = NULL;
bool bFileOpen = false;
IAAFHeader *pHeader = NULL;
IEnumAAFMobs *mobIter = NULL;
IAAFMob *aMob = NULL;
IEnumAAFMobSlots *slotIter = NULL;
IAAFMobSlot *slot = NULL;
IAAFSegment *pSeg = NULL;
IAAFSourceClip *pSourceClip = NULL;
IAAFDataDef * pDataDef = 0;
IAAFDefObject * pDefObj = 0;
aafNumSlots_t numMobs, n;
aafSlotID_t s;
aafUInt32 length;
HRESULT hr = S_OK;
aafUID_t readUID, typeUID = kAAFDataDef_Picture;
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);
aafSearchCrit_t criteria;
criteria.searchTag = kAAFNoSearch;
checkResult(pHeader->GetMobs (&criteria, &mobIter));
for(n = 0; n < numMobs; n++)
{
aafWChar name[500], slotName[500];
aafNumSlots_t numSlots;
aafMobID_t mobID;
aafSlotID_t trackID;
checkResult(mobIter->NextOne (&aMob));
checkResult(aMob->GetName (name, sizeof(name)));
checkResult(aMob->GetMobID (&mobID));
checkResult(aMob->CountSlots (&numSlots));
checkExpression(5 == numSlots, AAFRESULT_TEST_FAILED);
checkResult(aMob->GetSlots(&slotIter));
for(s = 0; s < (aafSlotID_t)numSlots; s++)
{
checkResult(slotIter->NextOne (&slot));
checkResult(slot->GetNameBufLen(&length));
checkResult(slot->GetName (slotName, length));
checkExpression (wcscmp(slotName, slotNames[s]) == 0, AAFRESULT_TEST_FAILED);
checkResult(slot->GetSlotID(&trackID));
checkExpression (trackID == s+1, AAFRESULT_TEST_FAILED);
checkResult(slot->GetPhysicalNum(&trackID));
checkExpression (trackID == s+2, AAFRESULT_TEST_FAILED);
checkResult(slot->GetPhysicalNum(&trackID));
checkResult(slot->GetDataDef(&pDataDef));
checkResult(pDataDef->QueryInterface (IID_IAAFDefObject, (void **)&pDefObj));
checkResult(pDefObj->GetAUID(&readUID));
checkExpression (memcmp(&typeUID, &readUID, sizeof(typeUID)) == 0, AAFRESULT_TEST_FAILED);
checkResult(slot->GetSegment(&pSeg));
checkResult(pSeg->QueryInterface (IID_IAAFSourceClip, (void **)&pSourceClip));
pDataDef->Release();
pDataDef = 0;
pDefObj->Release ();
pDefObj = 0;
pSourceClip->Release();
pSourceClip = NULL;
pSeg->Release();
pSeg = NULL;
slot->Release();
slot = NULL;
}
aMob->Release();
aMob = NULL;
}
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup object references
if (slot)
{
slot->Release();
slot = 0;
}
if (pSeg)
{
//.........这里部分代码省略.........
示例11: 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;
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);
///////////////////////
//checkResult(createCHARType (pDict));
checkResult(addCHARTypeToComponent (pDict));
///////////
//Create a concrete subclass of mob
IAAFMobSP spMob;
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&spMob));
checkResult(spMob->SetMobID(TEST_MobID));
checkResult(spMob->SetName(L"Some Mob"));
//Add a slot - make it our Filler
/// first, create Filler
IAAFFillerSP spFill;
checkResult(defs.cdFiller()->CreateInstance(IID_IAAFFiller, (IUnknown**)&spFill));
checkResult(spFill->Initialize(defs.ddkAAFSound(), 10));
checkResult(createCHARFiller(pDict, spFill));
//seg
//QI the filler for its segment
IAAFSegmentSP spSeg;
checkResult(spFill->QueryInterface (IID_IAAFSegment, (void **)&spSeg));
//Create a concrete subclass of mob slot
IAAFMobSlotSP spMobSlot;
checkResult(defs.cdStaticMobSlot()->
CreateInstance(IID_IAAFMobSlot,
(IUnknown **)&spMobSlot));
//Add the segment to the mobslot
checkResult(spMobSlot->SetSegment(spSeg));
checkResult(spMobSlot->SetSlotID(TEST_SLOT_ID));
checkResult(spMobSlot->SetName(TEST_SLOT_NAME));
//Append the slot to the Mob ....
checkResult(spMob->AppendSlot (spMobSlot));
//FINALLY .... Add mob to header
checkResult (pHeader->AddMob (spMob));
//////////////////// done /!!!!!!!!!!!!!!!!!!!!!!
//Verify results right away (during this creation process) ....
checkResult(verifyContents (pHeader, pDict, kAAFTrue)); //True => minimal testing
}
catch (HRESULT & rResult)
{
hr = rResult;
}
if (pDict) pDict->Release();
if (pHeader) pHeader->Release();
if (pFile)
{
stopGap(pFile->Save());
stopGap(pFile->Close());
pFile->Release();
}
return hr;
}//CreateAAFFile()
示例12: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar * pFileName)
{
IAAFDictionary *pDictionary = NULL;
IAAFFile *pFile = NULL;
bool bFileOpen = false;
IAAFHeader *pHeader = NULL;
IEnumAAFMobs *mobIter = NULL;
IAAFMob *aMob = NULL;
IEnumAAFMobSlots *slotIter = NULL;
IAAFMobSlot *slot = NULL;
aafNumSlots_t numMobs, n, s;
HRESULT hr = S_OK;
aafUInt32 bufLen = 0;
aafUInt32 bytesRead = 0;
aafUInt32 numFound = 0;
aafWChar value[500];
IEnumAAFTaggedValues *enumTaggedVal = NULL;
IAAFTaggedValue *taggedVal = NULL;
aafUID_t testKey;
IEnumAAFKLVData *klvEnum = NULL;
IAAFKLVData *pKLVData = NULL;
IAAFTypeDef* pBaseType = NULL;
IAAFSourceClip *pSourceClip = NULL;
IAAFSourceReference *pSourceRef = NULL;
IAAFSegment *pSegment = NULL;
aafMobID_t sourceID;
int i;
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->GetDictionary(&pDictionary));
CAAFBuiltinDefs defs (pDictionary);
checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
checkExpression(1 == numMobs, AAFRESULT_TEST_FAILED);
aafSearchCrit_t criteria;
criteria.searchTag = kAAFNoSearch;
checkResult(pHeader->GetMobs (&criteria, &mobIter));
for(n = 0; n < numMobs; n++)
{
aafWChar name[500], slotName[500];
aafNumSlots_t numSlots;
aafMobID_t mobID;
aafSlotID_t trackID;
aafUInt32 nameBufLen = 0;
checkResult(mobIter->NextOne (&aMob));
// Check GetNameBufLen and GetName
checkExpression(aMob->GetNameBufLen(NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
checkResult(aMob->GetNameBufLen(&nameBufLen));
checkExpression(((wcslen(mobName) + 1) * sizeof(aafCharacter)) == nameBufLen, AAFRESULT_TEST_FAILED);
checkExpression(aMob->GetName (NULL, nameBufLen) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
checkExpression(aMob->GetName (name, 4) == AAFRESULT_SMALLBUF, AAFRESULT_TEST_FAILED);
checkResult(aMob->GetName (name, nameBufLen));
checkExpression (wcscmp(mobName, name) == 0, AAFRESULT_TEST_FAILED);
// Check GetMobID
checkExpression(aMob->GetMobID (NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
checkResult(aMob->GetMobID (&mobID));
checkExpression(memcmp(&MOBTestID, &mobID, sizeof(mobID)) == 0, AAFRESULT_TEST_FAILED);
// Check the time stamps
aafTimeStamp_t created = { {0,0,0}, {0,0,0,0} };
checkExpression(aMob->GetCreateTime(NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
checkResult(aMob->GetCreateTime(&created));
checkTimeStampsAreEqual(creationTimeStamp, created);
aafTimeStamp_t modified = { {0,0,0}, {0,0,0,0} };
checkExpression(aMob->GetModTime(NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
checkResult(aMob->GetModTime(&modified));
checkTimeStampsAreEqual(modificationTimeStamp, modified);
// Check the GetMobInfo data.
memset(&created, 0, sizeof(created));
memset(&modified, 0, sizeof(modified));
checkExpression(aMob->GetMobInfo(NULL, &created,
name, sizeof(name)) == AAFRESULT_NULL_PARAM,
AAFRESULT_TEST_FAILED);
checkExpression(aMob->GetMobInfo(&modified, NULL,
name, sizeof(name)) == AAFRESULT_NULL_PARAM,
AAFRESULT_TEST_FAILED);
checkExpression(aMob->GetMobInfo(&modified, &created,
NULL, sizeof(name)) == AAFRESULT_NULL_PARAM,
AAFRESULT_TEST_FAILED);
checkExpression(aMob->GetMobInfo(&modified, &created,
name, 1) == AAFRESULT_SMALLBUF,
AAFRESULT_TEST_FAILED);
checkResult(aMob->GetMobInfo(&modified, &created, name, sizeof(name)));
checkTimeStampsAreEqual(creationTimeStamp, created);
//.........这里部分代码省略.........
示例13: 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;
IAAFMob *pMob2 = NULL;
IAAFMob2 *pMobInterface2 = NULL;
IAAFTimelineMobSlot *newSlot = NULL;
IAAFStaticMobSlot *newStaticSlot=NULL;
IAAFEventMobSlot *newEventSlot=NULL;
IAAFSegment *seg = NULL;
IAAFSourceClip *sclp = NULL;
IAAFEvent *event=NULL;
IAAFComponent* pComponent = NULL;
IAAFClassDef *pcdEventMeta=NULL;
IAAFClassDef *pcdEvent=NULL;
IAAFClassDef *pcdEventConcrete=NULL;
HRESULT hr = S_OK;
aafNumSlots_t numMobs;
aafUInt32 bufLen = 0;
aafUInt32 bytesRead = 0;
aafUInt32 numComments = 0;
aafUInt32 numFound = 0;
aafWChar name[500];
aafWChar value[500];
IEnumAAFTaggedValues *enumTaggedVal = NULL;
IAAFTaggedValue *taggedVal = NULL;
IAAFMobSlot *mSlot = NULL;
IAAFFiller *filler = NULL;
IAAFKLVData *pKLVData = NULL;
IAAFTypeDef* pBaseType = NULL;
IAAFSourceReference *pSourceRef = NULL;
IAAFTimecode *pTimecode = NULL;
aafTimecode_t timecode;
int i;
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
long test;
// Create a concrete subclass of Mob
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult( pMob->QueryInterface(IID_IAAFMob2,(void**)&pMobInterface2));
checkResult(pMob->SetMobID(MOBTestID));
checkExpression(pMob->GetNameBufLen(&bufLen) == AAFRESULT_PROP_NOT_PRESENT, AAFRESULT_TEST_FAILED);
checkExpression(pMob->GetName(name, 0) == AAFRESULT_PROP_NOT_PRESENT, AAFRESULT_TEST_FAILED);
checkExpression(pMob->SetName(NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
checkResult(pMob->SetName(mobName));
checkResult(pMob->SetCreateTime(creationTimeStamp));
checkResult(pMob->SetModTime(modificationTimeStamp));
// Add some slots
for(test = 1; test < 6; test++)
{
checkResult(defs.cdSourceClip()->
CreateInstance(IID_IAAFSourceClip,
(IUnknown **)&sclp));
checkResult(sclp->QueryInterface(IID_IAAFSourceReference, (void **)&pSourceRef));
checkResult(pSourceRef->SetSourceID(MOBTestID3));
checkResult(sclp->QueryInterface(IID_IAAFComponent, (void **)&pComponent));
checkResult(pComponent->SetDataDef(defs.ddkAAFPicture()));
checkResult(sclp->QueryInterface (IID_IAAFSegment, (void **)&seg));
aafRational_t editRate = { 0, 1};
checkResult(pMob->AppendNewTimelineSlot (editRate,
seg,
test+1,
slotNames[test],
0,
&newSlot));
//.........这里部分代码省略.........
示例14: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile* pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFCodecDef* pCodecDef = NULL;
IAAFClassDef* pClass = NULL;
bool bFileOpen = false;
HRESULT hr = S_OK;
aafUID_t uid;
/* 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;
// 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.cdCodecDef()->
CreateInstance(IID_IAAFCodecDef,
(IUnknown **)&pCodecDef));
checkResult(pCodecDef->AddEssenceKind (defs.ddkAAFMatte()));
uid = kAAFNoCodec;
checkResult(pCodecDef->Initialize (uid, sName1, sDescription1));
checkResult(pDictionary->LookupClassDef(kAAFClassID_EssenceDescriptor, &pClass));
checkResult(pCodecDef->SetFileDescriptorClass (pClass));
checkResult(pDictionary->RegisterCodecDef(pCodecDef));
pCodecDef->Release();
pCodecDef = NULL;
checkResult(defs.cdCodecDef()->
CreateInstance(IID_IAAFCodecDef,
(IUnknown **)&pCodecDef));
checkResult(pCodecDef->AddEssenceKind (defs.ddkAAFMatte()));
uid = TESTID_2;
checkResult(pCodecDef->Initialize (uid, sName2, sDescription2));
checkResult(pCodecDef->SetFileDescriptorClass (pClass));
checkResult(pDictionary->RegisterCodecDef(pCodecDef));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pCodecDef)
pCodecDef->Release();
if (pDictionary)
pDictionary->Release();
if (pHeader)
pHeader->Release();
if (pClass)
pClass->Release();
if (pFile)
{ // Close file
if (bFileOpen)
{
pFile->Save();
pFile->Close();
}
pFile->Release();
}
return hr;
}
示例15: 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));
//.........这里部分代码省略.........