本文整理汇总了C++中IAAFHeader::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ IAAFHeader::Release方法的具体用法?C++ IAAFHeader::Release怎么用?C++ IAAFHeader::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAAFHeader
的用法示例。
在下文中一共展示了IAAFHeader::Release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
示例2: 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;
}
}
示例3: 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()
示例4: 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;
}
示例5: CreateAAFFile
//.........这里部分代码省略.........
checkResult(pOperationDef->AddParameterDef (pParamDef));
checkResult(pOperationDef->SetBypass (TEST_BYPASS));
// ------------------------------------------------------------
// To test a Transition we need to create a Sequence which will
// a Filler, a transition and another Filler. I know this is not
// very interesting, but it will let us test the Transition
// interface with the least amount of other stuff.
// ------------------------------------------------------------
//
// Create a CompositionMob
checkResult(defs.cdCompositionMob()->
CreateInstance(IID_IAAFCompositionMob,
(IUnknown **)&pCompMob));
checkResult(pCompMob->Initialize(L"Transition Test"));
// Get a MOB interface
checkResult(pCompMob->QueryInterface (IID_IAAFMob, (void **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
// Create a Sequence
checkResult(defs.cdSequence()->
CreateInstance(IID_IAAFSequence,
(IUnknown **) &pSequence));
// Get a Segment interface
checkResult(pSequence->QueryInterface(IID_IAAFSegment, (void **)&pSegment));
// Get a component interface and
checkResult(pSequence->QueryInterface(IID_IAAFComponent, (void **)&pComponent));
// set the Data definition for it !
checkResult(pComponent->SetDataDef(defs.ddkAAFPicture()));
// Release the component - because we need to reuse the pointer later
pComponent->Release();
pComponent = NULL;
// Create a new Mob Slot that will contain the sequence
aafRational_t editRate = { 0, 1};
checkResult(pMob->AppendNewTimelineSlot(editRate,
pSegment,
1,
L"Transition",
0,
&pNewSlot));
// Create a Filler
checkResult(defs.cdFiller()->
CreateInstance(IID_IAAFFiller,
(IUnknown **) &pFiller));
// Get a component interface
checkResult(pFiller->QueryInterface(IID_IAAFComponent, (void **) &pComponent));
// Set values for the filler
checkResult(pFiller->Initialize(defs.ddkAAFPicture(), fillerLength));
// append the filler to the sequence
checkResult(pSequence->AppendComponent(pComponent));
// Release the component - because we need to reuse the pointer later
pFiller->Release();
pFiller = NULL;
pComponent->Release();
pComponent = NULL;
checkResult(defs.cdTransition()->
CreateInstance(IID_IAAFTransition,
示例6: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar* pFileName)
{
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IEnumAAFContainerDefs *pPlug = NULL;
IAAFDefObject* pDef = NULL;
IAAFContainerDef* pContainerDef = NULL;
bool bFileOpen = false;
HRESULT hr = S_OK;
aafUID_t readUID;
wchar_t testString[256];
try
{
// Open the AAF file
checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
bFileOpen = true;
// Get the AAF file header.
checkResult(pFile->GetHeader(&pHeader));
checkResult(pHeader->GetDictionary(&pDictionary));
checkResult(pDictionary->GetContainerDefs(&pPlug));
while(pPlug->NextOne (&pContainerDef) == AAFRESULT_SUCCESS)
{
checkResult(pContainerDef->QueryInterface (IID_IAAFDefObject, (void **)&pDef));
checkResult(pDef->GetAUID(&readUID));
if(memcmp(&readUID, &testUID, sizeof(aafUID_t)) == 0)
{
checkResult(pDef->GetName (testString, sizeof(testString)));
checkExpression (wcscmp(testString, sName) == 0, AAFRESULT_TEST_FAILED);
aafUInt32 nameLen;
checkResult (pDef->GetNameBufLen (&nameLen));
checkExpression (((wcslen (sName)+1) * sizeof (aafCharacter) == nameLen),
AAFRESULT_TEST_FAILED);
checkResult(pDef->GetDescription (testString, sizeof(testString)));
checkExpression (wcscmp(testString, sDescription) == 0, AAFRESULT_TEST_FAILED);
checkResult (pDef->GetDescriptionBufLen (&nameLen));
checkExpression (((wcslen (sDescription)+1) * sizeof (aafCharacter) == nameLen),
AAFRESULT_TEST_FAILED);
break;
}
pDef->Release();
pDef = NULL;
pContainerDef->Release();
pContainerDef = NULL;
}// checkResult(pPlug->NextOne(&pContainerDef));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pHeader)
pHeader->Release();
if (pPlug)
pPlug->Release();
if (pDef)
pDef->Release();
if (pContainerDef)
pContainerDef->Release();
if (pDictionary)
pDictionary->Release();
if (pFile)
{ // Close file
if (bFileOpen)
pFile->Close();
pFile->Release();
}
return hr;
}
示例7: 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;
//.........这里部分代码省略.........
示例8: 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();
//.........这里部分代码省略.........
示例9: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFMob* pMob = NULL;
IAAFRIFFChunk* pRIFFChunk = NULL;
IAAFRIFFChunk* pRIFFChunk2 = NULL;
IAAFSourceMob* pSourceMob = NULL;
IAAFEssenceDescriptor* pEssDesc = NULL;
IAAFBWFImportDescriptor* pBWFImportDesc = NULL;
aafUInt32 testNum;
HRESULT hr = S_OK;
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the file.
checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
bFileOpen = true;
// We can't really do anthing in AAF without the header.
checkResult(pFile->GetHeader(&pHeader));
// Get the AAF Dictionary so that we can create valid AAF objects.
checkResult(pHeader->GetDictionary(&pDictionary));
CAAFBuiltinDefs defs (pDictionary);
checkResult(defs.cdSourceMob()->
CreateInstance(IID_IAAFSourceMob,
(IUnknown **)&pSourceMob));
pSourceMob->QueryInterface(IID_IAAFMob, (void **)&pMob);
pMob->SetMobID(TEST_MobID);
pMob->SetName(L"BWFImportDescriptorTest");
//Create BWFImportDescriptor to hold the RIFFChunk
checkResult( defs.cdBWFImportDescriptor()->
CreateInstance(IID_IAAFBWFImportDescriptor, (IUnknown **)&pBWFImportDesc));
// Create RIFFChunks and append them to BWFImportDescriptor
checkResult(defs.cdRIFFChunk()->CreateInstance(IID_IAAFRIFFChunk,
(IUnknown **)&pRIFFChunk));
checkResult(defs.cdRIFFChunk()->CreateInstance(IID_IAAFRIFFChunk,
(IUnknown **)&pRIFFChunk2));
checkResult(pBWFImportDesc->AppendUnknownBWFChunk(pRIFFChunk));
checkResult(pBWFImportDesc->AppendUnknownBWFChunk(pRIFFChunk2));
checkExpression(pBWFImportDesc->AppendUnknownBWFChunk(pRIFFChunk)==AAFRESULT_OBJECT_ALREADY_ATTACHED, AAFRESULT_TEST_FAILED);
checkResult(pBWFImportDesc->SetFileSecurityReport(TEST_FileSecurityReport));
checkResult(pBWFImportDesc->SetFileSecurityWave(TEST_FileSecurityWave));
checkResult(pBWFImportDesc->SetCodingHistory(TEST_CodingHistory));
checkResult(pBWFImportDesc->SetBasicData(TEST_BasicData));
checkResult(pBWFImportDesc->SetStartOfModulation(TEST_StartOfModulation));
checkResult(pBWFImportDesc->SetQualityEvent(TEST_QualityEvent));
checkResult(pBWFImportDesc->SetEndOfModulation(TEST_EndOfModulation));
checkResult(pBWFImportDesc->SetQualityParameter(TEST_QualityParameter));
checkResult(pBWFImportDesc->SetOperatorComment(TEST_OperatorComment));
checkResult(pBWFImportDesc->SetCueSheet(TEST_CueSheet));
checkResult( pBWFImportDesc->QueryInterface(IID_IAAFEssenceDescriptor, (void **)&pEssDesc));
checkResult(pSourceMob->SetEssenceDescriptor(pEssDesc));
//Add the MOB to the file
checkResult(pHeader->AddMob(pMob));
testNum = 0;
checkResult(pRIFFChunk->Initialize(chunkID));
checkResult(pRIFFChunk->Write(sizeof(RIFFChunksmiley), (unsigned char *)RIFFChunksmiley, &testNum));
checkExpression(testNum == sizeof(RIFFChunksmiley), AAFRESULT_TEST_FAILED);
testNum = 0;
checkResult(pRIFFChunk2->Initialize(chunkID2));
checkResult(pRIFFChunk2->Write(sizeof(RIFFChunkfrowney), (unsigned char *)RIFFChunkfrowney, &testNum));
checkExpression(testNum == sizeof(RIFFChunkfrowney), AAFRESULT_TEST_FAILED);
pFile->Save();
pEssDesc->Release();
pEssDesc = NULL;
pBWFImportDesc->Release();
pBWFImportDesc = NULL;
pRIFFChunk->Release();
pRIFFChunk = NULL;
pRIFFChunk2->Release();
pRIFFChunk2 = NULL;
pMob->Release();
pMob = NULL;
pSourceMob->Release();
pSourceMob = NULL;
//.........这里部分代码省略.........
示例10: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar* pFileName)
{
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IEnumAAFOperationDefs *pEffectEnum = NULL;
IEnumAAFOperationDefs *pDegradeEnum = NULL;
IEnumAAFParameterDefs *pParmDefEnum = NULL;
IAAFOperationDef *pOperationDef = NULL;
IAAFParameterDef *pParmDef = NULL;
IAAFDefObject* pDefObject = NULL;
bool bFileOpen = false;
IAAFDataDefSP pReadDataDef;
aafBool readIsTimeWarp;
aafInt32 checkNumInputs;
aafUInt32 checkBypass;
HRESULT hr = S_OK;
wchar_t checkName[256];
aafUID_t checkCat;
aafBool bResult = kAAFFalse;
try
{
// Open the AAF file
checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
bFileOpen = true;
// Get the AAF file header.
checkResult(pFile->GetHeader(&pHeader));
checkResult(pHeader->GetDictionary(&pDictionary));
CAAFBuiltinDefs defs (pDictionary);
checkResult(pDictionary->GetOperationDefs(&pEffectEnum));
checkResult(pEffectEnum->NextOne (&pOperationDef));
checkResult(pOperationDef->GetDataDef(&pReadDataDef));
checkResult(pOperationDef->QueryInterface(IID_IAAFDefObject, (void **) &pDefObject));
checkResult(pDefObject->GetName (checkName, sizeof(checkName)));
checkExpression(wcscmp(checkName, effectNames[0]) == 0, AAFRESULT_TEST_FAILED);
checkResult(pDefObject->GetDescription (checkName, sizeof(checkName)));
checkExpression(wcscmp(checkName, effectDesc[0]) == 0, AAFRESULT_TEST_FAILED);
pDefObject->Release();
pDefObject = NULL;
checkResult(pReadDataDef->IsDataDefOf(defs.ddkAAFPicture(), &bResult));
checkExpression(bResult == kAAFTrue, AAFRESULT_TEST_FAILED);
checkResult(pOperationDef->IsTimeWarp (&readIsTimeWarp));
checkExpression(readIsTimeWarp == kAAFFalse, AAFRESULT_TEST_FAILED);
checkResult(pOperationDef->GetCategory (&checkCat));
checkExpression(memcmp(&checkCat, &TEST_CATEGORY, sizeof(aafUID_t)) == 0, AAFRESULT_TEST_FAILED);
checkResult(pOperationDef->GetBypass (&checkBypass));
checkExpression(checkBypass == TEST_BYPASS, AAFRESULT_TEST_FAILED);
checkResult(pOperationDef->GetNumberInputs (&checkNumInputs));
checkExpression(checkNumInputs == TEST_NUM_INPUTS, AAFRESULT_TEST_FAILED);
checkResult(pOperationDef->GetParameterDefs (&pParmDefEnum));
checkResult(pParmDefEnum->NextOne (&pParmDef));
checkResult(pParmDef->QueryInterface(IID_IAAFDefObject, (void **) &pDefObject));
checkResult(pDefObject->GetName (checkName, sizeof(checkName)));
checkExpression(wcscmp(checkName, TEST_PARAM_NAME) == 0, AAFRESULT_TEST_FAILED);
checkResult(pDefObject->GetDescription (checkName, sizeof(checkName)));
checkExpression(wcscmp(checkName, TEST_PARAM_DESC) == 0, AAFRESULT_TEST_FAILED);
pDefObject->Release();
pDefObject = NULL;
checkResult(pOperationDef->GetDegradeToOperations (&pDegradeEnum));
pOperationDef->Release();
pOperationDef = NULL;
// Check for prepended one first
checkResult(pDegradeEnum->NextOne (&pOperationDef));
checkResult(pOperationDef->QueryInterface(IID_IAAFDefObject, (void **) &pDefObject));
checkResult(pDefObject->GetName (checkName, sizeof(checkName)));
checkExpression(wcscmp(checkName, effectNames[2]) == 0, AAFRESULT_TEST_FAILED);
checkResult(pDefObject->GetDescription (checkName, sizeof(checkName)));
checkExpression(wcscmp(checkName, effectDesc[2]) == 0, AAFRESULT_TEST_FAILED);
pDefObject->Release();
pDefObject = NULL;
pOperationDef->Release();
pOperationDef = NULL;
// Check for appended one second
checkResult(pDegradeEnum->NextOne (&pOperationDef));
checkResult(pOperationDef->QueryInterface(IID_IAAFDefObject, (void **) &pDefObject));
checkResult(pDefObject->GetName (checkName, sizeof(checkName)));
checkExpression(wcscmp(checkName, effectNames[1]) == 0, AAFRESULT_TEST_FAILED);
checkResult(pDefObject->GetDescription (checkName, sizeof(checkName)));
checkExpression(wcscmp(checkName, effectDesc[1]) == 0, AAFRESULT_TEST_FAILED);
pDefObject->Release();
pDefObject = NULL;
pOperationDef->Release();
pOperationDef = NULL;
}
catch (HRESULT& rResult)
{
hr = rResult;
}
//.........这里部分代码省略.........
示例11: 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;
}
示例12: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFSourceMob* pSourceMob = NULL;
IAAFMob* pMob = NULL;
IAAFDataEssenceDescriptor* pDataEssenceDesc = NULL;
IAAFEssenceDescriptor* pEssDesc = NULL;
HRESULT hr = AAFRESULT_SUCCESS;
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the AAF file
checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
// 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));
// Create a source mob
CAAFBuiltinDefs defs (pDictionary);
checkResult(defs.cdSourceMob()->
CreateInstance(IID_IAAFSourceMob,
(IUnknown **)&pSourceMob));
checkResult(pSourceMob->QueryInterface(IID_IAAFMob, (void **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
RegisterDataEssenceDescriptorTest( pDictionary );
checkResult(pMob->SetName(L"DataEssenceDescriptorTest"));
checkResult( pDictionary->CreateInstance( TestDataEssenceDescriptorClassID,
IID_IAAFDataEssenceDescriptor,
(IUnknown**)&pDataEssenceDesc ) );
aafUID_t dataEssenceCoding;
memset(&dataEssenceCoding, 0, sizeof(aafUID_t));
checkResult(pDataEssenceDesc->SetDataEssenceCoding(dataEssenceCoding));
checkResult(pDataEssenceDesc->QueryInterface(IID_IAAFEssenceDescriptor, (void **)&pEssDesc));
checkResult(pSourceMob->SetEssenceDescriptor(pEssDesc));
// Add the MOB to the file
checkResult(pHeader->AddMob(pMob));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pEssDesc)
pEssDesc->Release();
if (pDataEssenceDesc)
pDataEssenceDesc->Release();
if (pMob)
pMob->Release();
if (pSourceMob)
pSourceMob->Release();
if (pDictionary)
pDictionary->Release();
if (pHeader)
pHeader->Release();
if (pFile)
{
pFile->Save();
pFile->Close();
pFile->Release();
}
return hr;
}
示例13: 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));
//.........这里部分代码省略.........
示例14: 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)
//.........这里部分代码省略.........
示例15: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile* pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFOperationDef* pOperationDef = NULL;
IAAFParameterDef* pParamDef = NULL;
IAAFDefObject* pDefObject = NULL;
IAAFOperationGroup *pOperationGroup = NULL;
IAAFMob *pMob = NULL;
IAAFSegment *pSeg = NULL;
IAAFTimelineMobSlot *pSlot = NULL;
IAAFParameter *pParm = NULL;
IAAFVaryingValue *pVaryingValue = NULL;
IAAFSegment *pFiller = NULL;
IAAFComponent *pComponent = NULL;
IAAFSourceClip *pSourceClip = NULL;
IAAFControlPoint *pControlPoint = NULL;
IAAFSourceReference *pSourceRef = NULL;
IAAFInterpolationDef *pInterpDef = NULL;
IAAFPluginManager *pMgr = NULL;
IAAFTypeDef *pTypeDef = NULL;
bool bFileOpen = false;
HRESULT hr = S_OK;
// aafUID_t testInterpDef = kAAFTypeID_Rational;
aafLength_t effectLen = TEST_EFFECT_LEN;
aafUID_t effectID = kTestEffectID;
aafUID_t parmID = kTestParmID;
aafRational_t testLevel1 = kTestLevel1;
aafRational_t testLevel2 = kTestLevel2;
aafRational_t testTime1 = kTestTime1;
aafRational_t testTime2 = kTestTime2;
/* long test;
*/
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the AAF file
checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
bFileOpen = true;
// Get the AAF file header.
checkResult(pFile->GetHeader(&pHeader));
// Get the AAF Dictionary so that we can create valid AAF objects.
checkResult(pHeader->GetDictionary(&pDictionary));
CAAFBuiltinDefs defs (pDictionary);
checkResult(defs.cdOperationDef()->
CreateInstance(IID_IAAFOperationDef,
(IUnknown **)&pOperationDef));
checkResult(defs.cdParameterDef()->
CreateInstance(IID_IAAFParameterDef,
(IUnknown **)&pParamDef));
checkResult(pDictionary->LookupTypeDef (kAAFTypeID_Rational, &pTypeDef));
checkResult(pParamDef->Initialize (parmID, TEST_PARAM_NAME, TEST_PARAM_DESC, pTypeDef));
checkResult(AAFGetPluginManager(&pMgr));
checkResult(pMgr->CreatePluginDefinition(LinearInterpolator, pDictionary, &pDefObject));
checkResult(pDefObject->QueryInterface(IID_IAAFInterpolationDef, (void **) &pInterpDef));
pDefObject->Release();
pDefObject = NULL;
checkResult(pOperationDef->Initialize (effectID, TEST_EFFECT_NAME, TEST_EFFECT_DESC));
checkResult(pDictionary->RegisterOperationDef (pOperationDef));
checkResult(pDictionary->RegisterParameterDef (pParamDef));
checkResult(pDictionary->RegisterInterpolationDef (pInterpDef));
checkResult(pOperationDef->SetDataDef (defs.ddkAAFPicture()));
checkResult(pOperationDef->SetIsTimeWarp (kAAFFalse));
checkResult(pOperationDef->SetNumberInputs (TEST_NUM_INPUTS));
checkResult(pOperationDef->SetCategory (TEST_CATEGORY));
checkResult(pOperationDef->AddParameterDef (pParamDef));
checkResult(pOperationDef->SetBypass (TEST_BYPASS));
checkResult(pParamDef->SetDisplayUnits(TEST_PARAM_UNITS));
//Make the first mob
long test;
aafRational_t videoRate = { 2997, 100 };
// Create a Mob
checkResult(defs.cdCompositionMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult(pMob->SetName(L"AAFOperationGroupTest"));
// Add some slots
//.........这里部分代码省略.........