当前位置: 首页>>代码示例>>C++>>正文


C++ IAAFTypeDef::Release方法代码示例

本文整理汇总了C++中IAAFTypeDef::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ IAAFTypeDef::Release方法的具体用法?C++ IAAFTypeDef::Release怎么用?C++ IAAFTypeDef::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAAFTypeDef的用法示例。


在下文中一共展示了IAAFTypeDef::Release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
  }
}
开发者ID:mcanthony,项目名称:aaf,代码行数:61,代码来源:extensionUtils.cpp

示例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;
}
开发者ID:mcanthony,项目名称:aaf,代码行数:71,代码来源:AAFDomainUtils.cpp

示例3: 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 ();
}
开发者ID:mcanthony,项目名称:aaf,代码行数:10,代码来源:CAAFTypeDefRecordTest.cpp

示例4: 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;
}
开发者ID:mcanthony,项目名称:aaf,代码行数:51,代码来源:CAAFDictionaryTest.cpp

示例5: 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;
}
开发者ID:mcanthony,项目名称:aaf,代码行数:62,代码来源:AAFDomainUtils.cpp

示例6: 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;
} 
开发者ID:mcanthony,项目名称:aaf,代码行数:19,代码来源:CAAFTypeDefIntTest.cpp

示例7: ReadAAFFile

static void ReadAAFFile(aafWChar * pFileName)
{
    HRESULT hr = S_OK;
    IAAFFile * pFile = NULL;

    hr = AAFFileOpenExistingRead (pFileName, AAF_FILE_MODE_LAZY_LOADING, &pFile);
    if (SUCCEEDED(hr))
    {
        IAAFHeader * pHeader = NULL;

        hr = pFile->GetHeader(&pHeader);
        check(hr); // display error message
        if (SUCCEEDED(hr))
        {
            IAAFIdentification *    pIdent = NULL;

            hr = pHeader->GetLastIdentification(&pIdent);
            check(hr); // display error message
            if (SUCCEEDED(hr))
            {
                printIdentification(pIdent);

                pIdent->Release();
                pIdent = NULL;

                // count Mobs
                aafNumSlots_t n;
                hr = pHeader->CountMobs(kAAFAllMob, &n);
                check(hr);
                printf("\nNumber of Mobs       = %d\n", n);

                // Header::Version, Header::ObjectModelVersion
                aafVersionType_t version = {0};
                check(pHeader->GetFileRevision (&version) );
                printf("\nHeader::Version      = %d.%d\n", version.major, version.minor);

                aafFileRev_t fileVersion = kAAFRev1;
                check(pFile->GetRevision (&fileVersion) );
                printf("\nHeader::ObjectModelVersion = %d", fileVersion);

                if (fileVersion == kAAFRev1)
                    printf(" (recognized as kAAFRev1)\n");
                else if (fileVersion == kAAFRev2)
                    printf(" (recognized as kAAFRev2)\n");
                else
                    printf("\n");

                // Show datadefs, with version
                IEnumAAFDataDefsSP pEnumDataDef;
                IAAFDictionarySP pDictionary;
                check(pHeader->GetDictionary(&pDictionary));
                check(pDictionary->GetDataDefs(&pEnumDataDef));
                IAAFDataDef* pDataDef;

                printf("\nDatadefs             = ");
                while (SUCCEEDED(pEnumDataDef->NextOne(&pDataDef)))
                {
                    IAAFDefObjectSP pDefObject;
                    check(pDataDef->QueryInterface(IID_IAAFDefObject, (void**)&pDefObject));
                    pDataDef->Release();
                    pDataDef = NULL;

                    aafUID_t id = {0};
                    check(pDefObject->GetAUID(&id));

                    aafWChar wchName[500];
                    char chName[1000];
                    check( pDefObject->GetName(wchName, sizeof (wchName)) );
                    convert(chName, sizeof(chName), wchName);

                    if (memcmp( &id, &kAAFDataDef_LegacyPicture, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as legacy Picture)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_Picture, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as Picture)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_LegacySound, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as legacy Sound)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_Sound, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as Sound)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_LegacyTimecode, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as legacy Timecode)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_Timecode, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as Timecode)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_PictureWithMatte, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as PictureWithMatte)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_Edgecode, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as Edgecode)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_Auxiliary, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as Auxiliary)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_DescriptiveMetadata, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as DescriptiveMetadata)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_Matte, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as Matte)\n", chName);
                    else
                        printf("\"%s\"\n", chName);
                    printf("                       ");
                }

                // Check if file contains TypeDefs known to cause a v1.0 reader to assert.
                // Known instances of this are UInt32Set and AUIDSet added to the v1.1 SDK.
                // Cannot use Dictionary::LookupTypeDef to check for them, because this
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:AAFInfo.cpp

