static void RegisterDataEssenceDescriptorTest( IAAFDictionary* pDict ) { // Create a new class definition for the TestDescriptiveFramework. IAAFSmartPointer<IAAFClassDef> pClassDef; checkResult( pDict->CreateMetaInstance( AUID_AAFClassDef, IID_IAAFClassDef, (IUnknown**)&pClassDef ) ); IAAFSmartPointer<IAAFClassDef> pBaseClassDef; checkResult( pDict->LookupClassDef( AUID_AAFDataEssenceDescriptor, &pBaseClassDef ) ); checkResult( pClassDef->Initialize( TestDataEssenceDescriptorClassID, pBaseClassDef, L"TestDataEssenceDescriptor", kAAFTrue ) ); checkResult( pDict->RegisterClassDef( pClassDef ) ); }
static void RegisterDescriptiveTestFramework( IAAFSmartPointer<IAAFDictionary>& pDict ) { using namespace mtc; // Create a new class definition for the TestDescriptiveFramework. IAAFSmartPointer<IAAFClassDef> pClassDef; CheckResult( pDict->CreateMetaInstance( AUID_AAFClassDef, IID_IAAFClassDef, (IUnknown**)&pClassDef ) ); IAAFSmartPointer<IAAFClassDef> pBaseClassDef; CheckResult( pDict->LookupClassDef( AUID_AAFDescriptiveFramework, &pBaseClassDef ) ); CheckResult( pClassDef->Initialize( TestDesciptiveFrameworkClassID, pBaseClassDef, L"TestDescriptiveFramework", kAAFTrue ) ); CheckResult( pDict->RegisterClassDef( pClassDef ) ); }
static HRESULT CreateAAFFile( aafWChar * pFileName, aafUID_constref fileKind, testRawStorageType_t rawStorageType, aafProductIdentification_constref productID) { mtc::SimpleFilePointers filePointers; try { using namespace mtc; IAAFSmartPointer<IAAFHeader> pHeader; IAAFSmartPointer<IAAFDictionary> pDict; CreateSimpleAAFFile( pFileName, fileKind, rawStorageType, productID, &filePointers ); // Add add a timeline, and add a DescriptiveMarker to the // composition mob. IAAFSmartPointer<IAAFDescriptiveMarker> pDescMarker; CheckResult( filePointers.pDictionary->CreateInstance( AUID_AAFDescriptiveMarker, IID_IAAFDescriptiveMarker, (IUnknown**)&pDescMarker )); CheckResult( pDescMarker->Initialize() ); IAAFSmartPointer<IAAFSegment> pSeg; CheckResult(pDescMarker->QueryInterface( IID_IAAFSegment, (void**)&pSeg )); IAAFSmartPointer<IAAFComponent> pComp; CheckResult( pDescMarker->QueryInterface( IID_IAAFComponent, (void**)&pComp )); CheckResult( pComp->SetDataDef( filePointers.pDataDef )); IAAFSmartPointer<IAAFTimelineMobSlot> pNewSlot; CheckResult( filePointers.pCompositionMob->AppendNewTimelineSlot(TEST_EditRate, pSeg, 2, L"Descriptive Content", 0, &pNewSlot )); // Attach a (concrete) descriptive framework object to the marker. RegisterDescriptiveTestFramework( filePointers.pDictionary ); IAAFSmartPointer<IAAFDescriptiveFramework> pDescFramework; CheckResult( filePointers.pDictionary->CreateInstance( TestDesciptiveFrameworkClassID, IID_IAAFDescriptiveFramework, (IUnknown**)&pDescFramework ) ); CheckResult( pDescMarker->SetDescriptiveFramework( pDescFramework ) ); // Get described slots - should not be present. aafUInt32 size = 0; HRESULT hr = pDescMarker->GetDescribedSlotIDsSize( &size ); CheckExpression( AAFRESULT_PROP_NOT_PRESENT == hr, AAFRESULT_TEST_FAILED ); // Set/Get single described slot. aafUInt32 setSingleSlotID = 0xdeadbeef; CheckResult( pDescMarker->SetDescribedSlotIDs( 1, &setSingleSlotID ) ); aafUInt32 getSingleSlotID = 0; CheckResult( pDescMarker->GetDescribedSlotIDs( 1, &getSingleSlotID ) ); CheckExpression( setSingleSlotID == getSingleSlotID, AAFRESULT_TEST_FAILED ); // Set the persistent described slots. CheckResult( pDescMarker->SetDescribedSlotIDs( TestDescribedIDsVectorSize, TestDescribedSlotIDsVector ) ); CheckResult( filePointers.pFile->Save() ); CheckResult( filePointers.pFile->Close() ); } catch( const AAFRESULT& hr ) { if(filePointers.pFile) { filePointers.pFile->Close(); } return hr; } return AAFRESULT_SUCCESS; }