HRESULT STDMETHODCALLTYPE TestStreamAccess::WriteStream (IAAFPropertyValue *propertyValue, aafMemPtr_t pUserData) { IAAFTypeDefSP pTypeDef; IAAFTypeDefStream3SP pTypeDefStreamRaw; IAAFPlainStreamDataSP pTypeDefStream; IAAFMetaDefinitionSP pMetaDef; aafCharacter debugBuf[256]; CheckResult(propertyValue->GetType(&pTypeDef)); CheckResult(pTypeDef->QueryInterface(IID_IAAFMetaDefinition, (void **)&pMetaDef)); CheckResult(pMetaDef->GetName(debugBuf, 256)); CheckResult(pTypeDef->QueryInterface(IID_IAAFTypeDefStream3, (void **)&pTypeDefStreamRaw)); CheckResult(pTypeDefStreamRaw->GetPlainStreamData(0, &pTypeDefStream)); // Set the byte order of the stream to big endian... CheckResult(pTypeDefStream->SetStoredByteOrder(propertyValue, kAAFByteOrderBig)); // Write the bytes CheckResult(pTypeDefStream->Write(propertyValue, sizeof(sSmiley), pUserData)); return AAFRESULT_SUCCESS; }
static void CheckWeakReference( IAAFFiller * pFiller, IAAFMob * pTargetMob) { IAAFObjectSP pObject; checkResult(pFiller->QueryInterface(IID_IAAFObject, (void **)&pObject)); IAAFClassDefSP pClassDef; checkResult(pObject->GetDefinition(&pClassDef)); IAAFPropertyDefSP pWeakRefPropertyDef; checkResult(pClassDef->LookupPropertyDef(kAAFPropID_TestWeakReferenceToMob, &pWeakRefPropertyDef)); // Get weak reference value from the filler object. IAAFPropertyValueSP pWeakReferenceValue; checkResult(pObject->GetPropertyValue(pWeakRefPropertyDef, &pWeakReferenceValue)); // Make sure the value's type definition is in fact a weak reference. IAAFTypeDefSP pPropertyType; checkResult(pWeakReferenceValue->GetType(&pPropertyType)); IAAFTypeDefWeakObjRefSP pWeakReferenceType; checkResult(pPropertyType->QueryInterface(IID_IAAFTypeDefWeakObjRef, (void **)&pWeakReferenceType)); // Create the weak reference property value. IAAFTypeDefObjectRefSP pObjectReferenceType; checkResult(pWeakReferenceType->QueryInterface(IID_IAAFTypeDefObjectRef, (void **)&pObjectReferenceType)); // Make sure the target of the weak reference is a type definition. IAAFMobSP pFoundTargetMob; checkResult(pObjectReferenceType->GetObject(pWeakReferenceValue, IID_IAAFMob, (IUnknown **)&pFoundTargetMob)); // Verify that the object that was the target of the weak reference was the // type that we were expecting. checkExpression(EqualObjects(pFoundTargetMob, pTargetMob), AAFRESULT_TEST_FAILED); }
static void CreateWeakReference( IAAFFiller * pFiller, IAAFMob * pTargetMob) { IAAFObjectSP pObject; checkResult(pFiller->QueryInterface(IID_IAAFObject, (void **)&pObject)); IAAFClassDefSP pClassDef; checkResult(pObject->GetDefinition(&pClassDef)); IAAFPropertyDefSP pWeakRefPropertyDef; checkResult(pClassDef->LookupPropertyDef(kAAFPropID_TestWeakReferenceToMob, &pWeakRefPropertyDef)); // Make sure the property's type definition is in fact a weak reference. IAAFTypeDefSP pPropertyType; checkResult(pWeakRefPropertyDef->GetTypeDef(&pPropertyType)); IAAFTypeDefWeakObjRefSP pWeakReferenceType; checkResult(pPropertyType->QueryInterface(IID_IAAFTypeDefWeakObjRef, (void **)&pWeakReferenceType)); // Create the weak reference property value. IAAFTypeDefObjectRefSP pObjectReferenceType; checkResult(pWeakReferenceType->QueryInterface(IID_IAAFTypeDefObjectRef, (void **)&pObjectReferenceType)); IAAFPropertyValueSP pWeakReferenceValue; checkResult(pObjectReferenceType->CreateValue(pTargetMob, &pWeakReferenceValue)); // Install the new weak reference value into the filler object. checkResult(pObject->SetPropertyValue(pWeakRefPropertyDef, pWeakReferenceValue)); }
static void ChangeWeakReference( IAAFFiller * pFiller, IAAFTypeDef * pTargetType) { IAAFObjectSP pObject; checkResult(pFiller->QueryInterface(IID_IAAFObject, (void **)&pObject)); IAAFClassDefSP pClassDef; checkResult(pObject->GetDefinition(&pClassDef)); IAAFPropertyDefSP pWeakRefPropertyDef; checkResult(pClassDef->LookupPropertyDef(kAAFPropID_TestWeakReferenceToType, &pWeakRefPropertyDef)); // Get weak reference value from the filler object. IAAFPropertyValueSP pWeakReferenceValue; checkResult(pObject->GetPropertyValue(pWeakRefPropertyDef, &pWeakReferenceValue)); // Make sure the value's type definition is in fact a weak reference. IAAFTypeDefSP pPropertyType; checkResult(pWeakReferenceValue->GetType(&pPropertyType)); IAAFTypeDefWeakObjRefSP pWeakReferenceType; checkResult(pPropertyType->QueryInterface(IID_IAAFTypeDefWeakObjRef, (void **)&pWeakReferenceType)); // Create the weak reference property value. IAAFTypeDefObjectRefSP pObjectReferenceType; checkResult(pWeakReferenceType->QueryInterface(IID_IAAFTypeDefObjectRef, (void **)&pObjectReferenceType)); // Make sure the target of the weak reference is a type definition. checkResult(pObjectReferenceType->SetObject(pWeakReferenceValue, pTargetType)); }
static void Test_GetTypeDefStream( IAAFPropertyValue *pStreamPropertyValue, IAAFPlainStreamData **ppPlainStreamData) { IAAFTypeDefSP pTypeDef; IAAFTypeDefStream3SP pTypeDefStream3; CheckResult(pStreamPropertyValue->GetType(&pTypeDef)); CheckResult(pTypeDef->QueryInterface(IID_IAAFTypeDefStream3, (void **)&pTypeDefStream3)); CheckResult(pTypeDefStream3->GetPlainStreamData(0, ppPlainStreamData)); }
static HRESULT createFAFiller(IAAFDictionary* const pDict, IAAFFillerSP& spFill) { //handy - QI filler for Object intf. IAAFObjectSP spObj; checkResult(spFill->QueryInterface(IID_IAAFObject, (void**)&spObj)); //Get the property def for Component::FA IAAFClassDefSP spCD_comp; checkResult(pDict->LookupClassDef(AUID_AAFComponent, &spCD_comp)); //From Class Def, get the Property Def IAAFPropertyDefSP spPD_comp; checkResult(spCD_comp->LookupPropertyDef(TEST_PROP_ID, &spPD_comp)); aafBoolean_t bIsPresent = kAAFTrue; //Verify that optional property is NOT yet present in object checkResult(spObj->IsPropertyPresent(spPD_comp, &bIsPresent)); checkExpression(bIsPresent == kAAFFalse, AAFRESULT_TEST_FAILED); //Now, create a property value ....... //first, get the type def //Lookup the FA type IAAFTypeDefSP spTypeDef; checkResult(pDict->LookupTypeDef(TEST_FA_TYPE_ID, &spTypeDef)); //Get the FA typedef IAAFTypeDefFixedArraySP spFA; checkResult(spTypeDef->QueryInterface(IID_IAAFTypeDefFixedArray, (void**)&spFA)); //Set the array up IAAFPropertyValueSP spPropVal; checkResult( spFA->CreateValueFromCArray ( (aafMemPtr_t) TEST_FA_VALUES, sizeof(TEST_FA_VALUES), &spPropVal) ); //Set the value FA to the Object ***************************************** checkResult(spObj->SetPropertyValue(spPD_comp, spPropVal)); //Verify that the optional property is now present in the object checkResult(spObj->IsPropertyPresent(spPD_comp, &bIsPresent)); checkExpression(bIsPresent == kAAFTrue, AAFRESULT_TEST_FAILED); return S_OK; }//createFAFiller()
static HRESULT createCHARFiller(IAAFDictionary* const pDict, IAAFFillerSP& spFill) { //handy - QI filler for Object intf. IAAFObjectSP spObj; checkResult(spFill->QueryInterface(IID_IAAFObject, (void**)&spObj)); //Get the property def for Component::CHAR IAAFClassDefSP spCD_comp; checkResult(pDict->LookupClassDef(AUID_AAFComponent, &spCD_comp)); //From Class Def, get the Property Def IAAFPropertyDefSP spPD_comp; checkResult(spCD_comp->LookupPropertyDef(TEST_PROP_ID, &spPD_comp)); aafBoolean_t bIsPresent = kAAFTrue; //Verify that optional property is already present in object (builtin) checkResult(spObj->IsPropertyPresent(spPD_comp, &bIsPresent)); checkExpression(bIsPresent == kAAFFalse, AAFRESULT_TEST_FAILED); //Now, create a property value ....... //first, get the type def //Lookup the CHAR type IAAFTypeDefSP spTypeDef; checkResult(pDict->LookupTypeDef(TEST_CHAR_TYPE_ID, &spTypeDef)); //Get the CHAR typedef IAAFTypeDefCharacterSP spCHAR; checkResult(spTypeDef->QueryInterface(IID_IAAFTypeDefCharacter, (void**)&spCHAR)); //Set the CHAR up IAAFPropertyValueSP spPropVal; checkResult( spCHAR->CreateValueFromCharacter ( TEST_CHAR_VALUE, &spPropVal) ); //Set the value CHAR to the Object ***************************************** checkResult(spObj->SetPropertyValue(spPD_comp, spPropVal)); //Verify that the optional property is now present in the object checkResult(spObj->IsPropertyPresent(spPD_comp, &bIsPresent)); checkExpression(bIsPresent == kAAFTrue, AAFRESULT_TEST_FAILED); return S_OK; }//createCHARFiller()
static void Test_EssenceStreamPullWrite( IAAFFile *pFile, CAAFBuiltinDefs & defs) { IAAFTypeDefSP pTypeDef; IAAFTypeDefStream3SP pTypeDefStream3; // Get the direct access interfaces. IAAFObjectSP pObject; IAAFPropertyDefSP pDataPropertyDef; IAAFPropertyDefSP pSampleIndexPropertyDef; IAAFPropertyValueSP pStreamPropertyValue; IAAFStreamAccess *cb = 0; IAAFEssenceDataSP pEssenceData; IAAFHeaderSP pHeader; IAAFDictionarySP pDictionary; IAAFSourceMobSP pSourceMob; IAAFMobSP pMob; IAAFEssenceDescriptorSP pEssenceDesciptor; CheckResult (pFile->GetHeader (&pHeader)); CheckResult (pHeader->GetDictionary (&pDictionary)); // Create an EssenceData object and associated Mob Test_CreateEssenceData(defs, pHeader, sMobID[2], sMobName[2], &pEssenceData); // Normally we'd add the essence data object here and, with it attached, // write essence to it. Instead establish a call back so that the data // may be written later during save. CheckResult(pEssenceData->QueryInterface(IID_IAAFObject, (void **)&pObject)); Test_LookupEssenceDataStreamPropertyDefinitions(pDictionary, &pDataPropertyDef, &pSampleIndexPropertyDef); CheckResult(pObject->GetPropertyValue(pDataPropertyDef, &pStreamPropertyValue)); CheckResult(pStreamPropertyValue->GetType(&pTypeDef)); CheckResult(pTypeDef->QueryInterface(IID_IAAFTypeDefStream3, (void **)&pTypeDefStream3)); CheckResult(TestStreamAccess::Create(&cb)); CheckResult(pTypeDefStream3->SetCallback(pStreamPropertyValue, cb, reinterpret_cast<aafMemPtr_t>(const_cast<char *>(sSmiley)))); cb->Release(); }
/* Throws on error */ static void CheckRational16ByValues (IAAFTypeDefRecordSP pTDr16, IAAFPropertyValueSP pv, Rational16_t expected) { IAAFPropertyValueSP pvMemNum, pvMemDen; IAAFPropertyValueSP junkPv; checkResult (pTDr16->GetValue (pv, 0, &pvMemNum)); checkResult (pTDr16->GetValue (pv, 1, &pvMemDen)); // Check that there are no more members checkExpression ( pTDr16->GetValue (pv, 2, &junkPv) == AAFRESULT_ILLEGAL_VALUE, AAFRESULT_TEST_FAILED ); IAAFTypeDefSP td; IAAFTypeDefIntSP tdint; aafInt16 num; aafUInt16 den; checkResult (pTDr16->GetMemberType (0, &td)); checkResult (td->QueryInterface (IID_IAAFTypeDefInt, (void **) &tdint)); checkResult (tdint->GetInteger (pvMemNum, (aafMemPtr_t)(&num), sizeof(num))); checkResult (pTDr16->GetMemberType (1, &td)); checkResult (td->QueryInterface (IID_IAAFTypeDefInt, (void **) &tdint)); checkResult (tdint->GetInteger (pvMemDen, (aafMemPtr_t)(&den), sizeof(den))); checkExpression(expected.Numerator == num && expected.Denominator == den, AAFRESULT_TEST_FAILED); }
static HRESULT TestTypeDef ( testMode_t mode, aafUID_constref fileKind, testRawStorageType_t rawStorageType, aafProductIdentification_constref productID) { HRESULT hr = E_FAIL; GenerateTestFileName( productID.productName, fileKind, fileNameBufLen, testFileName ); IAAFFileSP pFile; if(mode == kAAFUnitTestReadWrite) { RemoveTestFile (testFileName); hr = CreateTestFile( testFileName, fileKind, rawStorageType, productID, &pFile ); } else { hr = AAFFileOpenExistingRead(testFileName, 0, &pFile); } if (! SUCCEEDED (hr)) return hr; IAAFHeaderSP pHeader; hr = pFile->GetHeader (&pHeader); if (! SUCCEEDED (hr)) return hr; assert (pHeader); IAAFDictionarySP pDict; 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 IAAFTypeDefIntSP pTypeDefInt; hr = defs.tdInt32()->QueryInterface (IID_IAAFTypeDefInt, (void **) &pTypeDefInt); if (! SUCCEEDED (hr)) return hr; assert (pTypeDefInt); IAAFTypeDefSP pTypeDef; hr = pTypeDefInt->QueryInterface(IID_IAAFTypeDef, (void **)&pTypeDef); if (! SUCCEEDED (hr)) return hr; assert (pTypeDef); // // Test GetTypeCategory() method // // first, test error conditions hr = pTypeDef->GetTypeCategory(NULL); if (AAFRESULT_NULL_PARAM != hr) return AAFRESULT_TEST_FAILED; // now, test for valid value. Our type def is integral. eAAFTypeCategory_t typeCat = kAAFTypeCatUnknown; hr = pTypeDef->GetTypeCategory(&typeCat); if (! SUCCEEDED (hr)) return hr; if (kAAFTypeCatInt != typeCat) return AAFRESULT_TEST_FAILED; // Test for RawAccessType(). It should be array of unsigned chars. IAAFTypeDefSP pRawType; hr = pTypeDef->RawAccessType (&pRawType); if (! SUCCEEDED (hr)) return hr; IUnknownSP pUnkRawType; hr = pRawType->QueryInterface(IID_IUnknown, (void **)&pUnkRawType); if (! SUCCEEDED (hr)) return hr; IAAFTypeDefSP pUInt8ArrayType; hr = pDict->LookupTypeDef (kAAFTypeID_UInt8Array, &pUInt8ArrayType); if (! SUCCEEDED (hr)) return hr; IUnknownSP pUnkUInt8Array; hr = pUInt8ArrayType->QueryInterface(IID_IUnknown, (void **)&pUnkUInt8Array); if (! SUCCEEDED (hr)) return hr; if (pUnkUInt8Array != pUnkRawType) return AAFRESULT_TEST_FAILED; // that's all we can test for. Clean up. if(mode == kAAFUnitTestReadWrite) { hr = pFile->Save(); if (! SUCCEEDED (hr)) return hr; } hr = pFile->Close(); if (! SUCCEEDED (hr)) return hr; return AAFRESULT_SUCCESS; }
// Create the test file. void CAAFTypeDefWeakObjRef_create ( aafCharacter_constptr pFileName, aafUID_constref fileKind, testRawStorageType_t rawStorageType, aafProductIdentification_constref productID) { // Remove the previous test file is one exists RemoveTestFile (pFileName); // Create the file. IAAFFileSP pFile; checkResult (CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile )); try { IAAFHeaderSP pHeader; checkResult (pFile->GetHeader (&pHeader)); aafProductVersion_t toolkitVersion; checkResult(GetAAFVersions(pHeader, &toolkitVersion, NULL)); bool weakReferencesSupported = WeakReferencesSupported(toolkitVersion); IAAFDictionarySP pDictionary; checkResult (pHeader->GetDictionary (&pDictionary)); CAAFBuiltinDefs defs (pDictionary); if (weakReferencesSupported) { // Create a Weak reference to a type definition. IAAFTypeDefWeakObjRefSP pWeakObjRef; checkResult(pDictionary->CreateMetaInstance(AUID_AAFTypeDefWeakObjRef, IID_IAAFTypeDefWeakObjRef, (IUnknown **)&pWeakObjRef)); // Find the class definition for all type definitions. IAAFClassDefSP pClassDef; checkResult(pDictionary->LookupClassDef(AUID_AAFTypeDef, &pClassDef)); aafUID_t targetSet[2]; targetSet[0] = kAAFPropID_Root_MetaDictionary; targetSet[1] = kAAFPropID_MetaDictionary_TypeDefinitions; checkResult(pWeakObjRef->Initialize(kAAFTypeID_TestWeakReferenceToType, pClassDef, kMyWeakReferenceToTypeDefinitionName, sizeof(targetSet)/sizeof(aafUID_t), targetSet)); // Validate that we make the correct "type" by inspecting the type category. IAAFTypeDefSP pTypeDef; checkResult(pWeakObjRef->QueryInterface(IID_IAAFTypeDef, (void **)&pTypeDef)); eAAFTypeCategory_t category; checkResult(pTypeDef->GetTypeCategory(&category)); checkExpression(kAAFTypeCatWeakObjRef == category, AAFRESULT_TEST_FAILED); // Add the new type to the dictionary. checkResult(pDictionary->RegisterTypeDef(pTypeDef)); // Now add a new optional weak reference property to an existing class. IAAFClassDefSP pFillerClass; IAAFPropertyDefSP pWeakRefPropertyDef; checkResult(pDictionary->LookupClassDef(AUID_AAFComponent, &pFillerClass)); checkResult(pFillerClass->RegisterOptionalPropertyDef( kAAFPropID_TestWeakReferenceToType, kMyWeakReferenceToTypeDefinitionPropertyName, pTypeDef, &pWeakRefPropertyDef)); } #ifndef NO_REFERENCE_TO_MOB_TEST if (weakReferencesSupported) { // Create a Weak reference to a mob. IAAFTypeDefWeakObjRefSP pWeakObjRef; checkResult(pDictionary->CreateMetaInstance(AUID_AAFTypeDefWeakObjRef, IID_IAAFTypeDefWeakObjRef, (IUnknown **)&pWeakObjRef)); // Find the class definition for all mobs. IAAFClassDefSP pClassDef; checkResult(pDictionary->LookupClassDef(AUID_AAFMob, &pClassDef)); aafUID_t targetSet[3]; targetSet[0] = kAAFPropID_Root_Header; targetSet[1] = kAAFPropID_Header_Content; targetSet[2] = kAAFPropID_ContentStorage_Mobs; checkResult(pWeakObjRef->Initialize(kAAFTypeID_TestWeakReferenceToMob, pClassDef, kMyWeakReferenceToMobName, sizeof(targetSet)/sizeof(aafUID_t), targetSet)); // Validate that we make the correct "type" by inspecting the type category. IAAFTypeDefSP pTypeDef; checkResult(pWeakObjRef->QueryInterface(IID_IAAFTypeDef, (void **)&pTypeDef)); eAAFTypeCategory_t category; checkResult(pTypeDef->GetTypeCategory(&category)); checkExpression(kAAFTypeCatWeakObjRef == category, AAFRESULT_TEST_FAILED); // Add the new type to the dictionary. checkResult(pDictionary->RegisterTypeDef(pTypeDef)); // Now add a new optional weak reference property to an existing class. IAAFClassDefSP pFillerClass; IAAFPropertyDefSP pWeakRefPropertyDef; checkResult(pDictionary->LookupClassDef(AUID_AAFComponent, &pFillerClass)); checkResult(pFillerClass->RegisterOptionalPropertyDef( kAAFPropID_TestWeakReferenceToMob, kMyWeakReferenceToMobPropertyName, pTypeDef, &pWeakRefPropertyDef)); } #endif // // Create a Composition Mob // IAAFMobSP pMob; checkResult(defs.cdCompositionMob()->CreateInstance(IID_IAAFMob, (IUnknown **)&pMob)); checkResult(pMob->SetMobID(TEST_MobID)); checkResult(pMob->SetName(L"TestCompMob")); // // Create a sequence to hold our test fillers components. // IAAFSequenceSP pSequence; checkResult (defs.cdSequence()->CreateInstance(IID_IAAFSequence, (IUnknown **)&pSequence)); checkResult (pSequence->Initialize (defs.ddkAAFPicture())); IAAFFillerSP pFiller1; checkResult (defs.cdFiller()->CreateInstance(IID_IAAFFiller, (IUnknown **)&pFiller1)); checkResult (pFiller1->Initialize (defs.ddkAAFPicture(), 16)); IAAFFillerSP pFiller2; checkResult (defs.cdFiller()->CreateInstance(IID_IAAFFiller, (IUnknown **)&pFiller2)); checkResult (pFiller2->Initialize (defs.ddkAAFPicture(), 32)); if (weakReferencesSupported) { // Try adding a weak reference before filler is attached to the file. CreateWeakReference(pFiller1, defs.tdInt64()); CheckWeakReference(pFiller1, defs.tdInt64()); ChangeWeakReference(pFiller1, defs.tdString()); CreateWeakReference(pFiller2, defs.tdInt32()); } // // Add the initialized fillers to the sequence. // IAAFComponentSP pComp1; checkResult(pFiller1->QueryInterface(IID_IAAFComponent, (void **)&pComp1)); checkResult(pSequence->AppendComponent(pComp1)); IAAFComponentSP pComp2; checkResult(pFiller2->QueryInterface(IID_IAAFComponent, (void **)&pComp2)); checkResult(pSequence->AppendComponent(pComp2)); // // Append the sequence as the segment in a new timeline mob slot. // IAAFSegmentSP pSegment; checkResult(pSequence->QueryInterface(IID_IAAFSegment, (void **)&pSegment)); aafRational_t editRate = {30000, 1001}; aafCharacter_constptr pSlotName = L"Slot 1"; aafPosition_t origin = 0; IAAFTimelineMobSlotSP pNewSlot; checkResult(pMob->AppendNewTimelineSlot(editRate, pSegment, TEST_SlotID, pSlotName, origin, &pNewSlot)); // // Add to the set of mobs in the file. // checkResult(pHeader->AddMob(pMob)); #ifndef NO_REFERENCE_TO_MOB_TEST if (weakReferencesSupported) { // The referenced object needs to be attached to the file. CreateWeakReference(pFiller1, pMob); CheckWeakReference(pFiller1, pMob); } #endif // if (weakReferencesSupported) // { // // Try adding a weak reference after filler is attached to the file. // CreateWeakReference(pFiller2, defs.tdInt32()); // } // Verify the data before the save. CAAFTypeDefWeakObjRef_verify (pHeader); checkResult(pFile->Save()); checkResult(pFile->Close()); } catch (HRESULT& rhr) { if (pFile) // only save & close the file if it was actually opened { pFile->Save(); // This may not be safe??? pFile->Close(); } throw rhr; } catch (...) { if (pFile) // only close the file if it was actually opened pFile->Close(); throw; } }
void CAAFTypeDefWeakObjRef_verify (IAAFHeader * pHeader) { IAAFDictionarySP pDictionary; IAAFPropertyDefSP pWeakRefPropertyDef; checkResult (pHeader->GetDictionary (&pDictionary)); CAAFBuiltinDefs defs (pDictionary); // Determine if it is okay to ready/validate weak references from the // test file with the current version of the AAF. bool weakReferencesSupported = false; aafProductVersion_t toolkitVersion, fileToolkitVersion; checkResult(GetAAFVersions(pHeader, &toolkitVersion, &fileToolkitVersion)); if (WeakReferencesSupported(toolkitVersion) && WeakReferencesSupported(fileToolkitVersion)) { weakReferencesSupported = true; } if (weakReferencesSupported) { // // Find and validate the new weak reference. IAAFTypeDefSP pType; checkResult(pDictionary->LookupTypeDef (kAAFTypeID_TestWeakReferenceToType, &pType)); eAAFTypeCategory_t category; checkResult(pType->GetTypeCategory(&category)); checkExpression(kAAFTypeCatWeakObjRef == category, AAFRESULT_TEST_FAILED); IAAFTypeDefWeakObjRefSP pWeakReferenceType; checkResult(pType->QueryInterface(IID_IAAFTypeDefWeakObjRef, (void **)&pWeakReferenceType)); checkResult(defs.cdFiller()->LookupPropertyDef(kAAFPropID_TestWeakReferenceToType, &pWeakRefPropertyDef)); // Validate the property's type checkResult(pWeakRefPropertyDef->GetTypeDef(&pType)); checkExpression(EqualObjects(pType, pWeakReferenceType), AAFRESULT_TEST_FAILED); // Use GetObjectType to make sure that the target class definitions are // the same. IAAFTypeDefObjectRefSP pObjectReferenceType; checkResult(pWeakReferenceType->QueryInterface(IID_IAAFTypeDefObjectRef, (void **)&pObjectReferenceType)); IAAFClassDefSP pReferencedObjectClass; checkResult(pObjectReferenceType->GetObjectType(&pReferencedObjectClass)); // Find the class definition for all type definitions. IAAFClassDefSP pTypeDefClass; checkResult(pDictionary->LookupClassDef(AUID_AAFTypeDef, &pTypeDefClass)); checkExpression(EqualObjects(pReferencedObjectClass, pTypeDefClass), AAFRESULT_TEST_FAILED); // // Find our composition mob. IAAFMobSP pMob; checkResult(pHeader->LookupMob(TEST_MobID, &pMob)); IAAFMobSlotSP pSlot; checkResult(pMob->LookupSlot(TEST_SlotID, &pSlot)); IAAFSegmentSP pSegment; checkResult(pSlot->GetSegment(&pSegment)); IAAFSequenceSP pSequence; checkResult(pSegment->QueryInterface(IID_IAAFSequence, (void **)&pSequence)); aafUInt32 elementCount; checkResult(pSequence->CountComponents(&elementCount)); checkExpression(2 == elementCount, AAFRESULT_TEST_FAILED); IAAFComponentSP pComp1; checkResult(pSequence->GetComponentAt(0, &pComp1)); IAAFFillerSP pFiller1; checkResult(pComp1->QueryInterface(IID_IAAFFiller, (void **)&pFiller1)); IAAFComponentSP pComp2; checkResult(pSequence->GetComponentAt(1, &pComp2)); IAAFFillerSP pFiller2; checkResult(pComp2->QueryInterface(IID_IAAFFiller, (void **)&pFiller2)); CheckWeakReference(pFiller1, defs.tdString()); CheckWeakReference(pFiller2, defs.tdInt32()); #ifndef NO_REFERENCE_TO_MOB_TEST CheckWeakReference(pFiller1, pMob); #endif } else if (!WeakReferencesSupported(toolkitVersion)) { // This version does not support reading weak references. throw AAFRESULT_NOT_IN_CURRENT_VERSION; } }
static HRESULT ReadAAFFile(aafWChar * pFileName ) { HRESULT hr = AAFRESULT_SUCCESS; IAAFFile * pFile = NULL; IAAFHeader * pHeader = NULL; IEnumAAFMobs* pMobIter = NULL; IAAFCompositionMob * pCMob = NULL; IAAFMob* pMob = NULL; bool bFileOpen = false; aafNumSlots_t numMobs; IAAFObject* pObj = NULL; IEnumAAFProperties * pEnum = NULL; IAAFProperty *pProp = NULL; IAAFPropertyDef* pPropDef = NULL; IAAFPropertyValue* pPropVal = NULL; IAAFTypeDef* pTypeDef = NULL; 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)); // Validate that there is only one composition mob. checkResult(pHeader->CountMobs(kAAFCompMob, &numMobs)); checkExpression(1 == numMobs, AAFRESULT_TEST_FAILED); // Enumerate over all Composition Mobs aafSearchCrit_t criteria; criteria.searchTag = kAAFByMobKind; criteria.tags.mobKind = kAAFCompMob; checkResult(pHeader->GetMobs(&criteria, &pMobIter)); while (AAFRESULT_SUCCESS == pMobIter->NextOne(&pMob)) { //Get the Composition mob checkResult (pMob->QueryInterface (IID_IAAFCompositionMob, (void **) &pCMob)); //Get the Object checkResult (pCMob->QueryInterface (IID_IAAFObject, (void **) &pObj)); //From the Object, we can get the properties .... aafUInt32 propCount = 0; checkResult (pObj->CountProperties (&propCount)); //A composition should have at least 5 properties ... checkExpression(propCount>=5, AAFRESULT_TEST_FAILED); //Get Enumeration over properties checkResult (pObj->GetProperties (&pEnum)); checkExpression (pEnum != 0, AAFRESULT_TEST_FAILED); while (propCount--) { //Check for property validity checkResult (pEnum->NextOne (&pProp)); checkExpression (pProp != NULL, AAFRESULT_TEST_FAILED); //Now call prop methods //1. Get Definition checkResult( pProp->GetDefinition(&pPropDef) ); //2. Get Value checkResult( pProp->GetValue(&pPropVal) ); //deal with prop value checkResult( pPropVal->GetType(&pTypeDef) ); //From propval, get the typedef!!!!!!!!!!!!!!!!!!!!! IAAFTypeDefSP spTypeDef; checkResult( pPropVal->GetType(&spTypeDef) ); //get category eAAFTypeCategory_t typeCat = kAAFTypeCatUnknown; checkResult (spTypeDef->GetTypeCategory(&typeCat)); //make sure it is not unknown checkExpression(kAAFTypeCatUnknown != typeCat, AAFRESULT_TEST_FAILED); //Deal with our Name String .... if (typeCat == kAAFTypeCatString) { IAAFTypeDefStringSP spTypeDefString; checkResult( spTypeDef->QueryInterface(IID_IAAFTypeDefString, (void**)&spTypeDefString) ); aafUInt32 bufSize = //don't forget the NULL char, and factoring in the size of a wchar (wcslen(TEST_NAME)+1) * sizeof(aafCharacter); aafCharacter *nameBuf = new aafCharacter[bufSize]; checkResult( spTypeDefString->GetElements(pPropVal, (aafMemPtr_t)nameBuf, bufSize) ); checkExpression( wcscmp(TEST_NAME, nameBuf) == 0, AAFRESULT_TEST_FAILED ); delete [] nameBuf; } //Done ........... //release typedef pTypeDef->Release(); //release defintion + value pPropDef->Release(); pPropVal->Release(); //release this prop pProp->Release(); pProp = NULL; }//while prop count }//while mob iter }//try catch (HRESULT & rResult) { hr = rResult; } //Release the rest ... if (pEnum) pEnum->Release(); if (pObj) pObj->Release(); if (pCMob) pCMob->Release(); if (pMob) pMob->Release(); if (pMobIter) pMobIter->Release(); if (pHeader) pHeader->Release(); if (pFile) { if (bFileOpen) pFile->Close(); pFile->Release(); } return hr; }
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; checkResult (ptdrmixed->GetValue (pPVvelocity, 0, &pPVvelocityAngle)); checkResult (ptdrmixed->GetValue (pPVvelocity, 1, &pPVvelocitySpeed)); Mixed_t velocity = {0, 0}; IAAFTypeDefSP pTDmem; IAAFTypeDefIntSP pTDIntMem; checkResult (ptdrmixed->GetMemberType (0, &pTDmem)); checkResult (pTDmem->QueryInterface (IID_IAAFTypeDefInt, (void **) &pTDIntMem)); checkResult (pTDIntMem->GetInteger (pPVvelocityAngle, (aafMemPtr_t)(&velocity.angle), sizeof(velocity.angle))); checkResult (ptdrmixed->GetMemberType (1, &pTDmem)); checkResult (pTDmem->QueryInterface (IID_IAAFTypeDefInt, (void **) &pTDIntMem)); checkResult (pTDIntMem->GetInteger (pPVvelocitySpeed, (aafMemPtr_t)(&velocity.speed), sizeof(velocity.speed))); checkExpression (15 == velocity.angle, AAFRESULT_TEST_FAILED); checkExpression (2001 == velocity.speed, AAFRESULT_TEST_FAILED); // Try to read the first one Rational16pair_t valA = { {1, 2}, {3, 4} }; CheckRational16PairByValues (ptdr16p, ptdr16, pPVa, valA); // Try to read the second one Rational16pair_t valB = { {5, 6}, {7, 8} }; CheckRational16PairByValues (ptdr16p, ptdr16, pPVb, valB); // Check misc. error return conditions for TypeDefRecord GetValue IAAFPropertyValueSP junkPv; temphr = ptdr16->GetValue (0, 1, &junkPv); checkExpression (AAFRESULT_NULL_PARAM == temphr, AAFRESULT_TEST_FAILED); temphr = ptdr16p->GetValue (pPVb, 1, 0); checkExpression (AAFRESULT_NULL_PARAM == temphr, AAFRESULT_TEST_FAILED); // Read the last two with GetStruct just to get it over with. ;) Rational16pair_t valC = { {9, 10}, {11, 12} }; CheckRational16PairByValues (ptdr16p, ptdr16, pPVc, valC); // test variable array of records // perform this part only for specified versions if( versionUInt(testVer) >= versionUInt(1,1,1,0) ) { IAAFPropertyDefSP pPdPosN; checkResult (defs.cdCompositionMob()->LookupPropertyDef (sPropertyId_positionN, &pPdPosN)); IAAFPropertyValueSP pPVN; checkResult (pObj->GetPropertyValue (pPdPosN, &pPVN)); // get the middle element of the array, 9abc IAAFPropertyValueSP pPVN1; checkResult (ptdvaarpr->GetElementValue (pPVN, 1, &pPVN1)); // Read the value with GetStruct Rational16pair_t valN1 = { {9,10},{11,12} }; CheckRational16PairByValues (ptdr16p, ptdr16, pPVN1, valN1); } // Attempt to close the file. checkResult(pFile->Close()); IAAFFileSP nullFile; pFile = nullFile; // zeros the pFile, and releases it. hr = AAFRESULT_SUCCESS; } catch (HRESULT& rResult) { hr = rResult; } // cleanup if (pFile) { pFile->Close(); } return hr; }
static HRESULT ReadRecord (const aafWChar * pFileName, int loadingMode) { HRESULT hr = E_FAIL; 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)); // check for duplicate initialization aafUID_t nullUid = { 0 }; HRESULT temphr; temphr = ptdr16->Initialize (nullUid, 0, 0, 1, L"foo"); checkExpression (AAFRESULT_ALREADY_INITIALIZED == temphr, AAFRESULT_TEST_FAILED); aafUInt32 count = 0; checkResult (ptdr16->GetCount (&count)); checkExpression (2 == count, AAFRESULT_TEST_FAILED); aafUInt32 nameLen = 0; aafCharacter nameBuf [100]; checkResult (ptdr16->GetMemberNameBufLen (0, &nameLen)); checkExpression (((wcslen(L"Numerator")+1)*sizeof(aafCharacter)) == nameLen, AAFRESULT_TEST_FAILED); checkExpression (nameLen < 100, AAFRESULT_TEST_FAILED); checkResult (ptdr16->GetMemberName (0, nameBuf, sizeof (nameBuf))); checkExpression (0 == wcscmp (L"Numerator", nameBuf), AAFRESULT_TEST_FAILED); checkResult (ptdr16->GetMemberNameBufLen (1, &nameLen)); checkExpression (((wcslen(L"Denominator")+1)*sizeof (aafCharacter)) == nameLen, AAFRESULT_TEST_FAILED); checkExpression (nameLen < 100, AAFRESULT_TEST_FAILED); checkResult (ptdr16->GetMemberName (1, nameBuf, sizeof (nameBuf))); checkExpression (0 == wcscmp (L"Denominator", nameBuf), AAFRESULT_TEST_FAILED); temphr = ptdr16->GetMemberNameBufLen (2, &nameLen); checkExpression (AAFRESULT_ILLEGAL_VALUE == temphr, AAFRESULT_TEST_FAILED); temphr = ptdr16->GetMemberName (2, nameBuf, sizeof (nameBuf)); checkExpression (AAFRESULT_ILLEGAL_VALUE == temphr, AAFRESULT_TEST_FAILED); checkResult (pDict->LookupTypeDef (sTypeId_Rational16_pair, &ptd)); IAAFTypeDefRecordSP ptdr16p; checkResult (ptd->QueryInterface (IID_IAAFTypeDefRecord, (void**) &ptdr16p)); // check for duplicate initialization temphr = ptdr16p->Initialize (nullUid, 0, 0, 1, L"foo"); checkExpression (AAFRESULT_ALREADY_INITIALIZED == temphr, AAFRESULT_TEST_FAILED); count = 0; checkResult (ptdr16p->GetCount (&count)); checkExpression (2 == count, AAFRESULT_TEST_FAILED); // Now attempt to register offsets of Rational16_pair. This // should fail, because offsets of its members (of type // Rational16) have not yet been registered. temphr = RegisterRational16PairOffsets (ptdr16p); checkExpression (temphr == AAFRESULT_NOT_REGISTERED, AAFRESULT_TEST_FAILED); // Now let's attempt registration the right way. checkResult (RegisterRational16Offsets (ptdr16)); checkResult (RegisterRational16PairOffsets (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)); temphr = RegisterMixedOffsets(ptdrmixed); /* It is ok to return default already used due to current limitation * in implementation that default registration may occur and tie us * to a specific structural layout before we get the ability to * register own offsets/layout. This is slated for fixing in * future rev of the SDK. */ if (temphr == AAFRESULT_DEFAULT_ALREADY_USED) { temphr = AAFRESULT_SUCCESS; throw temphr; } checkResult (temphr); 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)); Mixed_t velocity = {0, 0}; checkResult (ptdrmixed->GetStruct (pPVvelocity, (aafMemPtr_t) &velocity, sizeof (velocity))); checkExpression (15 == velocity.angle, AAFRESULT_TEST_FAILED); checkExpression (2001 == velocity.speed, AAFRESULT_TEST_FAILED); // Try to read the first one with GetStruct. Rational16pair_t valA = { {0,0},{0,0} }; checkResult (ptdr16p->GetStruct (pPVa, (aafMemPtr_t) &valA, sizeof (valA))); checkExpression (1 == valA.X_Position.Numerator, AAFRESULT_TEST_FAILED); checkExpression (2 == valA.X_Position.Denominator, AAFRESULT_TEST_FAILED); checkExpression (3 == valA.Y_Position.Numerator, AAFRESULT_TEST_FAILED); checkExpression (4 == valA.Y_Position.Denominator, AAFRESULT_TEST_FAILED); // Try to read the second one by decomposing with GetValue. Rational16pair_t valB = { {5, 6}, {7, 8} }; CheckRational16PairByValues (ptdr16p, ptdr16, pPVb, valB); // Read the last two with GetStruct just to get it over with. ;) Rational16pair_t valC = { {0,0},{0,0} }; temphr = ptdr16p->GetStruct (pPVc, (aafMemPtr_t) &valC, sizeof (valC)-1); checkExpression (AAFRESULT_ILLEGAL_VALUE == temphr, AAFRESULT_TEST_FAILED); temphr = ptdr16p->GetStruct (0, (aafMemPtr_t) &valC, sizeof (valC)); checkExpression (AAFRESULT_NULL_PARAM == temphr, AAFRESULT_TEST_FAILED); temphr = ptdr16p->GetStruct (pPVc, 0, sizeof (valC)); checkExpression (AAFRESULT_NULL_PARAM == temphr, AAFRESULT_TEST_FAILED); checkResult (ptdr16p->GetStruct (pPVc, (aafMemPtr_t) &valC, sizeof (valC))); checkExpression (9 == valC.X_Position.Numerator, AAFRESULT_TEST_FAILED); checkExpression (10 == valC.X_Position.Denominator, AAFRESULT_TEST_FAILED); checkExpression (11 == valC.Y_Position.Numerator, AAFRESULT_TEST_FAILED); checkExpression (12 == valC.Y_Position.Denominator, AAFRESULT_TEST_FAILED); // test variable array of records // perform this part only for specified versions if( versionUInt(testVer) >= versionUInt(1,1,1,0) ) { IAAFPropertyDefSP pPdPosN; checkResult (defs.cdCompositionMob()->LookupPropertyDef (sPropertyId_positionN, &pPdPosN)); IAAFPropertyValueSP pPVN; checkResult (pObj->GetPropertyValue (pPdPosN, &pPVN)); // get the middle element of the array, 9abc IAAFPropertyValueSP pPVN1; checkResult (ptdvaarpr->GetElementValue (pPVN, 1, &pPVN1)); // Read the value with GetStruct Rational16pair_t valN1 = { {0,0},{0,0} }; checkResult (ptdr16p->GetStruct (pPVN1, (aafMemPtr_t) &valN1, sizeof (valN1))); checkExpression (9 == valN1.X_Position.Numerator, AAFRESULT_TEST_FAILED); checkExpression (10 == valN1.X_Position.Denominator, AAFRESULT_TEST_FAILED); checkExpression (11 == valN1.Y_Position.Numerator, AAFRESULT_TEST_FAILED); checkExpression (12 == valN1.Y_Position.Denominator, AAFRESULT_TEST_FAILED); } // Attempt to close the file. checkResult(pFile->Close()); IAAFFileSP nullFile; pFile = nullFile; // zeros the pFile, and releases it. hr = AAFRESULT_SUCCESS; } catch (HRESULT& rResult) { hr = rResult; } // cleanup if (pFile) { pFile->Close(); } return hr; }
static HRESULT ReadAAFFile(aafWChar* pFileName) { IAAFFileSP pFile; IAAFHeaderSP pHeader; IEnumAAFMobsSP pMobIter; IAAFMobSP pMob; IEnumAAFMobSlotsSP pSlotIter; IAAFMobSlotSP pSlot; IAAFComponentSP pComp; IAAFSegmentSP pSegment; IAAFDataDefSP pDataDef; IAAFSequenceSP pSequence; IAAFDictionarySP pDictionary; IEnumAAFComponentsSP pCompIter; aafNumSlots_t numMobs; aafSearchCrit_t criteria; HRESULT hr = S_OK; try { // Open the AAF file checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile)); // Get the AAF file header. checkResult(pFile->GetHeader(&pHeader)); // Validate that there is only one composition mob. checkResult(pHeader->CountMobs(kAAFCompMob, &numMobs)); checkExpression(1 == numMobs, AAFRESULT_TEST_FAILED); // Get the AAF Dictionary so that we can create valid AAF objects. checkResult(pHeader->GetDictionary(&pDictionary)); CAAFBuiltinDefs defs (pDictionary); // Check a data definition from a composition MOB in order to test weak references criteria.searchTag = kAAFByMobKind; criteria.tags.mobKind = kAAFCompMob; checkResult(pHeader->GetMobs(&criteria, &pMobIter)); while (pMobIter && pMobIter->NextOne(&pMob) == AAFRESULT_SUCCESS) { // Enumerate the first MOB slot for this MOB checkResult(pMob->GetSlots(&pSlotIter)); checkResult(pSlotIter->NextOne(&pSlot)); checkResult(pSlot->GetSegment(&pSegment)); checkResult(pSegment->QueryInterface(IID_IAAFSequence, (void **) &pSequence)); checkResult(pSequence->GetComponents(&pCompIter)); checkResult(pCompIter->NextOne(&pComp)); aafBool testBool; checkResult(pComp->GetDataDef(&pDataDef)); checkResult(pDataDef->IsSoundKind(&testBool)); checkExpression(testBool == kAAFFalse, AAFRESULT_TEST_FAILED); checkResult(pDataDef->IsDataDefOf(defs.ddkAAFPictureWithMatte(), &testBool)); checkExpression(testBool == kAAFTrue, AAFRESULT_TEST_FAILED); // Make sure first component is a filler, and is our extended // class. To do that, we'll compare the class def we looked // up in the dict, with the one we got from the new object. // // First get the class from the object. IAAFFillerSP pFill; checkResult(pComp->QueryInterface(IID_IAAFFiller, (void **) &pFill)); assert (pFill); IAAFObjectSP pObj; checkResult(pFill->QueryInterface(IID_IAAFObject, (void **) &pObj)); assert (pObj); IAAFClassDefSP pClassFromObj; checkResult (pObj->GetDefinition (&pClassFromObj)); assert (pClassFromObj); IUnknownSP pUnkFromObj; checkResult(pClassFromObj->QueryInterface(IID_IUnknown, (void **) &pUnkFromObj)); // Now get the class from the dict IAAFClassDefSP pClassFromDict; checkResult (pDictionary->LookupClassDef (kClassAUID_NewFill, &pClassFromDict)); assert (pClassFromDict); IUnknownSP pUnkFromDict; checkResult(pClassFromDict->QueryInterface(IID_IUnknown, (void **) &pUnkFromDict)); // Compare class from object with class from dict. Compare // using IUnknown pointers. assert (((IUnknown*)pUnkFromObj) == ((IUnknown*)pUnkFromDict)); // To test GetClassDefinitions(), try explicit lookup. IEnumAAFClassDefsSP pClassDefEnum; checkResult (pDictionary->GetClassDefs (&pClassDefEnum)); bool found = false; IAAFClassDefSP cd; while (SUCCEEDED (pClassDefEnum->NextOne (&cd))) { IAAFMetaDefinitionSP def; checkResult(cd->QueryInterface(IID_IAAFMetaDefinition, (void **) &def)); aafUID_t classid; checkResult (def->GetAUID (&classid)); if (EqualGUID (&classid, &kClassAUID_NewFill)) { // Found it the hard way. found = true; break; } } // make sure we found it the hard way. checkExpression(found == kAAFTrue, AAFRESULT_TEST_FAILED); // Get the 'odor' property from our new fill clip. Make // sure it is set to the value we think it should be // ('42'). // // First get the property def from the class. IAAFPropertyDefSP pPropDef; checkResult (pClassFromObj->LookupPropertyDef (kPropAUID_NewFill_Odor, &pPropDef)); // // Get the property value from the object IAAFPropertyValueSP pPropVal; checkResult (pObj->GetPropertyValue (pPropDef, &pPropVal)); // // We know the property is int32; get the int32 type def IAAFTypeDefSP ptd; checkResult (pDictionary->LookupTypeDef (kAAFTypeID_UInt32, &ptd)); IAAFTypeDefIntSP pTDUint32; checkResult(ptd->QueryInterface(IID_IAAFTypeDefInt, (void **) &pTDUint32)); assert (pTDUint32); // // Ask the typedef to interpret this property value for us. aafUInt32 odorValue = 0; checkResult (pTDUint32->GetInteger (pPropVal, (aafMemPtr_t) &odorValue, sizeof (odorValue))); // // make sure it's what we expect. assert (42 == odorValue); } checkResult (LookupDefs (pDictionary)); //Test the Lookup KLV and Tagged methods IAAFKLVDataDefinition *pKLVLook = NULL; IAAFTaggedValueDefinition *pTAGDefLook = NULL; IAAFDictionary2 *pDic2 = NULL; IAAFDefObject *pKLVDataDefObj = NULL; IAAFDefObject *pTaggedValueDefObj = NULL; aafUID_t auid; checkResult( pDictionary->QueryInterface( IID_IAAFDictionary2, reinterpret_cast<void**>(&pDic2) ) ); assert(pDic2); //test LookUpKLV() if(pDic2->LookupKLVDataDef(KLVDef_TestData, &pKLVLook) != AAFRESULT_SUCCESS) checkResult(AAFRESULT_TEST_FAILED); checkResult( pKLVLook->QueryInterface( IID_IAAFDefObject, reinterpret_cast<void**>(&pKLVDataDefObj) ) ); assert(pKLVDataDefObj); //ensure the KLVLook auid is equal to KLVDef_TestData auid checkResult(pKLVDataDefObj->GetAUID(&auid)); if(auid != KLVDef_TestData) checkResult(AAFRESULT_TEST_FAILED); //test LookUpTagged() if(pDic2->LookupTaggedValueDef(TAGDef_TestData, &pTAGDefLook) != AAFRESULT_SUCCESS) checkResult(AAFRESULT_TEST_FAILED); checkResult( pTAGDefLook->QueryInterface( IID_IAAFDefObject, reinterpret_cast<void**>(&pTaggedValueDefObj) ) ); assert(pTaggedValueDefObj); //ensure the TAGDefLook auid is equal to TAGDef_TestData auid checkResult(pTaggedValueDefObj->GetAUID(&auid)); if(auid != TAGDef_TestData) checkResult(AAFRESULT_TEST_FAILED); //cleanup pDic2->Release(); pDic2 = NULL; pKLVLook->Release(); pKLVLook = NULL; pTAGDefLook->Release(); pTAGDefLook = NULL; pKLVDataDefObj->Release(); pKLVDataDefObj = NULL; pTaggedValueDefObj->Release(); pTaggedValueDefObj = NULL; } catch (HRESULT& rResult) { hr = rResult; } // Cleanup and return. if (pFile) { pFile->Close(); } return hr; }
static HRESULT CreateAAFFile( aafWChar * pFileName, aafUID_constref fileKind, testRawStorageType_t rawStorageType, aafProductIdentification_constref productID) { IAAFFileSP pFile; IAAFHeaderSP pHeader; IAAFDictionarySP pDictionary; IAAFMobSP pMob; IAAFTimelineMobSlotSP pMobSlot; IAAFSequenceSP pSequence; IAAFSegmentSP pSegment; IAAFComponentSP pComponent; 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 )); // 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)); // Create a new class, and register it in the dictionary. RegisterNewClass (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"AAFDictionaryTest")); // 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 back). // for(i = 0; i < kNumComponents; i++) { aafLength_t len = 10; // For the first component, make it our extended filler. if(i == 0) { IAAFClassDefSP pNewFillClassDef; checkResult(pDictionary->LookupClassDef(kClassAUID_NewFill, &pNewFillClassDef)); checkResult (pNewFillClassDef->CreateInstance(IID_IAAFComponent, (IUnknown**)&pComponent)); checkResult(pComponent->SetDataDef(defs.ddkAAFPictureWithMatte())); } else { checkResult (defs.cdFiller()->CreateInstance(IID_IAAFComponent, (IUnknown**)&pComponent)); checkResult(pComponent->SetDataDef(defs.ddkAAFPicture())); } checkResult(pComponent->SetLength(len)); checkResult(pSequence->AppendComponent(pComponent)); // For our first component, set the 'odor' value. Must be // done after the component has been inserted in sequence. if (i == 0) { // Set the odor value. // // 1) Get type def for uint32 IAAFTypeDefSP ptd; checkResult (pDictionary->LookupTypeDef (kAAFTypeID_UInt32, &ptd)); assert (ptd); IAAFTypeDefIntSP pTDUint32; checkResult(ptd->QueryInterface (IID_IAAFTypeDefInt, (void **)&pTDUint32)); assert (pTDUint32); // 2) Create a property value for the odor property, and // set it to 42. IAAFPropertyValueSP pVal; const aafUInt32 odorValue = 42; checkResult (pTDUint32->CreateValue ((aafMemPtr_t) &odorValue, sizeof (odorValue), &pVal)); // 3) Look up the property def for the odor property in // the new fill class. IAAFClassDefSP pNewFillClass; checkResult (pDictionary->LookupClassDef (kClassAUID_NewFill, &pNewFillClass)); IAAFPropertyDefSP pPropDef; checkResult (pNewFillClass->LookupPropertyDef (kPropAUID_NewFill_Odor, &pPropDef)); // 4) Get IAAFObject interface for new fill object, and // set the odor property. IAAFObjectSP pObj; checkResult(pComponent->QueryInterface (IID_IAAFObject, (void **)&pObj)); checkResult (pObj->SetPropertyValue (pPropDef, pVal)); } } checkResult(pSequence->QueryInterface (IID_IAAFSegment, (void **)&pSegment)); aafRational_t editRate = { 0, 1}; checkResult(pMob->AppendNewTimelineSlot(editRate, pSegment, 1, L"AAF Test Sequence", 0, &pMobSlot)); // Add the master mob to the file and cleanup pHeader->AddMob(pMob); checkResult (RegisterDefs (pDictionary)); testKLVDataDefinitions(pDictionary, pMob); testTaggedDefinitions(pDictionary, pMob); } catch (HRESULT& rResult) { hr = rResult; } // Cleanup and return if (pFile) { pFile->Save(); pFile->Close(); } return hr; }
static HRESULT verifyContents (IAAFHeader* const pHeader, IAAFDictionary* const pDict, const aafBoolean_t bMinimalTesting) { //CAAFBuiltinDefs defs (pDict); HRESULT hr; ///////////////////////////////////////// // Check the MOb stuff IAAFMobSP spMob; checkResult(pHeader->LookupMob (TEST_MobID, &spMob)); aafNumSlots_t numSlots = 0; checkResult(spMob->CountSlots (&numSlots)); // we only put one in assert (1 == numSlots); IEnumAAFMobSlotsSP spSlotEnum; checkResult(spMob->GetSlots (&spSlotEnum)); // Since we only put one in, just bother with the first one. IAAFMobSlotSP spMobSlot; checkResult(spSlotEnum->NextOne (&spMobSlot)); aafCharacter buf[128] = {0}; checkResult(spMobSlot->GetName(buf, 128)); checkExpression( wcscmp(buf, TEST_SLOT_NAME) == 0, AAFRESULT_TEST_FAILED ); aafSlotID_t slotid = {0}; checkResult(spMobSlot->GetSlotID(&slotid)); checkExpression( slotid == TEST_SLOT_ID, AAFRESULT_TEST_FAILED ); // Get the segment; it's got to be our filler. IAAFSegmentSP spSegment; checkResult(spMobSlot->GetSegment (&spSegment)); // Get filler interface IAAFFillerSP spFill; checkResult(spSegment->QueryInterface(IID_IAAFFiller, (void**)&spFill)); //Make sure Property is preset! Can't do anything without it //handy - QI filler for Object intf. IAAFObjectSP spObj; checkResult(spFill->QueryInterface(IID_IAAFObject, (void**)&spObj)); //Get the property def for Component::FA IAAFClassDefSP spCD_comp; checkResult(pDict->LookupClassDef(AUID_AAFComponent, &spCD_comp)); //From Class Def, get the Property Def IAAFPropertyDefSP spPD_comp; checkResult(spCD_comp->LookupPropertyDef(TEST_PROP_ID, &spPD_comp)); //Verify that optional property is not yet present in object aafBoolean_t bIsPresent = kAAFFalse; checkResult(spObj->IsPropertyPresent(spPD_comp, &bIsPresent)); checkExpression(bIsPresent == kAAFTrue, AAFRESULT_TEST_FAILED); ////////////////////////////////////// //get the value IAAFPropertyValueSP spPropVal; checkResult(spObj->GetPropertyValue(spPD_comp, &spPropVal)); //Get the Fixed Array typedef //first, get the Type Def from the Property def IAAFTypeDefSP spTypeDef; checkResult(spPD_comp->GetTypeDef(&spTypeDef)); //now get the FA intf IAAFTypeDefFixedArraySP spFA; checkResult(spTypeDef->QueryInterface(IID_IAAFTypeDefFixedArray, (void**)&spFA)); //get the array out of it ... TEST_ELEM_t check_fa [TEST_FA_COUNT] = {0}; //init a checking variable //IAAFTypeDefFixedArray::GetCount() aafUInt32 check_count = 0; checkResult(spFA->GetCount(&check_count)); checkExpression( check_count == TEST_FA_COUNT, AAFRESULT_TEST_FAILED ); //IAAFTypeDefFixedArray::GetType() IAAFTypeDefSP spTestType; checkResult(spFA->GetType(&spTestType)); //Look up our elem Type def IAAFTypeDefSP spTD_elem; checkResult(pDict->LookupTypeDef (TEST_ELEM_TYPE_ID, &spTD_elem)); //!!! checkExpression( AreUnksSame(spTestType, spTD_elem), AAFRESULT_TEST_FAILED ); //IAAFTypeDefFixedArray::GetCArray() aafUInt32 i=0; checkResult(spFA->GetCArray(spPropVal, (aafMemPtr_t) check_fa, sizeof(check_fa))); //VERIFY values: for (i=0; i<TEST_FA_COUNT; i++) checkExpression( check_fa[i] == TEST_FA_VALUES[i], AAFRESULT_TEST_FAILED ); //At this point, the test is succesful for both the CREATE and READ (unscrambling of .aaf file) routines if (bMinimalTesting) // so, bail if we're called from CREATE return S_OK; ///// READ routine .... continue with more tests .................... //IAAFTypeDefFixedArray::GetElementValue //Get 3rd index out of array aafUInt32 test_index = 2; IAAFPropertyValueSP spSomeVal; checkResult(spFA->GetElementValue(spPropVal, test_index, &spSomeVal)); //Make sure both have same types ... checkResult(spSomeVal->GetType(&spTestType)); //!!! checkExpression( AreUnksSame(spTestType, spTD_elem), AAFRESULT_TEST_FAILED ); //now, test spSomeVal for integer IAAFTypeDefIntSP spSomeInt; checkResult(spTestType->QueryInterface(IID_IAAFTypeDefInt, (void**)&spSomeInt)); TEST_ELEM_t some_int = -1; checkResult(spSomeInt->GetInteger(spSomeVal, (aafMemPtr_t)&some_int, sizeof (some_int))); checkExpression( some_int == TEST_FA_VALUES[test_index], AAFRESULT_TEST_FAILED ); //IAAFTypeDefFixedArray::SetCArray const TEST_ELEM_t newArray[TEST_FA_COUNT] = {99, -99, 22, -22, 120}; checkResult(spFA->SetCArray (spPropVal, (aafMemPtr_t) newArray, sizeof(newArray))); //Verify that the new values are set .... // .... call GetCArray checkResult(spFA->GetCArray(spPropVal, (aafMemPtr_t) check_fa, sizeof(check_fa))); for (i=0; i<TEST_FA_COUNT; i++) checkExpression( check_fa[i] == newArray[i], AAFRESULT_TEST_FAILED ); //Test IAAFTypeDefFixedArray::IAAFTypeDefArray::SetElementValue() .... some_int = -13; checkResult(spSomeInt->CreateValue((aafMemPtr_t)&some_int, sizeof (some_int), &spSomeVal)); //try to set the value out-of-bounds hr = spFA->SetElementValue(spPropVal, 5, spSomeVal); //5 is one elem out of bounds checkExpression( hr == AAFRESULT_BADINDEX, AAFRESULT_TEST_FAILED ); //Set the element to last index ... checkResult(spFA->SetElementValue(spPropVal, 4, spSomeVal)); //4 is last index position //Now get back the element ... checkResult(spFA->GetElementValue(spPropVal, 4, &spSomeVal)); some_int = 0; //reset value checkResult(spSomeInt->GetInteger(spSomeVal, (aafMemPtr_t)&some_int, sizeof (some_int))); //verify retrieved integer checkExpression( -13 == some_int , AAFRESULT_TEST_FAILED ); //// //IAAFTypeDefArray::CreateValueFromValues () const TEST_ELEM_t newsize_array[7] = {10, -20, 30, -44, 55, -360, 11}; aafUInt32 bad_count = 7; IAAFPropertyValue * pSourceValArr[7]; //setup for (i=0; i<bad_count; i++) checkResult(spSomeInt->CreateValue((aafMemPtr_t)&newsize_array[i], sizeof (some_int), &pSourceValArr[i])); IAAFPropertyValueSP spTargetValArr; hr = spFA->CreateValueFromValues(pSourceValArr, bad_count, &spTargetValArr ); checkExpression(AAFRESULT_DATA_SIZE == hr, AAFRESULT_TEST_FAILED); //ok try again, with the correct count aafUInt32 good_count = 5; checkResult(spFA->CreateValueFromValues(pSourceValArr, good_count, &spTargetValArr )); //done with creating Target ValArr; release Source ValArr elements for (i=0; i<bad_count; i++) pSourceValArr[i]->Release(); //verify spPropValArr values TEST_ELEM_t check2_fa [5] = {0}; //init a checking variable checkResult(spFA->GetCArray(spTargetValArr, (aafMemPtr_t) check2_fa, sizeof(check2_fa))); for (i=0; i<good_count; i++) checkExpression( check2_fa[i] == newsize_array[i], AAFRESULT_TEST_FAILED ); //another negative test ... //check for bad size request : like, say 6 elements const TEST_ELEM_t badSize_array[TEST_FA_COUNT+1] = {99, -2, 78, -12, 77, -55}; hr = spFA->SetCArray (spPropVal, (aafMemPtr_t) badSize_array, sizeof(badSize_array)); //we should have got back a BAD SIZE!!!! checkExpression( hr == AAFRESULT_BAD_SIZE, AAFRESULT_TEST_FAILED ); return S_OK; }//verifyContents()
static HRESULT verifyContents (IAAFHeader* const pHeader, IAAFDictionary* const pDict, const aafBoolean_t bMinimalTesting) { //CAAFBuiltinDefs defs (pDict); ///////////////////////////////////////// // Check the MOb stuff IAAFMobSP spMob; checkResult(pHeader->LookupMob (TEST_MobID, &spMob)); aafNumSlots_t numSlots = 0; checkResult(spMob->CountSlots (&numSlots)); // we only put one in assert (1 == numSlots); IEnumAAFMobSlotsSP spSlotEnum; checkResult(spMob->GetSlots (&spSlotEnum)); // Since we only put one in, just bother with the first one. IAAFMobSlotSP spMobSlot; checkResult(spSlotEnum->NextOne (&spMobSlot)); aafCharacter buf[128] = {0}; checkResult(spMobSlot->GetName(buf, 128*sizeof(aafCharacter))); checkExpression( wcscmp(buf, TEST_SLOT_NAME) == 0, AAFRESULT_TEST_FAILED ); aafSlotID_t slotid = {0}; checkResult(spMobSlot->GetSlotID(&slotid)); checkExpression( slotid == TEST_SLOT_ID, AAFRESULT_TEST_FAILED ); // Get the segment; it's got to be our filler. IAAFSegmentSP spSegment; checkResult(spMobSlot->GetSegment (&spSegment)); // Get filler interface IAAFFillerSP spFill; checkResult(spSegment->QueryInterface(IID_IAAFFiller, (void**)&spFill)); //Make sure Property is preset! Can't do anything without it //handy - QI filler for Object intf. IAAFObjectSP spObj; checkResult(spFill->QueryInterface(IID_IAAFObject, (void**)&spObj)); //Get the property def for Component::CHAR IAAFClassDefSP spCD_comp; checkResult(pDict->LookupClassDef(AUID_AAFComponent, &spCD_comp)); //From Class Def, get the Property Def IAAFPropertyDefSP spPD_comp; checkResult(spCD_comp->LookupPropertyDef(TEST_PROP_ID, &spPD_comp)); //Verify that optional property is present in object aafBoolean_t bIsPresent = kAAFFalse; checkResult(spObj->IsPropertyPresent(spPD_comp, &bIsPresent)); checkExpression(bIsPresent == kAAFTrue, AAFRESULT_TEST_FAILED); ////////////////////////////////////// //get the value IAAFPropertyValueSP spPropVal; checkResult(spObj->GetPropertyValue(spPD_comp, &spPropVal)); //Our CHARING PropVal //Get the typedef //first, get the Type Def from the Property def IAAFTypeDefSP spTypeDef; checkResult(spPD_comp->GetTypeDef(&spTypeDef)); //now get the CHAR intf IAAFTypeDefCharacterSP spCHAR; checkResult(spTypeDef->QueryInterface(IID_IAAFTypeDefCharacter, (void**)&spCHAR)); //get aafCharacter test_char = 0; //init a checking variable; select a reasonable size buffer //IAAFTypeDefCharacter::GetCharacter() checkResult(spCHAR->GetCharacter(spPropVal, &test_char)); //VERIFY values: checkExpression( test_char == TEST_CHAR_VALUE, AAFRESULT_TEST_FAILED ); //At this point, the test is succesful for both the CREATE and READ (unscrambling of .aaf file) routines if (bMinimalTesting) // so, bail if we're called from CREATE return S_OK; ///// READ routine .... continue with more tests .................... //Do a Set/Get character operation pari ... const aafCharacter TEST_Char = 'b'; checkResult(spCHAR->SetCharacter(spPropVal, TEST_Char)); //Now get it back test_char = 0; //reset variable before the readback checkResult(spCHAR->GetCharacter(spPropVal, &test_char)); //verify the read-back checkExpression( test_char == TEST_Char, AAFRESULT_TEST_FAILED ); return S_OK; }//verifyContents()