示例8: 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
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CAAFControlPointTest.cpp

示例9: 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);
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CAAFControlPointTest.cpp

示例10: 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
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CAAFPropertyValueTest.cpp

示例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;
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CAAFTypeDefRecordTest.cpp

示例12: ReadAAFFile


//.........这里部分代码省略.........
      														  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);
		  checkTimeStampsAreEqual(modificationTimeStamp, modified);
		  checkExpression (wcscmp(mobName, name) == 0, AAFRESULT_TEST_FAILED);

		  checkExpression(aMob->CountSlots (NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
		  checkResult(aMob->CountSlots (&numSlots));

		  //seven slots made by IAAFMob and  one static slot and event slot made throught IAAFMOb2
		  checkExpression((7+1+1) == numSlots, AAFRESULT_TEST_FAILED);

		  checkExpression(aMob->GetSlots(NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
		  checkResult(aMob->GetSlots(&slotIter));

		  for(s = 0; s < numSlots; s++)
			{
			  checkResult(slotIter->NextOne (&slot));
			  checkResult(slot->GetNameBufLen(&bufLen));
			  checkResult(slot->GetName (slotName, bufLen));
			  checkResult(slot->GetSlotID(&trackID));
			  checkExpression (wcscmp(slotName, slotNames[s]) == 0, AAFRESULT_TEST_FAILED);
			  checkExpression(trackID == (s+1), AAFRESULT_TEST_FAILED);

			  slot->Release();
			  slot = NULL;
			  bufLen = 0;
			  trackID = 0;
			}
			slotIter->Release();
			slotIter = NULL;
			
			// GetSlotAt
			checkExpression(aMob->GetSlotAt(1, NULL) == AAFRESULT_NULL_PARAM,
														AAFRESULT_TEST_FAILED);
			checkExpression(aMob->GetSlotAt(9, &slot) == AAFRESULT_BADINDEX,
														AAFRESULT_TEST_FAILED);
			for (s = 0; s < numSlots; ++s)
			{
				checkResult(aMob->GetSlotAt(s, &slot));
				checkResult(slot->GetNameBufLen(&bufLen));
				checkResult(slot->GetName(slotName, bufLen));
				checkResult(slot->GetSlotID(&trackID));
				checkExpression(wcscmp(slotName, slotNames[s]) == 0, AAFRESULT_TEST_FAILED);
				checkExpression(trackID == (s+1), AAFRESULT_TEST_FAILED);	

				if ( 0 < s && s < 5 ) // These are the SourceClips
				{
					checkResult(slot->GetSegment(&pSegment));
			  		checkResult(pSegment->QueryInterface (IID_IAAFSourceClip, (void **)&pSourceClip));
				  	checkResult(pSourceClip->QueryInterface (IID_IAAFSourceReference, (void **)&pSourceRef));
				    checkResult(pSourceRef->GetSourceID(&sourceID));
				    checkExpression(memcmp(&sourceID, &MOBTestID3, sizeof(aafMobID_t)) == 0,
				    													 AAFRESULT_TEST_FAILED);
			  		pSourceRef->Release();
			  		pSourceRef = NULL;
			  		pSourceClip->Release();
开发者ID:mcanthony,项目名称:aaf,代码行数:67,代码来源:CAAFMobTest.cpp

示例13: WriteRecord


//.........这里部分代码省略.........
	  //checkResult (defs.cdTypeDefRecord()->
	  // CreateInstance (IID_IAAFTypeDefRecord,
	  // (IUnknown**)&ptdr16p));
	  checkResult (pDict->
				   CreateMetaInstance (kAAFClassID_TypeDefRecord,
									   IID_IAAFTypeDefRecord,
									   (IUnknown**) &ptdr16p));

	  IAAFTypeDef * pTempTd = 0;
	  checkResult (ptdr16->QueryInterface (IID_IAAFTypeDef,
										  (void**) &pTempTd));	  
	  IAAFTypeDef* tdr16pMemberTypes[] =
	  {pTempTd,
	   pTempTd};
	  aafWChar xpos[] = L"X Position";
	  aafWChar ypos[] = L"Y Position";
	  aafString_t tdr16pMemberNames[] =
	  {xpos,
	   ypos};
	  checkResult (ptdr16p->Initialize (sTypeId_Rational16_pair,
									   tdr16pMemberTypes,
									   tdr16pMemberNames,
									   2,
									   L"Rational16Pair"));
	  // check for duplicate initialization
	  temphr = ptdr16p->Initialize (sTypeId_Rational16,
								   tdr16pMemberTypes,
								   tdr16pMemberNames,
								   2,
								   L"Rational16Pair");
	  checkExpression (AAFRESULT_ALREADY_INITIALIZED == temphr,
					   AAFRESULT_TEST_FAILED);

	  pTempTd->Release ();
	  pTempTd = 0;
	  checkResult (ptdr16p->QueryInterface (IID_IAAFTypeDef, (void**) &ptd));
	  checkResult (pDict->RegisterTypeDef (ptd));

	  // 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));

	  // 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) )
	  {
		//Create a Variable Array
		checkResult(pDict->CreateMetaInstance (AUID_AAFTypeDefVariableArray, IID_IAAFTypeDefVariableArray, (IUnknown **) &ptdvaarpr));
		
		//IAAFTypeDefVariableArray::Initialize
		checkResult(ptdvaarpr->Initialize(sTypeId_Rational16_array, ptd, L"Rational16PairArray"));
		
		//  Register our new VA type def :
		checkResult(ptdvaarpr->QueryInterface(IID_IAAFTypeDef, (void**)&ptdarpr));
		checkResult(pDict->RegisterTypeDef(ptdarpr));
	  }
开发者ID:mcanthony,项目名称:aaf,代码行数:66,代码来源:CAAFTypeDefRecordTest.cpp

示例14: GetObjRefArrayPropFromObject

//***********************************************************
//
//	GetObjRefArrayPropFromObject()
//
//	Get an object reference array property on the AAF object
//	specified by pObj.  The value of the property is returned
//	in pArray.
//
//	Returns:
//
//		On Success: S_OK
//		On Failure: A failed HRESULT
//
HRESULT AAFDomainUtils::GetObjRefArrayPropFromObject(IAAFObject* pObj, aafUID_t* pClassID, const aafUID_t* pPropTypeID, aafUID_t* pPropID, IAAFObject*** pArray, aafUInt32* pNumObjects)
{
    IAAFTypeDefVariableArray*	pTDVarArray = NULL;
    IAAFPropertyValue*			pPVVarArray = NULL;
    IAAFTypeDefObjectRef*		pTDArrayElement = 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, &pPVVarArray);
            else
                hr = AAFRESULT_PROP_NOT_PRESENT;

            pPD->Release();
        }
        pCD->Release();
    }

    // Get the property type def from the dictionary to interpret this property value.
    if (SUCCEEDED(hr))
    {
        IAAFTypeDef* pTD;

        hr = _dict->LookupTypeDef(*pPropTypeID, &pTD);
        if (SUCCEEDED(hr))
        {
            hr = pTD->QueryInterface(IID_IAAFTypeDefVariableArray, (void**)&pTDVarArray);
            pTD->Release();
        }
    }

    // Get the array element type def to interpret the element property value.
    if (SUCCEEDED(hr))
    {
        IAAFTypeDef*	pTDElement;

        hr = pTDVarArray->GetType(&pTDElement);
        if (SUCCEEDED(hr))
        {
            pTDElement->QueryInterface(IID_IAAFTypeDefObjectRef, (void **)&pTDArrayElement);
            pTDElement->Release();
        }
    }

    // Get each element out of the property, convert them to an IAAFObject pointer and
    // add them to the array of object which is returned to the user.
    if (SUCCEEDED(hr))
    {
        IAAFObject**	pTempArray;
        aafUInt32		count = 0, numElements = 0;

        pTDVarArray->GetCount(pPVVarArray, &count);
        pTempArray = new IAAFObject* [count];
        if (pTempArray)
        {
            for (aafUInt32 i = 0; i < count; i++)
            {
                IAAFPropertyValue*	pPVElement;

                hr = pTDVarArray->GetElementValue(pPVVarArray, i, &pPVElement);
                if (SUCCEEDED(hr))
                {
                    IAAFObject*	pTempObj;

                    hr = pTDArrayElement->GetObject(pPVElement, IID_IAAFObject, (IUnknown **)&pTempObj);
                    if (SUCCEEDED(hr))
                    {
                        pTempArray[numElements] = pTempObj;
                        numElements++;
                    }
                    pPVElement->Release();
                }
            }
            if (numElements == 0)
            {
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:AAFDomainUtils.cpp

示例15: SetObjRefArrayPropOnObject

//***********************************************************
//
//	SetObjRefArrayPropOnObject()
//
//	Set an object reference array property on the AAF object
//	specified by pObj.  The value of the property is specified
//	in pArray.
//
//	Returns:
//
//		On Success: S_OK
//		On Failure: A failed HRESULT
//
HRESULT AAFDomainUtils::SetObjRefArrayPropOnObject(IAAFObject* pObj, aafUID_t* pClassID, const aafUID_t* pPropTypeID, const aafUID_t* pElementTypeID, aafUID_t* pPropID, IAAFObject** pArray, aafUInt32 numObjects)
{
    IAAFPropertyValue*	pPVArray = NULL;
    IAAFTypeDef*		pTD;
    HRESULT				hr;

    // For each object in the source array, create a property value
    // and append it to the property value for the variable array.
    hr = _dict->LookupTypeDef(*pPropTypeID, &pTD);
    if (SUCCEEDED(hr))
    {
        IAAFTypeDefVariableArray*	pTDVarArray;

        hr = pTD->QueryInterface(IID_IAAFTypeDefVariableArray, (void**)&pTDVarArray);
        if (SUCCEEDED(hr))
        {
            IAAFTypeDef*	pTDElement;

            hr = _dict->LookupTypeDef(*pElementTypeID, &pTDElement);
            if (SUCCEEDED(hr))
            {
                IAAFTypeDefObjectRef*	pTDObjRef;

                hr = pTDElement->QueryInterface (IID_IAAFTypeDefObjectRef, (void **)&pTDObjRef);
                if (SUCCEEDED(hr))
                {
                    for (aafUInt32 i = 0; i < numObjects; i++)
                    {
                        IAAFPropertyValue* pPVObject;

                        hr = pTDObjRef->CreateValue(pArray[i], &pPVObject);
                        if (SUCCEEDED(hr))
                        {
                            if (pPVArray == NULL)
                                pTDVarArray->CreateEmptyValue(&pPVArray);

                            hr = pTDVarArray->AppendElement(pPVArray, pPVObject);
                            pPVObject->Release();
                        }
                    }
                    pTDObjRef->Release();
                }
                pTDElement->Release();
            }
            pTDVarArray->Release();
        }
        pTD->Release();
    }

    // If the object reference array was successfully created,
    // set the property value on the target object.
    if (pPVArray)
    {
        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))
            {
                hr = pObj->SetPropertyValue(pPD, pPVArray);
                pPD->Release();
            }
            pCD->Release();
        }
        pPVArray->Release();
    }

    return hr;
}
开发者ID:mcanthony,项目名称:aaf,代码行数:87,代码来源:AAFDomainUtils.cpp


注:本文中的IAAFTypeDef::Release方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。