本文整理汇总了C++中IAAFSegment类的典型用法代码示例。如果您正苦于以下问题:C++ IAAFSegment类的具体用法?C++ IAAFSegment怎么用?C++ IAAFSegment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IAAFSegment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateAAFFile
static HRESULT CreateAAFFile(aafWChar * pFileName, long int N)
{
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFMob* pMob = NULL;
IAAFMob* pCompMob = NULL;
IAAFEssenceDescriptor* aDesc = NULL;
IAAFMasterMob* pMasterMob = NULL;
IAAFSourceMob* pFileMob = NULL;
IAAFSourceMob* pTapeMob = NULL;
IAAFSequence* pSequence = NULL;
IAAFComponent* aComponent = NULL;
IAAFFileDescriptor* pFileDesc = NULL;
IAAFAIFCDescriptor* pAIFCDesc = NULL;
IAAFTapeDescriptor* pTapeDesc = NULL;
IAAFTimelineMobSlot* newSlot = NULL;
IAAFSegment* seg = NULL;
IAAFSourceClip* fileSclp = NULL;
IAAFSourceClip* masterSclp = NULL;
IAAFSourceClip* compSclp = NULL;
IAAFComponent* compFill = NULL;
IAAFLocator* pLocator = NULL;
IAAFNetworkLocator* pNetLocator = NULL;
IAAFClassDef * pCDCompositionMob = 0;
IAAFClassDef * pCDSequence = 0;
IAAFClassDef * pCDSourceMob = 0;
IAAFClassDef * pCDTapeDescriptor = 0;
IAAFClassDef * pCDAIFCDescriptor = 0;
IAAFClassDef * pCDNetworkLocator = 0;
IAAFClassDef * pCDMasterMob = 0;
IAAFClassDef * pCDSourceClip = 0;
IAAFClassDef * pCDFiller = 0;
IAAFDataDef * pDdefPicture = 0;
aafRational_t videoRate = { 30000, 1001 };
aafMobID_t tapeMobID, fileMobID, masterMobID;
aafTimecode_t tapeTC = { 108000, kAAFTcNonDrop, 30};
aafLength_t fileLen = FILE1_LENGTH;
aafLength_t fillLen = FILL_LENGTH;
aafLength_t segLen = SEG_LENGTH;
aafProductIdentification_t ProductInfo;
long int i = 0;
moduleErrorTmp = S_OK;
// delete any previous test file before continuing...
char chFileName[1000];
convert(chFileName, sizeof(chFileName), pFileName);
remove(chFileName);
aafProductVersion_t v;
v.major = 1;
v.minor = 0;
v.tertiary = 0;
v.patchLevel = 0;
v.type = kAAFVersionUnknown;
ProductInfo.companyName = companyName;
ProductInfo.productName = productName;
ProductInfo.productVersion = &v;
ProductInfo.productVersionString = NULL;
ProductInfo.productID = NIL_UID;
ProductInfo.platform = NULL;
#if defined(USE_MEMORY_FILE)
check(MemoryFileOpenNewModify (0, &ProductInfo, &pFile));
#else
check(AAFFileOpenNewModifyEx (pFileName, &kAAFFileKind_Aaf4KBinary, 0, &ProductInfo, &pFile));
#endif
check(pFile->GetHeader(&pHeader));
// Get the AAF Dictionary so that we can create valid AAF objects.
check(pHeader->GetDictionary(&pDictionary));
check(pDictionary->LookupClassDef(AUID_AAFCompositionMob,
&pCDCompositionMob));
check(pDictionary->LookupClassDef(AUID_AAFSequence,
&pCDSequence));
check(pDictionary->LookupClassDef(AUID_AAFSourceMob,
&pCDSourceMob));
check(pDictionary->LookupClassDef(AUID_AAFTapeDescriptor,
&pCDTapeDescriptor));
check(pDictionary->LookupClassDef(AUID_AAFAIFCDescriptor,
&pCDAIFCDescriptor));
check(pDictionary->LookupClassDef(AUID_AAFNetworkLocator,
&pCDNetworkLocator));
check(pDictionary->LookupClassDef(AUID_AAFMasterMob,
&pCDMasterMob));
check(pDictionary->LookupClassDef(AUID_AAFSourceClip,
&pCDSourceClip));
check(pDictionary->LookupClassDef(AUID_AAFFiller,
&pCDFiller));
check(pDictionary->LookupDataDef(kAAFDataDef_Picture,
&pDdefPicture));
// IMPORTANT: major remodification is from this point onwards...
// sequence creation code pulled out of the subsequent loop.
// Create a Composition Mob
//.........这里部分代码省略.........
示例2: 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));
//.........这里部分代码省略.........
示例3: assert
void EventTest::CreateEvent()
{
assert(_pHeader && _pDictionary);
HRESULT hr = S_OK;
IAAFEvent *pEvent = NULL;
IAAFEventMobSlot *pEventMobSlot = NULL;
IAAFSegment *pSegment = NULL;
IAAFMobSlot *pMobSlot = NULL;
IAAFDataDef *pDataDef = NULL;
IAAFComponent *pComp = NULL;
IAAFMob *pMob = NULL;
CAAFBuiltinDefs defs (_pDictionary);
try
{
// not already in dictionary
checkResult(defs.cdDataDef()->
CreateInstance (IID_IAAFDataDef,
(IUnknown **)&pDataDef));
hr = pDataDef->Initialize (kAAFDataDef_Test, L"Test", L"Test data");
hr = _pDictionary->RegisterDataDef (pDataDef);
// Create a concrete subclass of event
checkResult(defs.cdCommentMarker()->
CreateInstance(IID_IAAFEvent,
(IUnknown **)&pEvent));
checkResult(pEvent->SetPosition(_position));
checkResult(pEvent->SetComment(const_cast<wchar_t*>(_eventComment)));
checkResult(pEvent->QueryInterface(IID_IAAFComponent, (void **)&pComp));
checkResult(pComp->SetDataDef(pDataDef));
pComp->Release();
pComp = NULL;
// Get the segment inteface to the event to install into the mob slot.
checkResult(pEvent->QueryInterface(IID_IAAFSegment, (void **)&pSegment));
// Create and initialize an EventMobSlot
checkResult(defs.cdEventMobSlot()->
CreateInstance(IID_IAAFEventMobSlot,
(IUnknown **)&pEventMobSlot));
checkResult(pEventMobSlot->SetEditRate(const_cast<aafRational_t *>(&_editRate)));
// Get the mob slot interface so that we can add the event segment.
checkResult(pEventMobSlot->QueryInterface(IID_IAAFMobSlot, (void **)&pMobSlot));
// Add the event segment to the event mob slot.
checkResult(pMobSlot->SetSegment(pSegment));
// Create the mob to hold the new event mob slot.
checkResult(defs.cdCompositionMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult(pMob->SetName(L"CompositionMob::Name:Test mob to hold an event mob slot"));
// Append event slot to the composition mob.
checkResult(pMob->AppendSlot(pMobSlot));
// Save the id of the composition mob that contains our test
// event mob slot.
checkResult(pMob->SetMobID(gMobID));
// Attach the mob to the header...
checkResult(_pHeader->AddMob(pMob));
}
catch (HRESULT& rHR)
{
hr = rHR;
// fall through and handle cleanup
}
// Cleanup local references
if (pMob)
{
pMob->Release();
pMob = NULL;
}
if (pDataDef)
{
pDataDef->Release();
pDataDef = NULL;
}
if (pComp)
{
pComp->Release();
pComp = NULL;
}
if (pMobSlot)
{
pMobSlot->Release();
pMobSlot = NULL;
}
if (pEventMobSlot)
{
//.........这里部分代码省略.........
示例4: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
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
//.........这里部分代码省略.........
示例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;
IAAFMob* pMob = NULL;
IAAFTimelineMobSlot* pMobSlot = NULL;
IAAFSequence* pSequence = NULL;
IAAFSegment* pSegment = NULL;
IAAFComponent* pComponent = NULL;
int i;
HRESULT hr = S_OK;
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));
CAAFBuiltinDefs defs (pDictionary);
// Create a Composition Mob
checkResult(defs.cdCompositionMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
checkResult(pMob->SetName(L"EnumAAFDataDefTest"));
// Add mob slot w/ Sequence
checkResult(defs.cdSequence()->
CreateInstance(IID_IAAFSequence,
(IUnknown **)&pSequence));
checkResult(pSequence->Initialize(defs.ddkAAFPicture()));
//
// Add some segments. Need to test failure conditions
// (i.e. starting/ending w/ transition, two trans back
// to bacl).
//
for(i = 0; i < kNumComponents; i++)
{
aafLength_t len = 10;
checkResult(defs.cdFiller()->
CreateInstance(IID_IAAFComponent,
(IUnknown **)&pComponent));
if(i == 0)
{
checkResult(pComponent->SetDataDef(defs.ddkAAFPictureWithMatte()));
}
else
{
checkResult(pComponent->SetDataDef(defs.ddkAAFPicture()));
}
checkResult(pComponent->SetLength(len));
checkResult(pSequence->AppendComponent(pComponent));
pComponent->Release();
pComponent = NULL;
}
checkResult(pSequence->QueryInterface (IID_IAAFSegment, (void **)&pSegment));
aafRational_t editRate = { 0, 1};
checkResult(pMob->AppendNewTimelineSlot(editRate,
pSegment,
1,
L"AAF Test Sequence",
0,
&pMobSlot));
pMobSlot->Release();
pMobSlot = NULL;
pSegment->Release();
pSegment = NULL;
// Add the master mob to the file and cleanup
pHeader->AddMob(pMob);
}
catch (HRESULT& rResult)
{
hr = rResult;
//.........这里部分代码省略.........
示例6: 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)
{
//.........这里部分代码省略.........
示例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: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFMob *pMob = NULL;
IAAFMob *pMob2 = NULL;
IAAFMob2 *pMobInterface2 = NULL;
IAAFTimelineMobSlot *newSlot = NULL;
IAAFStaticMobSlot *newStaticSlot=NULL;
IAAFEventMobSlot *newEventSlot=NULL;
IAAFSegment *seg = NULL;
IAAFSourceClip *sclp = NULL;
IAAFEvent *event=NULL;
IAAFComponent* pComponent = NULL;
IAAFClassDef *pcdEventMeta=NULL;
IAAFClassDef *pcdEvent=NULL;
IAAFClassDef *pcdEventConcrete=NULL;
HRESULT hr = S_OK;
aafNumSlots_t numMobs;
aafUInt32 bufLen = 0;
aafUInt32 bytesRead = 0;
aafUInt32 numComments = 0;
aafUInt32 numFound = 0;
aafWChar name[500];
aafWChar value[500];
IEnumAAFTaggedValues *enumTaggedVal = NULL;
IAAFTaggedValue *taggedVal = NULL;
IAAFMobSlot *mSlot = NULL;
IAAFFiller *filler = NULL;
IAAFKLVData *pKLVData = NULL;
IAAFTypeDef* pBaseType = NULL;
IAAFSourceReference *pSourceRef = NULL;
IAAFTimecode *pTimecode = NULL;
aafTimecode_t timecode;
int i;
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the file.
checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
bFileOpen = true;
// We can't really do anthing in AAF without the header.
checkResult(pFile->GetHeader(&pHeader));
// Get the AAF Dictionary so that we can create valid AAF objects.
checkResult(pHeader->GetDictionary(&pDictionary));
CAAFBuiltinDefs defs (pDictionary);
//Make the first mob
long test;
// Create a concrete subclass of Mob
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult( pMob->QueryInterface(IID_IAAFMob2,(void**)&pMobInterface2));
checkResult(pMob->SetMobID(MOBTestID));
checkExpression(pMob->GetNameBufLen(&bufLen) == AAFRESULT_PROP_NOT_PRESENT, AAFRESULT_TEST_FAILED);
checkExpression(pMob->GetName(name, 0) == AAFRESULT_PROP_NOT_PRESENT, AAFRESULT_TEST_FAILED);
checkExpression(pMob->SetName(NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
checkResult(pMob->SetName(mobName));
checkResult(pMob->SetCreateTime(creationTimeStamp));
checkResult(pMob->SetModTime(modificationTimeStamp));
// Add some slots
for(test = 1; test < 6; test++)
{
checkResult(defs.cdSourceClip()->
CreateInstance(IID_IAAFSourceClip,
(IUnknown **)&sclp));
checkResult(sclp->QueryInterface(IID_IAAFSourceReference, (void **)&pSourceRef));
checkResult(pSourceRef->SetSourceID(MOBTestID3));
checkResult(sclp->QueryInterface(IID_IAAFComponent, (void **)&pComponent));
checkResult(pComponent->SetDataDef(defs.ddkAAFPicture()));
checkResult(sclp->QueryInterface (IID_IAAFSegment, (void **)&seg));
aafRational_t editRate = { 0, 1};
checkResult(pMob->AppendNewTimelineSlot (editRate,
seg,
test+1,
slotNames[test],
0,
&newSlot));
//.........这里部分代码省略.........
示例9: ReadAAFFile
static HRESULT ReadAAFFile(aafWChar * pFileName)
{
IAAFDictionary *pDictionary = NULL;
IAAFFile *pFile = NULL;
bool bFileOpen = false;
IAAFHeader *pHeader = NULL;
IEnumAAFMobs *mobIter = NULL;
IAAFMob *aMob = NULL;
IEnumAAFMobSlots *slotIter = NULL;
IAAFMobSlot *slot = NULL;
aafNumSlots_t numMobs, n, s;
HRESULT hr = S_OK;
aafUInt32 bufLen = 0;
aafUInt32 bytesRead = 0;
aafUInt32 numFound = 0;
aafWChar value[500];
IEnumAAFTaggedValues *enumTaggedVal = NULL;
IAAFTaggedValue *taggedVal = NULL;
aafUID_t testKey;
IEnumAAFKLVData *klvEnum = NULL;
IAAFKLVData *pKLVData = NULL;
IAAFTypeDef* pBaseType = NULL;
IAAFSourceClip *pSourceClip = NULL;
IAAFSourceReference *pSourceRef = NULL;
IAAFSegment *pSegment = NULL;
aafMobID_t sourceID;
int i;
try
{
// Open the file
checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
bFileOpen = true;
// We can't really do anthing in AAF without the header.
checkResult(pFile->GetHeader(&pHeader));
checkResult(pHeader->GetDictionary(&pDictionary));
CAAFBuiltinDefs defs (pDictionary);
checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
checkExpression(1 == numMobs, AAFRESULT_TEST_FAILED);
aafSearchCrit_t criteria;
criteria.searchTag = kAAFNoSearch;
checkResult(pHeader->GetMobs (&criteria, &mobIter));
for(n = 0; n < numMobs; n++)
{
aafWChar name[500], slotName[500];
aafNumSlots_t numSlots;
aafMobID_t mobID;
aafSlotID_t trackID;
aafUInt32 nameBufLen = 0;
checkResult(mobIter->NextOne (&aMob));
// Check GetNameBufLen and GetName
checkExpression(aMob->GetNameBufLen(NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
checkResult(aMob->GetNameBufLen(&nameBufLen));
checkExpression(((wcslen(mobName) + 1) * sizeof(aafCharacter)) == nameBufLen, AAFRESULT_TEST_FAILED);
checkExpression(aMob->GetName (NULL, nameBufLen) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
checkExpression(aMob->GetName (name, 4) == AAFRESULT_SMALLBUF, AAFRESULT_TEST_FAILED);
checkResult(aMob->GetName (name, nameBufLen));
checkExpression (wcscmp(mobName, name) == 0, AAFRESULT_TEST_FAILED);
// Check GetMobID
checkExpression(aMob->GetMobID (NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
checkResult(aMob->GetMobID (&mobID));
checkExpression(memcmp(&MOBTestID, &mobID, sizeof(mobID)) == 0, AAFRESULT_TEST_FAILED);
// Check the time stamps
aafTimeStamp_t created = { {0,0,0}, {0,0,0,0} };
checkExpression(aMob->GetCreateTime(NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
checkResult(aMob->GetCreateTime(&created));
checkTimeStampsAreEqual(creationTimeStamp, created);
aafTimeStamp_t modified = { {0,0,0}, {0,0,0,0} };
checkExpression(aMob->GetModTime(NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
checkResult(aMob->GetModTime(&modified));
checkTimeStampsAreEqual(modificationTimeStamp, modified);
// Check the GetMobInfo data.
memset(&created, 0, sizeof(created));
memset(&modified, 0, sizeof(modified));
checkExpression(aMob->GetMobInfo(NULL, &created,
name, sizeof(name)) == AAFRESULT_NULL_PARAM,
AAFRESULT_TEST_FAILED);
checkExpression(aMob->GetMobInfo(&modified, NULL,
name, sizeof(name)) == AAFRESULT_NULL_PARAM,
AAFRESULT_TEST_FAILED);
checkExpression(aMob->GetMobInfo(&modified, &created,
NULL, sizeof(name)) == AAFRESULT_NULL_PARAM,
AAFRESULT_TEST_FAILED);
checkExpression(aMob->GetMobInfo(&modified, &created,
name, 1) == AAFRESULT_SMALLBUF,
AAFRESULT_TEST_FAILED);
checkResult(aMob->GetMobInfo(&modified, &created, name, sizeof(name)));
checkTimeStampsAreEqual(creationTimeStamp, created);
//.........这里部分代码省略.........
示例10: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFMob *pMob = NULL;
IAAFMob* pRMob = NULL;
IAAFMasterMob* pReferencedMob = NULL;
IAAFCompositionMob* pCompMob = NULL;
IAAFTimelineMobSlot *newSlot = NULL;
IAAFSegment *seg = NULL;
IAAFSourceClip *sclp = NULL;
HRESULT hr = S_OK;
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the file.
checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
bFileOpen = true;
// We can't really do anthing in AAF without the header.
checkResult(pFile->GetHeader(&pHeader));
// Get the AAF Dictionary so that we can create valid AAF objects.
checkResult(pHeader->GetDictionary(&pDictionary));
CAAFBuiltinDefs defs (pDictionary);
//Make the first mob
long test;
// Create a Composition Mob
checkResult(defs.cdCompositionMob()->
CreateInstance(IID_IAAFCompositionMob,
(IUnknown **)&pCompMob));
checkResult(pCompMob->QueryInterface(IID_IAAFMob, (void **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
checkResult(pMob->SetName(L"AAFTaggedValuesTest"));
// append a comment to this mob !!
checkResult(pMob->AppendComment(const_cast<aafWChar*>(TagNames), Comments));
checkResult(pMob->AppendComment(const_cast<aafWChar*>(TagNames), AltComment));
// Create a master mob to be referenced
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMasterMob,
(IUnknown **)&pReferencedMob));
checkResult(pReferencedMob->QueryInterface(IID_IAAFMob, (void **)&pRMob));
checkResult(pRMob->SetMobID(TEST_referencedMobID));
checkResult(pRMob->SetName(L"AAFTaggedValueTest::ReferencedMob"));
// Add some slots
for(test = 0; test < 5; test++)
{
checkResult(defs.cdSourceClip()->
CreateInstance(IID_IAAFSourceClip,
(IUnknown **)&sclp));
// Set the properties for the SourceClip
sourceRef.sourceID = TEST_referencedMobID;
sourceRef.sourceSlotID = 0;
sourceRef.startTime = 0;
IAAFDataDefSP pDataDef;
checkResult(pDictionary->LookupDataDef(*slotDDefs[test], &pDataDef));
checkResult(sclp->Initialize(pDataDef, slotsLength[test], sourceRef));
checkResult(sclp->QueryInterface (IID_IAAFSegment, (void **)&seg));
aafRational_t editRate = { 0, 1};
checkResult(pMob->AppendNewTimelineSlot (editRate,
seg,
test+1,
slotNames[test],
0,
&newSlot));
newSlot->Release();
newSlot = NULL;
seg->Release();
seg = NULL;
sclp->Release();
sclp = NULL;
}
// Add the mob to the file.
checkResult(pHeader->AddMob(pMob));
checkResult(pHeader->AddMob(pRMob));
}
catch (HRESULT& rResult)
//.........这里部分代码省略.........
示例11: 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;
IAAFComponent* pComponent = NULL;
IAAFDescriptiveClip* pDescClip = NULL;
bool bFileOpen = false;
HRESULT hr = AAFRESULT_SUCCESS;
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the file
checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
bFileOpen = true;
// We can't really do anthing in AAF without the header.
checkResult(pFile->GetHeader(&pHeader));
// Get the AAF Dictionary so that we can create valid AAF objects.
checkResult(pHeader->GetDictionary(&pDictionary));
CAAFBuiltinDefs defs (pDictionary);
//Make the MOB to be referenced
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pReferencedMob));
checkResult(pReferencedMob->SetMobID(TEST_referencedMobID));
checkResult(pReferencedMob->SetName(L"AAFDescriptiveClipTest::ReferencedMob"));
// Create a Mob
checkResult(defs.cdCompositionMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
checkResult(pMob->SetName(L"AAFDescriptiveClipTest"));
// Create a DescriptiveClip
checkResult(defs.cdDescriptiveClip()->
CreateInstance(IID_IAAFDescriptiveClip,
(IUnknown **)&pDescClip));
checkResult(pDescClip->QueryInterface(IID_IAAFComponent, (void **)&pComponent));
checkResult(pComponent->SetDataDef(defs.ddkAAFSound()));
pComponent->Release();
pComponent = NULL;
// Set the properties for the SourceClip
//checkResult(pDescClip->SetFade( fadeInLen, fadeInType, fadeOutLen, fadeOutType));
sourceRef.sourceID = TEST_referencedMobID;
sourceRef.sourceSlotID = 0;
sourceRef.startTime = 0;
checkResult(pDescClip->Initialize(defs.ddkAAFSound(), 1000, sourceRef));
// Get described slots - should not be present.
aafUInt32 size = 0;
AAFRESULT hr = pDescClip->CountDescribedSlotIDs( &size );
checkExpression( AAFRESULT_PROP_NOT_PRESENT == hr, AAFRESULT_TEST_FAILED );
// Set/Get single described slot id
aafUInt32 setSingleDescribedSlotID = 0xdeadbeef;
checkResult( pDescClip->AddDescribedSlotID( setSingleDescribedSlotID ) );
aafUInt32 getSingleDescribedSlotID = 0;
checkResult( pDescClip->GetDescribedSlotIDs( 1, &getSingleDescribedSlotID ) );
checkExpression( setSingleDescribedSlotID == getSingleDescribedSlotID, AAFRESULT_TEST_FAILED );
// Clear the ID set for the next test
checkResult( pDescClip->RemoveDescribedSlotID( setSingleDescribedSlotID ) );
// Set the persistent described slots.
for( aafUInt32 i_tid = 0; i_tid < TestDescribedSlotIDsVectorSize; ++i_tid )
{
checkResult( pDescClip->AddDescribedSlotID( TestDescribedSlotIDsVector[i_tid] ) );
}
aafUInt32 getDescribedSlotIDsVector[TestDescribedSlotIDsVectorSize];
checkResult( pDescClip->GetDescribedSlotIDs( TestDescribedSlotIDsVectorSize, getDescribedSlotIDsVector ) );
checkExpression( 0 == memcmp( getDescribedSlotIDsVector, TestDescribedSlotIDsVector, sizeof(TestDescribedSlotIDsVector) ),
AAFRESULT_TEST_FAILED );
checkResult(pDescClip->QueryInterface (IID_IAAFSegment, (void **)&seg));
aafRational_t editRate = { 0, 1};
checkResult(pMob->AppendNewTimelineSlot (editRate,
seg,
1,
slotName,
//.........这里部分代码省略.........
示例12: 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)
//.........这里部分代码省略.........
示例13: 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);
//.........这里部分代码省略.........
示例14: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFMob *pMob = NULL;
IAAFMobSlot *newSlot = NULL;
IAAFSegment *seg = NULL;
IAAFSourceClip *sclp = NULL;
IAAFComponent *pComp = NULL;
HRESULT hr = S_OK;
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the file.
checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
bFileOpen = true;
// We can't really do anthing in AAF without the header.
checkResult(pFile->GetHeader(&pHeader));
// Get the AAF Dictionary so that we can create valid AAF objects.
checkResult(pHeader->GetDictionary(&pDictionary));
CAAFBuiltinDefs defs (pDictionary);
//Make the first mob
long test;
// Create a concrete subclass of Mob
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
checkResult(pMob->SetName(L"MOBTest"));
// Add some slots
for(test = 0; test < 5; test++)
{
checkResult(defs.cdSourceClip()->
CreateInstance(IID_IAAFSourceClip,
(IUnknown **)&sclp));
checkResult(sclp->QueryInterface (IID_IAAFComponent, (void **)&pComp));
checkResult(pComp->SetDataDef (defs.ddkAAFPicture()));
pComp->Release();
pComp = NULL;
checkResult(sclp->QueryInterface (IID_IAAFSegment, (void **)&seg));
// Create a concrete subclass of MobSlot
checkResult(defs.cdStaticMobSlot()->
CreateInstance(IID_IAAFMobSlot,
(IUnknown **)&newSlot));
checkResult(newSlot->SetSegment(seg));
checkResult(newSlot->SetSlotID(test+1));
checkResult(newSlot->SetPhysicalNum(test+2));
checkResult(newSlot->SetName(slotNames[test]));
checkResult(pMob->AppendSlot (newSlot));
newSlot->Release();
newSlot = NULL;
seg->Release();
seg = NULL;
sclp->Release();
sclp = NULL;
}
// Add the mob to the file.
checkResult(pHeader->AddMob(pMob));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (newSlot)
newSlot->Release();
if (seg)
seg->Release();
if (sclp)
sclp->Release();
if (pComp)
pComp->Release();
//.........这里部分代码省略.........
示例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
//.........这里部分代码省略.........