本文整理汇总了C++中IAAFSegment::QueryInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ IAAFSegment::QueryInterface方法的具体用法?C++ IAAFSegment::QueryInterface怎么用?C++ IAAFSegment::QueryInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAAFSegment
的用法示例。
在下文中一共展示了IAAFSegment::QueryInterface方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar * pFileName)
{
// IAAFSession * pSession = NULL;
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IEnumAAFMobs* pMobIter = NULL;
IEnumAAFMobSlots* pEnum = NULL;
IAAFMob* pMob = NULL;
IAAFMobSlot* pMobSlot = NULL;
IAAFSegment* pSegment = NULL;
IAAFSequence* pSequence = NULL;
IAAFTransition* pTransition = NULL;
IAAFComponent* pComponent = NULL;
IAAFFiller* pFiller = NULL;
IAAFOperationGroup* pOperationGroup = NULL;
IEnumAAFComponents* pCompIter = NULL;
aafLength_t transitionLength;
aafPosition_t cutPoint;
aafNumSlots_t numMobs;
aafUInt32 numComponents = 0;
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));
// Get the number of mobs in the file (should be one)
checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
checkExpression(1 == numMobs, AAFRESULT_TEST_FAILED);
checkResult(pHeader->GetMobs( NULL, &pMobIter));
while (AAFRESULT_SUCCESS == pMobIter->NextOne(&pMob))
{
checkResult(pMob->GetSlots (&pEnum));
while (AAFRESULT_SUCCESS == pEnum->NextOne (&pMobSlot))
{
checkResult(pMobSlot->GetSegment (&pSegment));
// Check to see if Segment is a Sequence
checkResult(pSegment->QueryInterface(IID_IAAFSequence, (void **) &pSequence));
// It is, so get a Component Iterator
checkResult(pSequence->CountComponents(&numComponents));
// Verify that all 3 components(Filler, Transition, Filler) are present
checkExpression(numComponents == 3, AAFRESULT_TEST_FAILED);
checkResult(pSequence->GetComponents(&pCompIter));
// Now visit each and every one of the components.
while(AAFRESULT_SUCCESS == pCompIter->NextOne(&pComponent))
{
// Find out what kind of segment we have
if ((pComponent->QueryInterface(IID_IAAFTransition, (void **)&pTransition)) == AAFRESULT_SUCCESS)
{
// This is the transition
checkResult(pTransition->GetCutPoint (&cutPoint));
checkResult(pComponent->GetLength(&transitionLength));
checkResult(pTransition->GetOperationGroup(&pOperationGroup));
// Check results !!
checkExpression(cutPoint == 0, AAFRESULT_TEST_FAILED);
checkExpression(transitionLength == 100, AAFRESULT_TEST_FAILED);
pTransition->Release();
pTransition = NULL;
}
else
{
// validate that the other segments are Fillers
checkResult(pComponent->QueryInterface(IID_IAAFFiller, (void **)&pFiller));
pFiller->Release();
pFiller = NULL;
}
pComponent->Release();
pComponent = NULL;
}
pSegment->Release();
pSegment = NULL;
pSequence->Release();
pSequence = NULL;
pCompIter->Release();
pCompIter = NULL;
}
pMob->Release();
pMob = NULL;
}
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pTransition)
pTransition->Release();
//.........这里部分代码省略.........
示例2: 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();
//.........这里部分代码省略.........
示例3: 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;
IAAFCompositionMob* pCompMob=NULL;
IAAFMob* pMob = NULL;
IAAFTimelineMobSlot* pNewSlot = NULL;
IAAFSourceClip* pSourceClip = NULL;
IAAFSourceReference* pSourceRef = NULL;
IAAFTransition* pTransition = NULL;
IAAFOperationGroup* pOperationGroup = NULL;
IAAFSegment* pSegment = NULL;
IAAFSegment* pEffectFiller = NULL;
IAAFComponent* pComponent = NULL;
IAAFFiller* pFiller = NULL;
IAAFSequence* pSequence = NULL;
IAAFOperationDef* pOperationDef = NULL;
IAAFParameter *pParm = NULL;
IAAFParameterDef* pParamDef = NULL;
IAAFConstantValue* pConstantValue = NULL;
HRESULT hr = S_OK;
aafLength_t transitionLength;
aafPosition_t cutPoint = 0;
aafLength_t effectLen = TEST_EFFECT_LEN;
aafUID_t effectID = kTestEffectID;
aafUID_t parmID = kTestParmID;
transitionLength = 100;
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);
// Create the effect and parameter definitions
checkResult(defs.cdOperationDef()->
CreateInstance(IID_IAAFOperationDef,
(IUnknown **)&pOperationDef));
checkResult(defs.cdParameterDef()->
CreateInstance(IID_IAAFParameterDef,
(IUnknown **)&pParamDef));
checkResult(pOperationDef->Initialize (effectID, TEST_EFFECT_NAME, TEST_EFFECT_DESC));
checkResult(pDictionary->RegisterOperationDef(pOperationDef));
checkResult(pParamDef->Initialize (parmID, TEST_PARAM_NAME, TEST_PARAM_DESC, defs.tdRational ()));
checkResult(pParamDef->SetDisplayUnits(TEST_PARAM_UNITS));
checkResult(pDictionary->RegisterParameterDef(pParamDef));
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));
// ------------------------------------------------------------
// 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
//.........这里部分代码省略.........
示例4: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar* pFileName)
{
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IEnumAAFOperationDefs *pOperationGroupEnum = NULL;
IEnumAAFParameterDefs *pParmDefEnum = NULL;
IAAFOperationDef *pOperationDef = NULL;
IAAFParameterDef *pParmDef = NULL;
IAAFParameter *pParameter = NULL;
IAAFMetaDefinition* pMetaDefinition = NULL;
IAAFSegment* pSeg = NULL;
IAAFOperationGroup* pOperationGroup = NULL;
IEnumAAFMobs *mobIter = NULL;
IAAFMob* pMob = NULL;
IEnumAAFMobSlots *slotIter = NULL;
IAAFMobSlot* pSlot = NULL;
IAAFFiller* pFill = NULL;
IAAFSourceReference *pSourceRef = NULL;
IEnumAAFControlPoints *pEnumCP = NULL;
IAAFControlPoint *pControlPoint = NULL;
IAAFVaryingValue *pVaryingValue = NULL;
IAAFInterpolationDef *pInterpDef = NULL;
IAAFTypeDef *pTypeDef = NULL;
bool bFileOpen = false;
aafBool readIsTimeWarp;
aafUInt32 testNumSources, testNumParam;
HRESULT hr = S_OK;
aafNumSlots_t s;
aafNumSlots_t numSlots;
aafUInt32 readOverride;
aafBool readValidTransition;
aafRational_t testTime;
aafRational_t sampleValue1 = kTestLevel1, sampleValue2 = kTestLevel2, testValue;
aafRational_t checkTime1 = kTestTime1;
aafRational_t checkTime2 = kTestTime2;
aafEditHint_t checkEditHint;
aafUID_t testInterpDef, checkInterpDef = kAAFTypeID_Rational;
try
{
// Open the AAF file
checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
bFileOpen = true;
// Get the AAF file header.
checkResult(pFile->GetHeader(&pHeader));
aafSearchCrit_t criteria;
criteria.searchTag = kAAFNoSearch;
checkResult(pHeader->GetMobs (&criteria, &mobIter));
checkResult(mobIter->NextOne (&pMob));
checkResult(pMob->GetSlots(&slotIter));
checkResult(pMob->CountSlots (&numSlots));
for(s = 0; s < numSlots; s++)
{
checkResult(slotIter->NextOne (&pSlot));
checkResult(pSlot->GetSegment (&pSeg));
checkResult(pSeg->QueryInterface (IID_IAAFOperationGroup, (void **)&pOperationGroup));
pSeg->Release();
pSeg = NULL;
checkResult(pOperationGroup->CountSourceSegments(&testNumSources));
checkExpression(testNumSources == TEST_NUM_INPUTS, AAFRESULT_TEST_FAILED);
checkResult(pOperationGroup->CountParameters(&testNumParam));
checkExpression(testNumSources == 1, AAFRESULT_TEST_FAILED);
checkResult(pOperationGroup->IsATimeWarp (&readIsTimeWarp));
checkExpression(readIsTimeWarp == kAAFFalse, AAFRESULT_TEST_FAILED);
checkResult(pOperationGroup->GetBypassOverride (&readOverride));
checkExpression(readOverride == 1, AAFRESULT_TEST_FAILED);
checkResult(pOperationGroup->IsValidTranOperation (&readValidTransition));
checkExpression(readValidTransition == kAAFFalse, AAFRESULT_TEST_FAILED);
/**/
checkResult(pOperationGroup->GetInputSegmentAt (0, &pSeg));
checkResult(pSeg->QueryInterface(IID_IAAFFiller, (void **) &pFill));
pFill->Release();
pFill = NULL;
/**/
checkResult(pOperationGroup->LookupParameter (kTestParmID, &pParameter));
checkResult(pParameter->QueryInterface(IID_IAAFVaryingValue, (void **) &pVaryingValue));
/*** Check the VaryingValue methods **/
aafUInt32 testLen, bytesRead;
checkResult(pVaryingValue->GetControlPoints(&pEnumCP));
checkResult(pEnumCP->NextOne(&pControlPoint));
checkResult(pControlPoint->GetValueBufLen (&testLen));
checkExpression(testLen == sizeof(sampleValue1), AAFRESULT_TEST_FAILED);
checkResult(pControlPoint->GetValue (sizeof(sampleValue1), (aafDataBuffer_t)&testValue, &bytesRead));
checkExpression(testValue.numerator == sampleValue1.numerator, AAFRESULT_TEST_FAILED);
checkExpression(testValue.denominator == sampleValue1.denominator, AAFRESULT_TEST_FAILED);
checkExpression(bytesRead == sizeof(sampleValue1), AAFRESULT_TEST_FAILED);
checkResult(pControlPoint->GetTime(&testTime));
checkExpression(testTime.numerator == checkTime1.numerator, AAFRESULT_TEST_FAILED);
checkExpression(testTime.denominator == checkTime1.denominator, AAFRESULT_TEST_FAILED);
//.........这里部分代码省略.........
示例5: 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
//.........这里部分代码省略.........
示例6: OpenEvent
void EventTest::OpenEvent()
{
assert(_pHeader);
HRESULT hr = S_OK;
IAAFMob *pMob = NULL;
IEnumAAFMobSlots *pEnumSlots = NULL;
IAAFMobSlot *pMobSlot = NULL;
IAAFEventMobSlot *pEventMobSlot = NULL;
aafRational_t editRate = {0};
IAAFSegment *pSegment = NULL;
IAAFEvent *pEvent = NULL;
aafPosition_t position;
wchar_t eventComment[128];
try
{
// Get the composition mob that we created to hold the
checkResult(_pHeader->LookupMob(gMobID, &pMob));
// Get the first mob slot and check that it is an event mob slot.
checkResult(pMob->GetSlots(&pEnumSlots));
checkResult(pEnumSlots->NextOne(&pMobSlot));
checkResult(pMobSlot->QueryInterface(IID_IAAFEventMobSlot, (void **)&pEventMobSlot));
checkResult(pEventMobSlot->GetEditRate(&editRate));
checkExpression(0 == memcmp(&editRate, &_editRate, sizeof(editRate)), AAFRESULT_TEST_FAILED);
// Get the event slot's segment and check that it is an event.
checkResult(pMobSlot->GetSegment(&pSegment));
checkResult(pSegment->QueryInterface(IID_IAAFEvent, (void **)&pEvent));
// Now validate the event property values we thought were written to the
// file.
// Validate the position
checkResult(pEvent->GetPosition(&position));
checkExpression(0 == memcmp(&position, &_position, sizeof(position)), AAFRESULT_TEST_FAILED);
// Validate the comment buffer size.
aafUInt32 expectedLen = wcslen(_eventComment) + 1;
aafUInt32 expectedSize = expectedLen * sizeof(wchar_t);
aafUInt32 commentBufSize = 0;
checkResult(pEvent->GetCommentBufLen(&commentBufSize));
checkExpression(commentBufSize == expectedSize, AAFRESULT_TEST_FAILED);
// Validate the event comment.
checkExpression(commentBufSize <= sizeof(eventComment), AAFRESULT_TEST_FAILED);
checkResult(pEvent->GetComment(eventComment, commentBufSize));
checkExpression(0 == memcmp(eventComment, _eventComment, commentBufSize), AAFRESULT_TEST_FAILED);
}
catch (HRESULT& rHR)
{
hr = rHR;
// fall through and handle cleanup
}
// Cleanup local references
if (pEvent)
{
pEvent->Release();
pEvent = NULL;
}
if (pSegment)
{
pSegment->Release();
pSegment = NULL;
}
if (pEventMobSlot)
{
pEventMobSlot->Release();
pEventMobSlot = NULL;
}
if (pMobSlot)
{
pMobSlot->Release();
pMobSlot = NULL;
}
if (pEnumSlots)
{
pEnumSlots->Release();
pEnumSlots = NULL;
}
if (pMob)
{
pMob->Release();
pMob = NULL;
}
// Propogate the error if necessary.
checkResult(hr);
}
示例7: ProcessAAFFile
static HRESULT ProcessAAFFile(const aafWChar * pFileName, testType_t testType)
{
IAAFFile * pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IEnumAAFMobs* pMobIter = NULL;
aafNumSlots_t numMobs, numSlots;
aafSearchCrit_t criteria;
aafMobID_t mobID;
aafWChar namebuf[1204];
const aafWChar* slotName = L"A slot in Composition Mob";
IAAFComponent* pComponent = NULL;
IAAFComponent* aComponent = NULL;
IEnumAAFMobSlots* pMobSlotIter = NULL;
IAAFMobSlot* pMobSlot = NULL;
IAAFTimelineMobSlot* newSlot = NULL;
IAAFSegment* seg = NULL;
IAAFSegment* pSegment = NULL;
IAAFMob* pCompMob = NULL;
IAAFMob* pMob = NULL;
aafPosition_t zeroPos = 0;
IAAFSequence* pAudioSequence = NULL;
IAAFSourceClip* pSourceClip = NULL;
aafLength_t duration;
IAAFTimelineMobSlot* pTimelineMobSlot = NULL;
IAAFClassDef *pCompositionMobDef = NULL;
IAAFClassDef *pSequenceDef = NULL;
IAAFClassDef *pSourceClipDef = NULL;
IAAFDataDef *pSoundDef = NULL;
IAAFDataDef *pDataDef = NULL;
// Set the edit rate information
aafRational_t editRate;
editRate.numerator = 48000;
editRate.denominator = 1;
// Set search condition to true
bool lookingForAudio = true;
// Call the routine (from ExportAudioExample) to make the file for processing
check(CreateAAFFile(pwFileName, NULL, testStandardCalls, &pFile));
/* Get the Header and iterate through the Master Mobs in the existing file */
check(pFile->GetHeader(&pHeader));
check(pHeader->GetDictionary(&pDictionary));
/* Lookup class definitions for the objects we want to create. */
check(pDictionary->LookupClassDef(AUID_AAFCompositionMob, &pCompositionMobDef));
check(pDictionary->LookupClassDef(AUID_AAFSequence, &pSequenceDef));
check(pDictionary->LookupClassDef(AUID_AAFSourceClip, &pSourceClipDef));
/* Lookup any necessary data definitions. */
check(pDictionary->LookupDataDef(kAAFDataDef_Sound, &pSoundDef));
// Get the number of master mobs in the existing file (must not be zero)
check(pHeader->CountMobs(kAAFMasterMob, &numMobs));
if (numMobs != 0)
{
printf("Found %d Master Mobs\n", numMobs);
criteria.searchTag = kAAFByMobKind;
criteria.tags.mobKind = kAAFMasterMob;
check(pHeader->GetMobs(&criteria, &pMobIter));
/* Create a Composition Mob */
check(pCompositionMobDef->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pCompMob));
/* Append the Mob to the Header */
check(pHeader->AddMob(pCompMob));
/* Create a TimelineMobSlot with an audio sequence */
check(pSequenceDef->
CreateInstance(IID_IAAFSequence,
(IUnknown **)&pAudioSequence));
check(pAudioSequence->QueryInterface(IID_IAAFSegment, (void **)&seg));
check(pAudioSequence->QueryInterface(IID_IAAFComponent,
(void **)&aComponent));
check(aComponent->SetDataDef(pSoundDef));
check(pCompMob->AppendNewTimelineSlot(editRate, seg, 1, slotName, zeroPos, &newSlot));
seg->Release();
seg = NULL;
newSlot->Release();
newSlot = NULL;
// This variable is about to be overwritten so we need to release the old interface
aComponent->Release();
aComponent = NULL;
while((AAFRESULT_SUCCESS == pMobIter->NextOne(&pMob)))
{
// Print out information about the Mob
char mobIDstr[256];
char mobName[256];
check(pMob->GetMobID (&mobID));
//.........这里部分代码省略.........
示例8: OpenHTMLClip
void HTMLClipTest::OpenHTMLClip()
{
assert(_pHeader);
HRESULT hr = S_OK;
aafNumSlots_t compositionMobs = 0;
IEnumAAFMobs *pEnumMobs = NULL;
IAAFMob *pReferencingMob = NULL;
IAAFCompositionMob *pCompositionMob = NULL;
aafNumSlots_t mobSlots = 0;
IEnumAAFMobSlots *pEnumSlots = NULL;
IAAFMobSlot *pMobSlot = NULL;
IAAFSegment *pSegment = NULL;
IAAFHTMLClip *pHTMLClip = NULL;
aafUInt32 bufSize = 0;
aafUInt32 actualBufSize = 0;
aafUInt32 actualLength = 0;
wchar_t *pBeginAnchor = NULL;
wchar_t *pEndAnchor = NULL;
IAAFSourceReference *pSourceReference = NULL;
aafMobID_t masterMobID = {0};
IAAFMasterMob *pMasterMob = NULL;
IAAFMob *pReferencedMob = NULL;
try
{
// Get the number of composition mobs in the file (should be one)
checkResult(_pHeader->CountMobs(kAAFCompMob, &compositionMobs));
checkExpression(1 == compositionMobs, AAFRESULT_TEST_FAILED);
// Get the composition mob. There should only be one.
aafSearchCrit_t criteria;
criteria.searchTag = kAAFByMobKind;
criteria.tags.mobKind = kAAFCompMob;
checkResult(_pHeader->GetMobs(&criteria, &pEnumMobs));
checkResult(pEnumMobs->NextOne(&pReferencingMob));
checkResult(pReferencingMob->QueryInterface(IID_IAAFCompositionMob, (void **)&pCompositionMob));
// Get the html clip in the slot. There should be only one.
checkResult(pReferencingMob->CountSlots(&mobSlots));
checkExpression(1 == mobSlots, AAFRESULT_TEST_FAILED);
checkResult(pReferencingMob->GetSlots(&pEnumSlots));
checkResult(pEnumSlots->NextOne(&pMobSlot));
checkResult(pMobSlot->GetSegment(&pSegment));
checkResult(pSegment->QueryInterface(IID_IAAFHTMLClip, (void **)&pHTMLClip));
// Validate the properties...
checkResult(pHTMLClip->GetBeginAnchorBufLen(&bufSize));
actualLength = wcslen(_beginAnchor) + 1;
actualBufSize = actualLength * 2;
checkExpression(bufSize == actualBufSize, AAFRESULT_TEST_FAILED);
pBeginAnchor = new wchar_t[actualLength];
checkExpression(NULL != pBeginAnchor, AAFRESULT_NOMEMORY);
checkResult(pHTMLClip->GetBeginAnchor(pBeginAnchor, actualBufSize));
checkExpression(0 == wcscmp(pBeginAnchor, _beginAnchor), AAFRESULT_TEST_FAILED);
checkResult(pHTMLClip->GetEndAnchorBufLen(&bufSize));
actualLength = wcslen(_endAnchor) + 1;
actualBufSize = actualLength * 2;
checkExpression(bufSize == actualBufSize, AAFRESULT_TEST_FAILED);
pEndAnchor = new wchar_t[actualLength];
checkExpression(NULL != pEndAnchor, AAFRESULT_NOMEMORY);
checkResult(pHTMLClip->GetEndAnchor(pEndAnchor, actualBufSize));
checkExpression(0 == wcscmp(pEndAnchor, _endAnchor), AAFRESULT_TEST_FAILED);
// Attempt to "resolve" the reference and find the master mob.
checkResult(pHTMLClip->QueryInterface(IID_IAAFSourceReference, (void **)&pSourceReference));
checkResult(pSourceReference->GetSourceID(&masterMobID));
checkExpression(0 == memcmp(&masterMobID, &_referencedMobID, sizeof(masterMobID)), AAFRESULT_TEST_FAILED);
checkResult(_pHeader->LookupMob(masterMobID, &pReferencedMob));
checkResult(pReferencedMob->QueryInterface(IID_IAAFMasterMob, (void **)&pMasterMob));
// Use EssenceAccess to read some html essence
// Find the file mob for the html essence.
// Find the corresponding html essence.
// Read some html essence.
}
catch (HRESULT& rHR)
{
hr = rHR;
// fall through and handle cleanup
}
// Cleanup local references
if (pMasterMob)
{
pMasterMob->Release();
pMasterMob = NULL;
}
if (pReferencedMob)
{
pReferencedMob->Release();
pReferencedMob = NULL;
}
if (pSourceReference)
//.........这里部分代码省略.........
示例9: 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)
{
//.........这里部分代码省略.........
示例10: ReadAAFFile
//.........这里部分代码省略.........
{
checkResult(slotIter->NextOne (&slot));
checkResult(slot->GetNameBufLen(&bufLen));
checkResult(slot->GetName (slotName, bufLen));
checkResult(slot->GetSlotID(&trackID));
checkExpression (wcscmp(slotName, slotNames[s]) == 0, AAFRESULT_TEST_FAILED);
checkExpression(trackID == (s+1), AAFRESULT_TEST_FAILED);
slot->Release();
slot = NULL;
bufLen = 0;
trackID = 0;
}
slotIter->Release();
slotIter = NULL;
// GetSlotAt
checkExpression(aMob->GetSlotAt(1, NULL) == AAFRESULT_NULL_PARAM,
AAFRESULT_TEST_FAILED);
checkExpression(aMob->GetSlotAt(9, &slot) == AAFRESULT_BADINDEX,
AAFRESULT_TEST_FAILED);
for (s = 0; s < numSlots; ++s)
{
checkResult(aMob->GetSlotAt(s, &slot));
checkResult(slot->GetNameBufLen(&bufLen));
checkResult(slot->GetName(slotName, bufLen));
checkResult(slot->GetSlotID(&trackID));
checkExpression(wcscmp(slotName, slotNames[s]) == 0, AAFRESULT_TEST_FAILED);
checkExpression(trackID == (s+1), AAFRESULT_TEST_FAILED);
if ( 0 < s && s < 5 ) // These are the SourceClips
{
checkResult(slot->GetSegment(&pSegment));
checkResult(pSegment->QueryInterface (IID_IAAFSourceClip, (void **)&pSourceClip));
checkResult(pSourceClip->QueryInterface (IID_IAAFSourceReference, (void **)&pSourceRef));
checkResult(pSourceRef->GetSourceID(&sourceID));
checkExpression(memcmp(&sourceID, &MOBTestID3, sizeof(aafMobID_t)) == 0,
AAFRESULT_TEST_FAILED);
pSourceRef->Release();
pSourceRef = NULL;
pSourceClip->Release();
pSourceClip = NULL;
pSegment->Release();
pSegment = NULL;
}
slot->Release();
slot = NULL;
bufLen = 0;
trackID = 0;
}
// ChangeRef
checkResult(aMob->ChangeRef(MOBTestID3, MOBTestID4));
for (s = 1; s < 5; ++s) // These are the SourceClips
{
checkResult(aMob->GetSlotAt(s, &slot));
checkResult(slot->GetSegment(&pSegment));
checkResult(pSegment->QueryInterface (IID_IAAFSourceClip, (void **)&pSourceClip));
checkResult(pSourceClip->QueryInterface (IID_IAAFSourceReference, (void **)&pSourceRef));
checkResult(pSourceRef->GetSourceID(&sourceID));
checkExpression(memcmp(&sourceID, &MOBTestID4, sizeof(aafMobID_t)) == 0,
AAFRESULT_TEST_FAILED);
pSourceRef->Release();
pSourceRef = NULL;
示例11: 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;
IAAFDescriptiveClip* pDescClip = 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));
checkResult(pSegment->QueryInterface(IID_IAAFDescriptiveClip, (void **) &pDescClip));
// Get, and test, the described slots from the marker.
aafUInt32 getDescribedSlotIDsVector[TestDescribedSlotIDsVectorSize];
aafUInt32 getDescribedSlotIDsVectorSize = 0;
checkResult( pDescClip->CountDescribedSlotIDs( &getDescribedSlotIDsVectorSize ) );
checkExpression( TestDescribedSlotIDsVectorSize == getDescribedSlotIDsVectorSize, AAFRESULT_TEST_FAILED );
checkExpression( AAFRESULT_SMALLBUF ==
pDescClip->GetDescribedSlotIDs( getDescribedSlotIDsVectorSize-1, getDescribedSlotIDsVector ),
AAFRESULT_TEST_FAILED );
checkResult( pDescClip->GetDescribedSlotIDs( getDescribedSlotIDsVectorSize, getDescribedSlotIDsVector ) );
checkExpression( 0 == memcmp( getDescribedSlotIDsVector, TestDescribedSlotIDsVector, sizeof(TestDescribedSlotIDsVector) ),
AAFRESULT_TEST_FAILED );
pSlot->Release();
pSlot = NULL;
}
pMob->Release();
pMob = NULL;
}
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pReferencedMob)
pReferencedMob->Release();
if (pDescClip)
pDescClip->Release();
if (pSegment)
pSegment->Release();
if (pSlot)
pSlot->Release();
if (pSlotIter)
pSlotIter->Release();
if (pMob)
pMob->Release();
if (pMobIter)
pMobIter->Release();
if (pHeader)
//.........这里部分代码省略.........
示例12: ReadAAFFile
//.........这里部分代码省略.........
// checkExpression(pEnumDataDef->NextOne(&pDataDef) != AAFRESULT_SUCCESS, AAFRESULT_TEST_FAILED);
/* Clone the enumerator, and read one element */
checkResult(pEnumDataDef->Clone(&pCloneEnum));
checkResult(pCloneEnum->Reset());
checkResult(pCloneEnum->NextOne(&pDataDef));
checkResult(pDataDef->IsPictureKind(&testBool));
// checkExpression(testBool == kAAFTrue, AAFRESULT_TEST_FAILED);
checkResult(pDataDef->IsSoundKind(&testBool));
// checkExpression(testBool == kAAFFalse, AAFRESULT_TEST_FAILED);
pDataDef->Release();
pDataDef = NULL;
pCloneEnum->Release();
pCloneEnum = NULL;
// Enumerate over Composition MOBs
criteria.searchTag = kAAFByMobKind;
criteria.tags.mobKind = kAAFCompMob;
checkResult(pHeader->GetMobs(&criteria, &pMobIter));
CAAFBuiltinDefs defs (pDictionary);
while (pMobIter && pMobIter->NextOne(&pMob) == AAFRESULT_SUCCESS)
{
aafNumSlots_t numSlots = 0;
checkResult(pMob->CountSlots(&numSlots));
checkExpression(1 == numSlots, AAFRESULT_TEST_FAILED);
// Enumerate over all MOB slots for this MOB
checkResult(pMob->GetSlots(&pSlotIter));
while (pSlotIter && pSlotIter->NextOne(&pSlot) == AAFRESULT_SUCCESS)
{
aafUInt32 numCpnts;
checkResult(pSlot->GetSegment(&pSegment));
checkResult(pSegment->QueryInterface(IID_IAAFSequence, (void **) &pSequence));
checkResult(pSequence->CountComponents(&numCpnts));
checkExpression(numCpnts == kNumComponents, AAFRESULT_TEST_FAILED);
checkResult(pSequence->GetComponents(&pCompIter));
numCpnts = 0;
index = 0;
while (pCompIter && pCompIter->NextOne(&pComp) == AAFRESULT_SUCCESS)
{
aafBool testBool;
numCpnts++;
checkResult(pComp->GetDataDef(&pDataDef));
checkResult(pDataDef->IsSoundKind(&testBool));
checkExpression(testBool == kAAFFalse, AAFRESULT_TEST_FAILED);
checkResult(pDataDef->IsMatteKind(&testBool));
checkExpression(testBool == kAAFFalse, AAFRESULT_TEST_FAILED);
if(index == 0) // First segment is Picture with Matte, converts to picture
{
checkResult(pDataDef->IsDataDefOf(defs.ddkAAFPictureWithMatte(),
&testBool));
checkExpression(testBool == kAAFTrue, AAFRESULT_TEST_FAILED);
checkResult(pDataDef->IsPictureKind(&testBool));
checkExpression(testBool == kAAFFalse, AAFRESULT_TEST_FAILED);
checkResult(pDataDef->IsPictureWithMatteKind(&testBool));
checkExpression(testBool == kAAFTrue, AAFRESULT_TEST_FAILED);
checkResult(pDataDef->DoesDataDefConvertTo (defs.ddkAAFPicture(), &testBool));
checkExpression(testBool == kAAFTrue, AAFRESULT_TEST_FAILED);
}
else // First segment is Picture, converts from picture with Matte