本文整理汇总了C++中IAAFHeader类的典型用法代码示例。如果您正苦于以下问题:C++ IAAFHeader类的具体用法?C++ IAAFHeader怎么用?C++ IAAFHeader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IAAFHeader类的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: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar * pFileName)
{
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
HRESULT hr = S_OK;
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));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pHeader)
pHeader->Release();
if (pFile)
{ // Close file
if (bFileOpen)
pFile->Close();
pFile->Release();
}
return hr;
}
示例3: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile* pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFDefObject* pDef = NULL;
IAAFContainerDef* pContainerDef = NULL;
bool bFileOpen = false;
HRESULT hr = S_OK;
/* long test;
*/
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the AAF file
checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
bFileOpen = true;
// Get the AAF file header.
checkResult(pFile->GetHeader(&pHeader));
// Get the AAF Dictionary so that we can create valid AAF objects.
checkResult(pHeader->GetDictionary(&pDictionary));
CAAFBuiltinDefs defs (pDictionary);
checkResult(defs.cdContainerDef()->
CreateInstance(IID_IAAFContainerDef,
(IUnknown **)&pContainerDef));
checkResult(pContainerDef->QueryInterface (IID_IAAFDefObject,
(void **)&pDef));
checkResult(pContainerDef->Initialize (testUID, sName, sDescription));
checkResult(pDictionary->RegisterContainerDef(pContainerDef));
//
// test Append, Prepend, and enum plugin descriptor using same type def
//
IAAFPluginDescriptorSP pd1;
checkResult (defs.cdPluginDef()->
CreateInstance (IID_IAAFPluginDef,
(IUnknown **)&pd1));
checkResult (pd1->Initialize (kTestPluginDescID1,
L"PluginDesc1",
L"Plugin Descriptor 1 description"));
checkResult(pd1->SetDefinitionObjectID(kTestPluginDescID1));
checkResult (pDictionary->RegisterPluginDef (pd1));
IAAFPluginDescriptorSP pd2;
checkResult (defs.cdPluginDef()->
CreateInstance (IID_IAAFPluginDef,
(IUnknown **)&pd2));
checkResult (pd2->Initialize (kTestPluginDescID2,
L"PluginDesc2",
L"Plugin Descriptor 2 description"));
checkResult(pd2->SetDefinitionObjectID(kTestPluginDescID2));
checkResult (pDictionary->RegisterPluginDef (pd2));
IAAFPluginDescriptorSP pd3;
checkResult (defs.cdPluginDef()->
CreateInstance (IID_IAAFPluginDef,
(IUnknown **)&pd3));
checkResult (pd3->Initialize (kTestPluginDescID3,
L"PluginDesc3",
L"Plugin Descriptor 3 description"));
checkResult(pd3->SetDefinitionObjectID(kTestPluginDescID3));
checkResult (pDictionary->RegisterPluginDef (pd3));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pDef)
pDef->Release();
if (pContainerDef)
pContainerDef->Release();
if (pDictionary)
pDictionary->Release();
if (pHeader)
pHeader->Release();
if (pFile)
{ // Close file
if (bFileOpen)
{
//.........这里部分代码省略.........
示例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(const aafWChar * pFileName, testDataFile_t *dataFile, testType_t /* testType */)
{
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFMob* pMob = NULL;
IAAFMasterMob* pMasterMob = NULL;
IAAFClassDef* pKLVDataCD=NULL;
IAAFClassDef* pCommentMarkerCD=NULL;
IAAFTypeDef* pUnknownBaseType=NULL;
IAAFTypeDef* pInt32BaseType=NULL;
// IAAFTypeDef* pASCIIStringBaseType=NULL;
IAAFKLVData* pKLVData=NULL;
IAAFEssenceAccess* pEssenceAccess = NULL;
IAAFEssenceMultiAccess* pMultiEssence = NULL;
IAAFEssenceFormat* pFormat = NULL;
IAAFEssenceFormat* format = NULL;
IAAFLocator* pLocator = NULL;
IAAFClassDef* pCDMasterMob = 0;
IAAFClassDef *pCDNetworkLocator = 0;
IAAFDataDef *pDdefSound = 0;
IAAFDataDef* pDDefSceneDesc=0;
IAAFEventMobSlot *pEventSlot=0;
IAAFMobSlot *pSlot=0;
IAAFSequence *pSeqSceneDesc=0;
IAAFSegment *pSegment=0;
IAAFEvent *pEventSceneDesc=0;
IAAFComponent *pComp=0;
HRESULT hr = AAFRESULT_SUCCESS;
// !!!Previous revisions of this file contained variables here required to handle external essence
aafMobID_t masterMobID;
aafProductIdentification_t ProductInfo;
aafRational_t editRate = {30000, 1001};
aafRational_t sampleRate = {44100, 1};
aafRational_t eventTimebase = {30000, 1001};
aafPosition_t position=0;
FILE* pWavFile = NULL;
unsigned char dataBuff[4096], *dataPtr;
// aafUInt32 bytesWritten;
aafUInt32 dataOffset, dataLen;
aafUInt16 bitsPerSample, numCh;
aafInt32 n, numSpecifiers;
aafUID_t essenceFormatCode, testContainer;
aafUInt32 samplesWritten, bytesWritten;
// delete any previous test file before continuing...
char chFileName[1000];
convert(chFileName, sizeof(chFileName), pFileName);
remove(chFileName);
if(dataFile != NULL)
{
// delete any previous test file before continuing...
char chFileName[1000];
convert(chFileName, sizeof(chFileName), dataFile->dataFilename);
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;
check(AAFFileOpenNewModifyEx (pFileName, &kAAFFileKind_Aaf4KBinary, 0, &ProductInfo, &pFile));
check(pFile->GetHeader(&pHeader));
// test
// Get the AAF Dictionary so that we can create valid AAF objects.
check(pHeader->GetDictionary(&pDictionary));
check(pDictionary->LookupClassDef(AUID_AAFMasterMob,
&pCDMasterMob));
check(pDictionary->LookupClassDef(AUID_AAFNetworkLocator,
&pCDNetworkLocator));
check(pDictionary->LookupDataDef(kAAFDataDef_Sound,
&pDdefSound));
// !!!Previous revisions of this file contained code here required to handle external essence
// Get a Master MOB Interface
check(pCDMasterMob->
CreateInstance(IID_IAAFMasterMob,
(IUnknown **)&pMasterMob));
// Get a Mob interface and set its variables.
check(pMasterMob->QueryInterface(IID_IAAFMob, (void **)&pMob));
check(pMob->GetMobID(&masterMobID));
check(pMob->SetName(L"A Master Mob"));
// Add it to the file
//.........这里部分代码省略.........
示例6: 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();
//.........这里部分代码省略.........
示例7: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar * pFileName)
{
// IAAFSession * pSession = NULL;
IAAFFile * pFile = NULL;
IAAFHeader * pHeader = NULL;
IEnumAAFMobs* pMobIter = NULL;
IAAFMob* pMob = NULL;
IAAFMob* pReferencedMob = NULL;
IEnumAAFMobSlots* pSlotIter = NULL;
IAAFMobSlot* pSlot = NULL;
IAAFSegment* pSegment = NULL;
IAAFSourceClip* pSourceClip = NULL;
bool bFileOpen = false;
aafSearchCrit_t criteria;
aafNumSlots_t numMobs, numSlots;
HRESULT hr = AAFRESULT_SUCCESS;
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));
// Get the number of mobs in the file (should be one)
checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
checkExpression(2 == numMobs, AAFRESULT_TEST_FAILED);
// Enumerate over all Composition Mobs
criteria.searchTag = kAAFByMobKind;
criteria.tags.mobKind = kAAFCompMob;
checkResult(pHeader->GetMobs(&criteria, &pMobIter));
while (AAFRESULT_SUCCESS == pMobIter->NextOne(&pMob))
{
checkResult(pMob->CountSlots(&numSlots));
checkExpression(1 == numSlots, AAFRESULT_TEST_FAILED);
checkResult(pMob->GetSlots(&pSlotIter));
while (AAFRESULT_SUCCESS == pSlotIter->NextOne(&pSlot))
{
// The segment should be a source clip...
checkResult(pSlot->GetSegment(&pSegment));
pSegment->Release();
pSegment = NULL;
pSlot->Release();
pSlot = NULL;
}
pMob->Release();
pMob = NULL;
}
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pReferencedMob)
pReferencedMob->Release();
if (pSourceClip)
pSourceClip->Release();
if (pSegment)
pSegment->Release();
if (pSlot)
pSlot->Release();
if (pSlotIter)
pSlotIter->Release();
if (pMob)
pMob->Release();
if (pMobIter)
pMobIter->Release();
if (pHeader)
pHeader->Release();
if (pFile)
{
if (bFileOpen)
pFile->Close();
pFile->Release();
}
return hr;
}
示例8: 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;
IAAFTypeDefCharacter* pCharacterType = 0;
// test simple
try
{
printf(" * Simple: ");
const aafUID_t propId =
{0x00000000,0x0000,0x0000,{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
wchar_t testCharacter = L'A';
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_IAAFTypeDefCharacter, (void **)&pCharacterType));
aafCharacter value;
checkResult(pCharacterType->GetCharacter(pPropertyValue, &value));
if (value == testCharacter)
{
printf("passed\n");
}
else
{
printf("FAILED\n");
passed = false;
}
}
catch (...)
{
printf("FAILED\n");
passed = false;
}
release(pCharacterType);
release(pType);
release(pPropertyValue);
release(pPropertyDef);
release(pClassDef);
release(pObject);
// test XML escaped
try
{
printf(" * XML escaped: ");
const aafUID_t propId =
{0x10000000,0x0000,0x0000,{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
wchar_t testCharacter = L'\r';
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_IAAFTypeDefCharacter, (void **)&pCharacterType));
//.........这里部分代码省略.........
示例9: 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();
//.........这里部分代码省略.........
示例10: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
HRESULT hr = AAFRESULT_SUCCESS;
IAAFFile* pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFDictionary * pDict = NULL;
IAAFCompositionMob * pCMob = NULL;
IAAFMob * pMob = NULL;
IAAFObject * pObj = NULL;
try
{
//Do the usual ...
RemoveTestFile (pFileName);
checkResult (CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
assert (pFile);
checkResult (pFile->GetHeader (&pHeader));
assert (pHeader);
checkResult (pHeader->GetDictionary (&pDict));
assert (pDict);
CAAFBuiltinDefs defs (pDict);
//Create a composition ...
checkResult (defs.cdCompositionMob()->
CreateInstance (IID_IAAFCompositionMob,
(IUnknown **) &pCMob));
assert (pCMob);
checkResult (pCMob->Initialize (TEST_NAME));
//... Get its mob, and add it to the header info
checkResult (pCMob->QueryInterface (IID_IAAFMob,
(void **) &pMob));
assert (pMob);
checkResult (pHeader->AddMob (pMob));
}
catch (HRESULT & rResult)
{
hr = rResult;
}
if (pCMob) pCMob->Release();
if (pMob) pCMob->Release();
if (pObj) pObj->Release();
if (pDict) pDict->Release();
if (pHeader) pHeader->Release();
if (pFile)
{
AAFRESULT temphr = pFile->Save();
if (! SUCCEEDED (temphr)) return temphr;
temphr = pFile->Close();
if (! SUCCEEDED (temphr)) return temphr;
pFile->Release();
}
return hr;
}
示例11: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar * pFileName)
{
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
aafNumSlots_t numMobs, i;
HRESULT hr = S_OK;
HRESULT localhr = S_OK;
IEnumAAFMobs *mobIter = NULL;
IEnumAAFMobs *cloneMobIter = NULL;
IAAFMob *aMob = NULL;
IAAFMob **mobArray = NULL;
aafSearchCrit_t criteria;
aafUInt32 numFetched = 0;
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));
// Make sure that we have one master, one file, and one composition (three total)
checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
checkExpression (3 == numMobs, AAFRESULT_TEST_FAILED);
criteria.searchTag = kAAFNoSearch;
checkResult(pHeader->GetMobs (&criteria, &mobIter));
/* Test the Reset method *******************************/
if (mobIter->Reset() == AAFRESULT_SUCCESS)
cout<< " Reset() ... Passed" << endl;
else {
cout<< " Reset() ... Failed!!!" << endl;
hr = AAFRESULT_TEST_FAILED;
}
/* Test the NextOne method ******************************/
// Call NextOne once for each mob for a total of numMobs times
for (i=0; i<numMobs; i++) {
if (mobIter->NextOne(&aMob) == AAFRESULT_SUCCESS) {
aMob->Release();
aMob = NULL;
}
else
localhr = AAFRESULT_TEST_FAILED;
}
// Make sure we are at the end
if (mobIter->NextOne(&aMob) != AAFRESULT_NO_MORE_OBJECTS)
localhr = AAFRESULT_TEST_FAILED;
mobIter->Reset();
// this should return AAFRESULT_NULL_PARAM
if (mobIter->NextOne(NULL) != AAFRESULT_NULL_PARAM)
localhr = AAFRESULT_TEST_FAILED;
if (SUCCEEDED(localhr))
cout<< " NextOne() ... Passed" << endl;
else {
cout<< " NextOne() ... Failed!!!" << endl;
hr = AAFRESULT_TEST_FAILED;
}
/* Test the Skip method ******************************/
localhr = S_OK;
mobIter->Reset();
// skip over each Mob one at a time.
for (i=0; i<numMobs; i++)
if (mobIter->Skip(1) != AAFRESULT_SUCCESS)
localhr = AAFRESULT_TEST_FAILED;
// Make sure we are at the end.
if (mobIter->Skip(1) != AAFRESULT_NO_MORE_OBJECTS)
localhr = AAFRESULT_TEST_FAILED;
mobIter->Reset();
// Skip over multiple Mobs at a time.
for (i=2; i<=numMobs; i++) {
if (mobIter->Skip(i) != AAFRESULT_SUCCESS)
localhr = AAFRESULT_TEST_FAILED;
mobIter->Reset();
}
// Make sure we are at the end.
if (mobIter->Skip(numMobs+1) != AAFRESULT_NO_MORE_OBJECTS)
localhr = AAFRESULT_TEST_FAILED;
if (SUCCEEDED(localhr))
cout<< " Skip() ... Passed" << endl;
//.........这里部分代码省略.........
示例12: openEssenceData
void EnumEssenceDataTest::openEssenceData()
{
assert(_pFile && _pHeader);
assert(NULL == _pEnumEssenceData);
assert(NULL == _pEssenceData);
assert(NULL == _pSourceMob);
aafUInt32 essenceDataCount = 0;
check(_pHeader->CountEssenceData(&essenceDataCount));
if (_maxMobCount != essenceDataCount)
check(AAFRESULT_TEST_FAILED);
check(_pHeader->EnumEssenceData(&_pEnumEssenceData));
for (aafUInt32 item = 0; item < essenceDataCount; ++item)
{
check(_pEnumEssenceData->NextOne(&_pEssenceData));
// Make sure that the essence data still references
// a valid mob.
check(_pEssenceData->GetFileMob(&_pSourceMob));
_pSourceMob->Release();
_pSourceMob = NULL;
_pEssenceData->Release();
_pEssenceData = NULL;
}
_pEnumEssenceData->Release();
_pEnumEssenceData = NULL;
}
示例13: Close
void EventTest::Close()
{
if (_pDictionary)
{
_pDictionary->Release();
_pDictionary = NULL;
}
if (_pHeader)
{
_pHeader->Release();
_pHeader = NULL;
}
if (_pFile)
{
if (_bWritableFile)
checkResult(_pFile->Save());
checkResult(_pFile->Close());
_pFile->Release();
_pFile = NULL;
}
}
示例14: Create
void EventTest::Create(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
assert(NULL == _pFile);
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the file
checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &_pFile ));
_bWritableFile = 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));
// Make a text clip.
CreateEvent();
// cleanup
Close();
}
示例15: cleanupReferences
void EnumEssenceDataTest::cleanupReferences()
{
if (NULL != _pEssenceData)
{
_pEssenceData->Release();
_pEssenceData = NULL;
}
if (NULL != _pEnumEssenceData)
{
_pEnumEssenceData->Release();
_pEnumEssenceData = NULL;
}
if (NULL != _pFileDescriptor)
{
_pFileDescriptor->Release();
_pFileDescriptor = NULL;
}
if (NULL != _pEssenceDescriptor)
{
_pEssenceDescriptor->Release();
_pEssenceDescriptor = NULL;
}
if (NULL != _pSourceMob)
{
_pSourceMob->Release();
_pSourceMob = NULL;
}
if (NULL != _pMob)
{
_pMob->Release();
_pMob = NULL;
}
if (NULL != _pDictionary)
{
_pDictionary->Release();
_pDictionary = NULL;
}
if (NULL != _pHeader)
{
_pHeader->Release();
_pHeader = NULL;
}
if (NULL != _pFile)
{
if (_bFileOpen)
_pFile->Close();
_pFile->Release();
_pFile = NULL;
}
}