本文整理汇总了C++中IAAFTypeDef类的典型用法代码示例。如果您正苦于以下问题:C++ IAAFTypeDef类的具体用法?C++ IAAFTypeDef怎么用?C++ IAAFTypeDef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IAAFTypeDef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: r1
//***********************************************************
//
// SetIntegerPropOnObject()
//
// Set an integer property to the AAF object specified by pObj.
// The value of the property is specified in value.
//
// Returns:
//
// On Success: AAFRESULT_SUCCESS
// On Failure: An exception.
//
HRESULT AAFDomainUtils::SetIntegerPropOnObject(IAAFObject* pObj, aafUID_t* pClassID, aafUID_t* pPropID, const aafUID_t* pIntTypeID,
aafMemPtr_t pValue, aafUInt32 ValueSize, IAAFDictionary *dict)
{
AAFCheck hr;
// Create a property value from the supplied value (pValue)
IAAFTypeDef* pTD;
hr = dict->LookupTypeDef(*pIntTypeID, &pTD);
AutoRelease<IAAFTypeDef> r1( pTD );
IAAFTypeDefInt* pTDInt;
hr = pTD->QueryInterface(IID_IAAFTypeDefInt, (void**)&pTDInt);
AutoRelease<IAAFTypeDefInt> r2( pTDInt );
// Now create a property value object with that value.
IAAFPropertyValue* pPV;
hr = pTDInt->CreateValue(pValue, ValueSize, &pPV);
AutoRelease<IAAFPropertyValue> r3( pPV );
// Add the property to the target object.
// Get the class def for the object
IAAFClassDef* pCD;
hr = dict->LookupClassDef(*pClassID, &pCD);
AutoRelease<IAAFClassDef> r4( pCD );
IAAFPropertyDef* pPD;
hr = pCD->LookupPropertyDef(*pPropID, &pPD);
AutoRelease<IAAFPropertyDef> r5( pPD );
// Set the propeter value on the target object
hr = pObj->SetPropertyValue(pPD, pPV);
return AAFRESULT_SUCCESS;
}
示例2: GetObjRefPropFromObject
//***********************************************************
//
// GetObjRefPropFromObject()
//
// Get a object reference property on the AAF object specified
// by pObj. The value of the property is returned in ppObject.
//
// Returns:
//
// On Success: S_OK
// On Failure: A failed HRESULT
//
HRESULT AAFDomainUtils::GetObjRefPropFromObject(IAAFObject* pObj, aafUID_t* pClassID, const aafUID_t* pPropTypeID, aafUID_t* pPropID, IAAFObject** ppObject)
{
IAAFPropertyValue* pPV = NULL;
IAAFClassDef* pCD;
HRESULT hr;
// Get the property value for the target property
hr = _dict->LookupClassDef(*pClassID, &pCD);
if (SUCCEEDED(hr))
{
IAAFPropertyDef* pPD;
hr = pCD->LookupPropertyDef(*pPropID, &pPD);
if (SUCCEEDED(hr))
{
aafBool present = kAAFFalse;
pObj->IsPropertyPresent(pPD, &present);
if (present == kAAFTrue)
hr = pObj->GetPropertyValue(pPD, &pPV);
else
hr = AAFRESULT_PROP_NOT_PRESENT;
pPD->Release();
}
pCD->Release();
}
// Get the property type def from the dictionary to interpret this property value
// and return the resulting object.
if (SUCCEEDED(hr))
{
IAAFTypeDef* pTD;
hr = _dict->LookupTypeDef(*pPropTypeID, &pTD);
if (SUCCEEDED(hr))
{
IAAFTypeDefObjectRef* pTDObjectRef;
hr = pTD->QueryInterface(IID_IAAFTypeDefObjectRef, (void**)&pTDObjectRef);
if (SUCCEEDED(hr))
{
IAAFObject* pTempObj;
hr = pTDObjectRef->GetObject(pPV, IID_IAAFObject, (IUnknown **)&pTempObj);
if (SUCCEEDED(hr))
{
*ppObject = pTempObj;
}
pTDObjectRef->Release();
}
pTD->Release();
}
}
if (pPV) pPV->Release();
return hr;
}
示例3: CreateAndRegisterPositionEnum
//
// Creates a type definition to describe ePosition enumerations, and
// registers it in the dictionary.
//
void CreateAndRegisterPositionEnum (IAAFDictionary * pDict)
{
assert (pDict);
IAAFTypeDef *ptd = NULL;
IAAFTypeDefExtEnum *ptde = NULL;
// Check to see if we are have already been registered.
if (SUCCEEDED(pDict->LookupTypeDef (kTypeID_ePosition, &ptd)))
{
ptd->Release();
ptd = NULL;
return;
}
try
{
// Instantiate a type definition object which will describe ePosition
// extensible enumerations.
check (pDict->CreateMetaInstance (AUID_AAFTypeDefExtEnum,
IID_IAAFTypeDefExtEnum,
(IUnknown**) &ptde));
// Initialize the type definition object with the given name, and to
// be represented by the given AUID. We've already generated an
// auid (kTypeID_ePosition) to represent this type defintion.
check (ptde->Initialize (kTypeID_ePosition,
L"PersonnelPosition"));
// Pre-register a few element values, along with their names. We've
// already generated AUIDs to represent the values (kPosition_XXX).
check (ptde->AppendElement (kPosition_Producer, L"Producer"));
check (ptde->AppendElement (kPosition_Editor, L"Editor"));
check (ptde->AppendElement (kPosition_FloorManager, L"FloorManager"));
check (ptde->AppendElement (kPosition_Actor, L"Actor"));
// Register this type definition in the dictionary. The
// dictionary::RegisterTypeDef() method expects an IAAFTypeDef
// pointer, so we'll QI for that first.
check (ptde->QueryInterface (IID_IAAFTypeDef, (void **)&ptd));
check (pDict->RegisterTypeDef (ptd));
ptd->Release();
ptd=NULL;
ptde->Release();
ptde=NULL;
}
catch (...)
{
// cleanup after error...
if (ptd)
ptd->Release();
if (ptde)
ptde->Release();
throw;
}
}
示例4: CheckMemberTypeEqual
/* throws on error */
static void CheckMemberTypeEqual (IAAFTypeDefRecordSP rec,
int member, IAAFTypeDef *td)
{
IAAFTypeDef * pMemberTd = 0;
checkResult (rec->GetMemberType (member, &pMemberTd));
checkExpression (pMemberTd == td,
AAFRESULT_TEST_FAILED);
pMemberTd->Release ();
}
示例5: testKLVDataDefinitions
void testKLVDataDefinitions(IAAFDictionary *pDictionary, IAAFMob *pMob)
{
IAAFDictionary2 *pDic2 = NULL;
IAAFClassDef *pKLVDataCD = NULL;
IAAFKLVDataDefinition *pKLVDef = NULL;
IAAFKLVData *pKLVData = NULL;
IAAFTypeDef *typeDef = NULL;
IAAFClassDef *pKLVDataDefCD = NULL;
const aafCharacter defName[32] = L"Data Definition Omega";
const aafCharacter defDescription[64] = L"This is a test of the data definition!!!";
static const aafUInt8 blobData[]={ 0x01, 0x02, 0x00, 0x00, 0x03 };
//lookup class definition for KLVData
checkResult(pDictionary->LookupClassDef(AUID_AAFKLVData, &pKLVDataCD));
//Register the KLVKeys
checkResult(pDictionary->LookupTypeDef(kAAFTypeID_UInt8Array, &typeDef));
checkResult(pDictionary->RegisterKLVDataKey(KLVKey_TestData, typeDef));
//Create KLVData and append it to Mob
checkResult(pKLVDataCD->CreateInstance(IID_IAAFKLVData, (IUnknown **)&pKLVData));
checkResult(pKLVData->Initialize(KLVKey_TestData, sizeof(blobData), (aafUInt8 *)blobData));
checkResult(pMob->AppendKLVData(pKLVData));
checkResult( pDictionary->QueryInterface( IID_IAAFDictionary2, reinterpret_cast<void**>(&pDic2) ) );
assert(pDic2);
//lookup class definition for KLVDataDefinition
checkResult(pDictionary->LookupClassDef(AUID_AAFKLVDataDefinition, &pKLVDataDefCD));
//Create KLVDataDef and append it to Dic
checkResult(pKLVDataDefCD->CreateInstance(IID_IAAFKLVDataDefinition, (IUnknown **)&pKLVDef));
checkResult(pKLVDef->Initialize(KLVDef_TestData, defName, defDescription));
checkResult(pDic2->RegisterKLVDataDef(pKLVDef));
//cleanup
pDic2->Release();
pDic2 = NULL;
pKLVDataCD->Release();
pKLVDataCD = NULL;
pKLVDef->Release();
pKLVDef = NULL;
pKLVData->Release();
pKLVData = NULL;
typeDef->Release();
typeDef = NULL;
pKLVDataDefCD->Release();
pKLVDataDefCD = NULL;
}
示例6: SetObjRefPropOnObject
//***********************************************************
//
// SetObjRefPropOnObject()
//
// Set an object reference property on the AAF object specified
// by pObj. The value of the property is specified in pObject.
//
// Returns:
//
// On Success: S_OK
// On Failure: A failed HRESULT
//
HRESULT AAFDomainUtils::SetObjRefPropOnObject(IAAFObject* pObj, aafUID_t* pClassID, const aafUID_t* pPropTypeID, aafUID_t* pPropID, IAAFObject* pValue)
{
IAAFPropertyValue* pPV = NULL;
IAAFTypeDef* pTD;
HRESULT hr;
// Create a property value from the supplied value (pValue)
hr = _dict->LookupTypeDef(*pPropTypeID, &pTD);
if (SUCCEEDED(hr))
{
IAAFTypeDefObjectRef* pTDObjRef;
hr = pTD->QueryInterface(IID_IAAFTypeDefObjectRef, (void**)&pTDObjRef);
if (SUCCEEDED(hr))
{
hr = pTDObjRef->CreateValue(pValue, &pPV);
pTDObjRef->Release();
}
pTD->Release();
}
// Add the property to the target object.
if (SUCCEEDED(hr))
{
if (SUCCEEDED(hr))
{
IAAFClassDef* pCD;
// Get the class def for the object
hr = _dict->LookupClassDef(*pClassID, &pCD);
if (SUCCEEDED(hr))
{
IAAFPropertyDef* pPD;
hr = pCD->LookupPropertyDef(*pPropID, &pPD);
if (SUCCEEDED(hr))
{
// Set the propeter value on the target object
hr = pObj->SetPropertyValue(pPD, pPV);
pPD->Release();
}
pCD->Release();
}
}
}
if (pPV) pPV->Release();
return hr;
}
示例7: GetOneTypeDef
static HRESULT GetOneTypeDef (IAAFDictionary * pDict,
const aafUID_t & id,
IAAFTypeDefInt ** ppTD)
{
assert (pDict);
assert (ppTD);
HRESULT hr = S_OK;
IAAFTypeDef * pTypeDef = NULL;
hr = pDict->LookupTypeDef(id, &pTypeDef);
if (SUCCEEDED(hr))
{
hr = pTypeDef->QueryInterface (IID_IAAFTypeDefInt, (void **) ppTD);
pTypeDef->Release();
}
return hr;
}
示例8: 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);
//.........这里部分代码省略.........
示例9: TestPropertyValue
static HRESULT TestPropertyValue (
testMode_t mode,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
// HRESULT hr = E_FAIL;
long hr = E_FAIL;
const size_t fileNameBufLen = 128;
aafWChar testFileName[ fileNameBufLen ] = L"";
GenerateTestFileName( productID.productName, fileKind, fileNameBufLen, testFileName );
IAAFFile* pFile = NULL;
if(mode == kAAFUnitTestReadWrite)
{
RemoveTestFile (testFileName);
checkResult (CreateTestFile( testFileName, fileKind, rawStorageType, productID, &pFile ));
assert (pFile);
}
else
{
checkResult (AAFFileOpenExistingRead(testFileName, 0, &pFile));
assert (pFile);
}
IAAFHeader * pHeader = NULL;
hr = pFile->GetHeader (&pHeader);
if (! SUCCEEDED (hr)) return hr;
assert (pHeader);
IAAFDictionary * pDict = NULL;
hr = pHeader->GetDictionary (&pDict);
if (! SUCCEEDED (hr)) return hr;
assert (pDict);
CAAFBuiltinDefs defs (pDict);
// Let's try to do something interesting with a type definition
IAAFTypeDefInt * pTypeDef = NULL;
hr = defs.tdInt32()->QueryInterface (IID_IAAFTypeDefInt, (void **) &pTypeDef);
if (! SUCCEEDED (hr)) return hr;
assert (pTypeDef);
if(mode == kAAFUnitTestReadWrite)
{
// Now attempt to create invalid property values; check for errors.
const aafInt32 forty_two = 42;
IAAFPropertyValue * pv = NULL;
// This is what a correct one would look like; we're not ready for that yet:
// hr = pTypeDef->CreateValue (&forty_two, 4, &pv);
// set this to -1 to see if it gets modified
pv = (IAAFPropertyValue *) (-1);
// Try null pVal
hr = pTypeDef->CreateValue (NULL, 4, &pv);
if (AAFRESULT_NULL_PARAM != hr)
return AAFRESULT_TEST_FAILED;
if ((IAAFPropertyValue *)(-1) != pv)
return AAFRESULT_TEST_FAILED;
// Try valSize too large
hr = pTypeDef->CreateValue ((aafMemPtr_t) &forty_two, 8, &pv);
if (AAFRESULT_BAD_SIZE != hr)
return AAFRESULT_TEST_FAILED;
if ((IAAFPropertyValue *)(-1) != pv)
return AAFRESULT_TEST_FAILED;
// Now try correct one
pv = NULL;
hr = pTypeDef->CreateValue ((aafMemPtr_t) &forty_two, 4, &pv);
if (! SUCCEEDED (hr)) return hr;
if (! pv)
return AAFRESULT_TEST_FAILED;
// That one worked; let's try one with a smaller init size (should
// also work)
pv->Release();
pv = NULL;
const aafInt16 fifty_seven = 57;
hr = pTypeDef->CreateValue ((aafMemPtr_t) &fifty_seven, 2, &pv);
if (! SUCCEEDED (hr)) return hr;
if (! pv)
return AAFRESULT_TEST_FAILED;
// cool. Now we should have a good property value whose value is 57.
// check GetType() for error condition
hr = pv->GetType (NULL);
if (AAFRESULT_NULL_PARAM != hr)
return AAFRESULT_TEST_FAILED;
// this GetType() call should work, and return the original type def.
IAAFTypeDef * propType = NULL;
hr = pv->GetType (&propType);
if (! SUCCEEDED (hr)) return hr;
if (! propType)
return AAFRESULT_TEST_FAILED;
// Convert both to IUnknown for comparison
//.........这里部分代码省略.........
示例10: testRestore
static bool testRestore(const wchar_t* fileName)
{
bool passed = true;
IAAFFile* pFile = 0;
IAAFHeader* pHeader = 0;
IAAFDictionary* pDictionary = 0;
IAAFContentStorage* pStorage = 0;
IEnumAAFMobs* pMobs = 0;
IAAFMob* pMob = 0;
try
{
pFile = openFileForReading(fileName);
}
catch (...)
{
return false;
}
try
{
// get the Mob containing the test data
checkResult(pFile->GetHeader(&pHeader));
checkResult(pHeader->GetDictionary(&pDictionary));
checkResult(pHeader->GetContentStorage(&pStorage));
aafSearchCrit_t searchCrit;
searchCrit.searchTag = kAAFByMobKind;
searchCrit.tags.mobKind = kAAFAllMob;
checkResult(pStorage->GetMobs(&searchCrit, &pMobs));
checkResult(pMobs->NextOne(&pMob));
IAAFObject* pObject = 0;
IAAFClassDef* pClassDef = 0;
IAAFPropertyDef* pPropertyDef = 0;
IAAFPropertyValue* pPropertyValue = 0;
IAAFTypeDef* pType = 0;
IAAFTypeDefFixedArray* pFixedArrayType = 0;
IAAFTypeDefInt* pIntType = 0;
IAAFPropertyValue* pIntValue = 0;
try
{
printf(" * Baseline element type: ");
const aafUID_t propId =
{0x00000000,0x0000,0x0000,{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
aafUInt8 testValue[2] = {0,255};
checkResult(pMob->QueryInterface(IID_IAAFObject, (void **)&pObject));
checkResult(pDictionary->LookupClassDef(kAAFClassID_Mob, &pClassDef));
checkResult(pClassDef->LookupPropertyDef(propId, &pPropertyDef));
checkResult(pObject->GetPropertyValue(pPropertyDef, &pPropertyValue));
checkResult(pPropertyValue->GetType(&pType));
checkResult(pType->QueryInterface(IID_IAAFTypeDefFixedArray, (void **)&pFixedArrayType));
release(pType);
checkResult(pFixedArrayType->GetType(&pType));
checkResult(pType->QueryInterface(IID_IAAFTypeDefInt, (void **)&pIntType));
aafUInt8 value[2];
checkResult(pFixedArrayType->GetElementValue(pPropertyValue, 0, &pIntValue));
checkResult(pIntType->GetInteger(pIntValue, &value[0], 1));
release(pIntValue);
checkResult(pFixedArrayType->GetElementValue(pPropertyValue, 1, &pIntValue));
checkResult(pIntType->GetInteger(pIntValue, &value[1], 1));
if (value[0] == testValue[0] && value[1] == testValue[1])
{
printf("passed\n");
}
else
{
printf("FAILED\n");
passed = false;
}
}
catch (...)
{
printf("FAILED\n");
passed = false;
}
release(pIntValue);
release(pIntType);
release(pFixedArrayType);
release(pType);
release(pPropertyValue);
release(pPropertyDef);
release(pClassDef);
release(pObject);
try
{
printf(" * Non-Baseline element type: ");
const aafUID_t propId =
//.........这里部分代码省略.........
示例11: ReadRecordNoStructs
static HRESULT ReadRecordNoStructs (const aafWChar * pFileName, int loadingMode)
{
HRESULT hr = E_FAIL;
HRESULT temphr;
IAAFFileSP pFile;
try
{
// Open the file, and get the dictionary.
checkResult(AAFFileOpenExistingRead(pFileName, loadingMode, &pFile));
IAAFHeaderSP pHeader;
checkResult(pFile->GetHeader(&pHeader));
IAAFDictionarySP pDict;
checkResult (pHeader->GetDictionary(&pDict));
CAAFBuiltinDefs defs(pDict);
// get the SDK version against which we are testing
aafProductVersion_t testVer;
checkResult(pHeader->GetRefImplVersion(&testVer));
// Get the type definitions for our new types.
IAAFTypeDefSP ptd;
checkResult (pDict->LookupTypeDef (sTypeId_Rational16,
&ptd));
IAAFTypeDefRecordSP ptdr16;
checkResult (ptd->QueryInterface (IID_IAAFTypeDefRecord,
(void**) &ptdr16));
checkResult (pDict->LookupTypeDef (sTypeId_Rational16_pair,
&ptd));
IAAFTypeDefRecordSP ptdr16p;
checkResult (ptd->QueryInterface (IID_IAAFTypeDefRecord,
(void**) &ptdr16p));
// Setup to read the Velocity property which is of typed Mixed_t
checkResult (pDict->LookupTypeDef (sTypeId_Mixed, &ptd));
IAAFTypeDefRecordSP ptdrmixed;
checkResult (ptd->QueryInterface (IID_IAAFTypeDefRecord, (void**) &ptdrmixed));
IAAFTypeDef * pTempTd = 0;
checkResult (ptdr16->QueryInterface (IID_IAAFTypeDef,
(void**) &pTempTd));
CheckMemberTypeEqual (ptdr16p, 0, pTempTd);
CheckMemberTypeEqual (ptdr16p, 1, pTempTd);
pTempTd->Release ();
pTempTd = 0;
temphr = ptdr16p->GetMemberType (2, &pTempTd);
checkExpression (temphr == AAFRESULT_ILLEGAL_VALUE,
AAFRESULT_TEST_FAILED);
// register variable array of Rational16Pair records
IAAFTypeDefVariableArraySP ptdvaarpr;
IAAFTypeDefSP ptdarpr;
// perform this part only for specified versions
if( versionUInt(testVer) >= versionUInt(1,1,1,0) )
{
checkResult (pDict->LookupTypeDef (sTypeId_Rational16_array,&ptdarpr));
checkResult (ptdarpr->QueryInterface (IID_IAAFTypeDefVariableArray,(void**) &ptdvaarpr));
}
// Now read the CompositionMob to which we added some optional
// properties.
IEnumAAFMobsSP pEnumMobs;
checkResult (pHeader->GetMobs (0, &pEnumMobs));
IAAFMobSP pMob;
checkResult (pEnumMobs->NextOne (&pMob));
IAAFObjectSP pObj;
checkResult (pMob->QueryInterface (IID_IAAFObject,
(void**) &pObj));
// get the property definitions for the added properties
IAAFPropertyDefSP pPdPosA;
checkResult (defs.cdCompositionMob()->
LookupPropertyDef (sPropertyId_positionA,
&pPdPosA));
IAAFPropertyDefSP pPdPosB;
checkResult (defs.cdCompositionMob()->
LookupPropertyDef (sPropertyId_positionB,
&pPdPosB));
IAAFPropertyDefSP pPdPosC;
checkResult (defs.cdCompositionMob()->
LookupPropertyDef (sPropertyId_positionC,
&pPdPosC));
IAAFPropertyValueSP pPVa;
checkResult (pObj->GetPropertyValue (pPdPosA, &pPVa));
IAAFPropertyValueSP pPVb;
checkResult (pObj->GetPropertyValue (pPdPosB, &pPVb));
IAAFPropertyValueSP pPVc;
checkResult (pObj->GetPropertyValue (pPdPosC, &pPVc));
// Read back the value of the Velocity property
IAAFPropertyDefSP pPdvelocity;
checkResult (defs.cdCompositionMob()->LookupPropertyDef(sPropertyId_velocity, &pPdvelocity));
IAAFPropertyValueSP pPVvelocity;
checkResult (pObj->GetPropertyValue (pPdvelocity, &pPVvelocity));
IAAFPropertyValueSP pPVvelocityAngle, pPVvelocitySpeed;
//.........这里部分代码省略.........
示例12: 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));
//.........这里部分代码省略.........
示例13: 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);
//.........这里部分代码省略.........
示例14: testRestore
static bool testRestore(const wchar_t* fileName)
{
bool passed = true;
IAAFFile* pFile = 0;
IAAFHeader* pHeader = 0;
IAAFDictionary* pDictionary = 0;
IAAFContentStorage* pStorage = 0;
IEnumAAFMobs* pMobs = 0;
IAAFMob* pMob = 0;
try
{
pFile = openFileForReading(fileName);
}
catch (...)
{
return false;
}
try
{
// get the Mob containing the test data
checkResult(pFile->GetHeader(&pHeader));
checkResult(pHeader->GetDictionary(&pDictionary));
checkResult(pHeader->GetContentStorage(&pStorage));
aafSearchCrit_t searchCrit;
searchCrit.searchTag = kAAFByMobKind;
searchCrit.tags.mobKind = kAAFAllMob;
checkResult(pStorage->GetMobs(&searchCrit, &pMobs));
checkResult(pMobs->NextOne(&pMob));
IAAFObject* pObject = 0;
IAAFClassDef* pClassDef = 0;
IAAFPropertyDef* pPropertyDef = 0;
IAAFPropertyValue* pPropertyValue = 0;
IAAFTypeDef* pType = 0;
IAAFTypeDefExtEnum* pExtEnumType = 0;
// test baseline ext. enum
try
{
printf(" * Baseline: ");
const aafUID_t propId =
{0x00000000,0x0000,0x0000,{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
aafUID_t testValue =
{0x0D010102,0x0101,0x0500,{0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01}};
const wchar_t* testName = L"Usage_SubClip";
checkResult(pMob->QueryInterface(IID_IAAFObject, (void **)&pObject));
checkResult(pDictionary->LookupClassDef(kAAFClassID_Mob, &pClassDef));
checkResult(pClassDef->LookupPropertyDef(propId, &pPropertyDef));
checkResult(pObject->GetPropertyValue(pPropertyDef, &pPropertyValue));
checkResult(pPropertyValue->GetType(&pType));
checkResult(pType->QueryInterface(IID_IAAFTypeDefExtEnum, (void **)&pExtEnumType));
aafUID_t value;
aafCharacter name[256];
checkResult(pExtEnumType->GetAUIDValue(pPropertyValue, &value));
checkResult(pExtEnumType->GetNameFromValue(pPropertyValue, name, 256));
if (memcmp(&value, &testValue, sizeof(aafUID_t)) ==0 && wcscmp(name, testName) == 0)
{
printf("passed\n");
}
else
{
printf("FAILED\n");
passed = false;
}
}
catch (...)
{
printf("FAILED\n");
passed = false;
}
release(pExtEnumType);
release(pType);
release(pPropertyValue);
release(pPropertyDef);
release(pClassDef);
release(pObject);
// test Int8 enum
try
{
printf(" * Non-baseline Ext Enum: ");
const aafUID_t propId =
{0x10000000,0x0000,0x0000,{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
aafUID_t testValue =
{0x6f9685a4,0x0a0d,0x447b,{0x89,0xf3,0x1b,0x75,0x0b,0xc5,0xc7,0xde}};
const wchar_t* testName = L"AAA";
checkResult(pMob->QueryInterface(IID_IAAFObject, (void **)&pObject));
checkResult(pDictionary->LookupClassDef(kAAFClassID_Mob, &pClassDef));
//.........这里部分代码省略.........
示例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
//.........这里部分代码省略.........