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


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

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


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

示例1: SetIntegerPropOnObject

//***********************************************************
//
//	SetIntegerPropOnObject()
//
//	Set an integer property to the AAF object specified by pObj.
//	The value of the property is specified in value.
//
//	Returns:
//
//		On Success: AAFRESULT_SUCCESS
//		On Failure: An exception.
//
HRESULT AAFDomainUtils::SetIntegerPropOnObject(IAAFObject* pObj, aafUID_t* pClassID, aafUID_t* pPropID, const aafUID_t* pIntTypeID,
        aafMemPtr_t pValue, aafUInt32 ValueSize, IAAFDictionary *dict)
{
    AAFCheck			hr;

    // Create a property value from the supplied value (pValue)
    IAAFTypeDef*		pTD;
    hr = dict->LookupTypeDef(*pIntTypeID, &pTD);
    AutoRelease<IAAFTypeDef> r1( pTD );

    IAAFTypeDefInt*	pTDInt;
    hr = pTD->QueryInterface(IID_IAAFTypeDefInt, (void**)&pTDInt);
    AutoRelease<IAAFTypeDefInt> r2( pTDInt );

    // Now create a property value object with that value.
    IAAFPropertyValue*	pPV;
    hr = pTDInt->CreateValue(pValue, ValueSize, &pPV);
    AutoRelease<IAAFPropertyValue> r3( pPV );

    // Add the property to the target object.
    // Get the class def for the object
    IAAFClassDef*	pCD;
    hr = dict->LookupClassDef(*pClassID, &pCD);
    AutoRelease<IAAFClassDef> r4( pCD );

    IAAFPropertyDef*	pPD;
    hr = pCD->LookupPropertyDef(*pPropID, &pPD);
    AutoRelease<IAAFPropertyDef> r5( pPD );

    // Set the propeter value on the target object
    hr = pObj->SetPropertyValue(pPD, pPV);

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

示例4: 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

示例5: GetIntegerPropFromObject

//***********************************************************
//
//	GetIntegerPropFromObject()
//
//	Get an integer property from the AAF object specified by pObj.
//	The value of the property is returned in pValue.
//
//	Returns:
//
//		On Success: AAFRESULT_SUCCESS
//		On Failure: An exception.
//
HRESULT AAFDomainUtils::GetIntegerPropFromObject(IAAFObject* pObj, const aafUID_t* pClassID, aafUID_t* pPropID, const aafUID_t* pIntTypeID, aafMemPtr_t pValue, aafUInt32 ValueSize, IAAFDictionary *dict)
{
    AAFCheck				hr;

    // Get the property value for the target property
    IAAFClassDef*		pCD;
    hr = dict->LookupClassDef(*pClassID, &pCD);
    AutoRelease<IAAFClassDef> r1(pCD);

    IAAFPropertyDef*	pPD;
    hr = pCD->LookupPropertyDef(*pPropID, &pPD);
    AutoRelease<IAAFPropertyDef> r2( pPD );

    aafBool	present = kAAFFalse;
    pObj->IsPropertyPresent(pPD, &present);
    IAAFPropertyValue*	pPV = NULL;
    AutoRelease<IAAFPropertyValue> r3;

    if (present == kAAFTrue)
    {
        hr = pObj->GetPropertyValue(pPD, &pPV);
        r3 = pPV;
    }
    else
    {
        hr = AAFRESULT_PROP_NOT_PRESENT;
    }

    // Get the type def from the dict with which to interpret this
    // property value.
    IAAFTypeDef* pTD;
    hr = dict->LookupTypeDef(*pIntTypeID, &pTD);
    AutoRelease< IAAFTypeDef > r4 (pTD);

    IAAFTypeDefInt* pTDInt;
    hr = pTD->QueryInterface(IID_IAAFTypeDefInt, (void**)&pTDInt);
    AutoRelease< IAAFTypeDefInt > r5( pTDInt );

    pTDInt->GetInteger(pPV, pValue, ValueSize);

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

示例6: testRestore

static bool testRestore(const wchar_t* fileName)
{
    bool passed = true;
    
    IAAFFile* pFile = 0;
    IAAFHeader* pHeader = 0;
    IAAFDictionary* pDictionary = 0;
    IAAFContentStorage* pStorage = 0;
    IEnumAAFMobs* pMobs = 0;
    IAAFMob* pMob = 0;
    
    try
    {
        pFile = openFileForReading(fileName);
    }
    catch (...)
    {
        return false;
    }
    
    try
    {
        // get the Mob containing the test data
        checkResult(pFile->GetHeader(&pHeader));
        checkResult(pHeader->GetDictionary(&pDictionary));
        checkResult(pHeader->GetContentStorage(&pStorage));
        aafSearchCrit_t searchCrit;
        searchCrit.searchTag = kAAFByMobKind;
        searchCrit.tags.mobKind = kAAFAllMob;
        checkResult(pStorage->GetMobs(&searchCrit, &pMobs));
        checkResult(pMobs->NextOne(&pMob));
        
        IAAFObject* pObject = 0;
        IAAFClassDef* pClassDef = 0;
        IAAFPropertyDef* pPropertyDef = 0;
        IAAFPropertyValue* pPropertyValue = 0;
        IAAFTypeDef* pType = 0;
        IAAFTypeDefCharacter* pCharacterType = 0;

        // test simple
        try
        {
            printf("    * Simple: ");

            const aafUID_t propId = 
                {0x00000000,0x0000,0x0000,{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
            wchar_t testCharacter = L'A';
            
            checkResult(pMob->QueryInterface(IID_IAAFObject, (void **)&pObject));
            
            checkResult(pDictionary->LookupClassDef(kAAFClassID_Mob, &pClassDef));
            checkResult(pClassDef->LookupPropertyDef(propId, &pPropertyDef));
            
            checkResult(pObject->GetPropertyValue(pPropertyDef, &pPropertyValue));
            checkResult(pPropertyValue->GetType(&pType));
            checkResult(pType->QueryInterface(IID_IAAFTypeDefCharacter, (void **)&pCharacterType));
            
            aafCharacter value;
            checkResult(pCharacterType->GetCharacter(pPropertyValue, &value));

            if (value == testCharacter)
            {
                printf("passed\n");
            }
            else
            {
                printf("FAILED\n");
                passed = false;
            }
        }
        catch (...)
        {
            printf("FAILED\n");
            passed = false;
        }
        release(pCharacterType);
        release(pType);
        release(pPropertyValue);
        release(pPropertyDef);
        release(pClassDef);
        release(pObject);
        
        // test XML escaped
        try
        {
            printf("    * XML escaped: ");

            const aafUID_t propId = 
                {0x10000000,0x0000,0x0000,{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
            wchar_t testCharacter = L'\r';
            
            checkResult(pMob->QueryInterface(IID_IAAFObject, (void **)&pObject));
            
            checkResult(pDictionary->LookupClassDef(kAAFClassID_Mob, &pClassDef));
            checkResult(pClassDef->LookupPropertyDef(propId, &pPropertyDef));
            
            checkResult(pObject->GetPropertyValue(pPropertyDef, &pPropertyValue));
            checkResult(pPropertyValue->GetType(&pType));
            checkResult(pType->QueryInterface(IID_IAAFTypeDefCharacter, (void **)&pCharacterType));
            
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:TestCharacter.cpp

示例7: testRestore

static bool testRestore(const wchar_t* fileName)
{
    bool passed = true;
    
    IAAFFile* pFile = 0;
    IAAFHeader* pHeader = 0;
    IAAFDictionary* pDictionary = 0;
    IAAFContentStorage* pStorage = 0;
    IEnumAAFMobs* pMobs = 0;
    IAAFMob* pMob = 0;
    
    try
    {
        pFile = openFileForReading(fileName);
    }
    catch (...)
    {
        return false;
    }
    
    try
    {
        // get the Mob containing the test data
        checkResult(pFile->GetHeader(&pHeader));
        checkResult(pHeader->GetDictionary(&pDictionary));
        checkResult(pHeader->GetContentStorage(&pStorage));
        aafSearchCrit_t searchCrit;
        searchCrit.searchTag = kAAFByMobKind;
        searchCrit.tags.mobKind = kAAFAllMob;
        checkResult(pStorage->GetMobs(&searchCrit, &pMobs));
        checkResult(pMobs->NextOne(&pMob));
        
        IAAFObject* pObject = 0;
        IAAFClassDef* pClassDef = 0;
        IAAFPropertyDef* pPropertyDef = 0;
        IAAFPropertyValue* pPropertyValue = 0;
        IAAFTypeDef* pType = 0;
        IAAFTypeDefExtEnum* pExtEnumType = 0;

        // test baseline ext. enum
        try
        {
            printf("    * Baseline: ");

            const aafUID_t propId = 
                {0x00000000,0x0000,0x0000,{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
            aafUID_t testValue = 
                {0x0D010102,0x0101,0x0500,{0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01}};
            const wchar_t* testName = L"Usage_SubClip";
            
            checkResult(pMob->QueryInterface(IID_IAAFObject, (void **)&pObject));
            
            checkResult(pDictionary->LookupClassDef(kAAFClassID_Mob, &pClassDef));
            checkResult(pClassDef->LookupPropertyDef(propId, &pPropertyDef));
            
            checkResult(pObject->GetPropertyValue(pPropertyDef, &pPropertyValue));
            checkResult(pPropertyValue->GetType(&pType));
            checkResult(pType->QueryInterface(IID_IAAFTypeDefExtEnum, (void **)&pExtEnumType));
            
            aafUID_t value;
            aafCharacter name[256];
            checkResult(pExtEnumType->GetAUIDValue(pPropertyValue, &value));
            checkResult(pExtEnumType->GetNameFromValue(pPropertyValue, name, 256));

            if (memcmp(&value, &testValue, sizeof(aafUID_t)) ==0 && wcscmp(name, testName) == 0)
            {
                printf("passed\n");
            }
            else
            {
                printf("FAILED\n");
                passed = false;
            }
        }
        catch (...)
        {
            printf("FAILED\n");
            passed = false;
        }
        release(pExtEnumType);
        release(pType);
        release(pPropertyValue);
        release(pPropertyDef);
        release(pClassDef);
        release(pObject);
        
        // test Int8 enum
        try
        {
            printf("    * Non-baseline Ext Enum: ");

            const aafUID_t propId = 
                {0x10000000,0x0000,0x0000,{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
            aafUID_t testValue = 
                {0x6f9685a4,0x0a0d,0x447b,{0x89,0xf3,0x1b,0x75,0x0b,0xc5,0xc7,0xde}};
            const wchar_t* testName = L"AAA";
            
            checkResult(pMob->QueryInterface(IID_IAAFObject, (void **)&pObject));
            
            checkResult(pDictionary->LookupClassDef(kAAFClassID_Mob, &pClassDef));
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:aaf,代码行数:101,代码来源:TestExtEnum.cpp

示例8: 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

示例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: testRestore

static bool testRestore(const wchar_t* fileName)
{
    bool passed = true;

    IAAFFile* pFile = 0;
    IAAFHeader* pHeader = 0;
    IAAFDictionary* pDictionary = 0;
    IAAFContentStorage* pStorage = 0;
    IEnumAAFMobs* pMobs = 0;
    IAAFMob* pMob = 0;

    try
    {
        pFile = openFileForReading(fileName);
    }
    catch (...)
    {
        return false;
    }

    try
    {
        // get the Mob containing the test data
        checkResult(pFile->GetHeader(&pHeader));
        checkResult(pHeader->GetDictionary(&pDictionary));
        checkResult(pHeader->GetContentStorage(&pStorage));
        aafSearchCrit_t searchCrit;
        searchCrit.searchTag = kAAFByMobKind;
        searchCrit.tags.mobKind = kAAFAllMob;
        checkResult(pStorage->GetMobs(&searchCrit, &pMobs));
        checkResult(pMobs->NextOne(&pMob));

        IAAFObject* pObject = 0;
        IAAFClassDef* pClassDef = 0;
        IAAFPropertyDef* pPropertyDef = 0;
        IAAFPropertyValue* pPropertyValue = 0;
        IAAFTypeDef* pType = 0;
        IAAFTypeDefFixedArray* pFixedArrayType = 0;
        IAAFTypeDefInt* pIntType = 0;
        IAAFPropertyValue* pIntValue = 0;

        try
        {
            printf("    * Baseline element type: ");

            const aafUID_t propId =
            {0x00000000,0x0000,0x0000,{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
            aafUInt8 testValue[2] = {0,255};

            checkResult(pMob->QueryInterface(IID_IAAFObject, (void **)&pObject));

            checkResult(pDictionary->LookupClassDef(kAAFClassID_Mob, &pClassDef));
            checkResult(pClassDef->LookupPropertyDef(propId, &pPropertyDef));

            checkResult(pObject->GetPropertyValue(pPropertyDef, &pPropertyValue));
            checkResult(pPropertyValue->GetType(&pType));
            checkResult(pType->QueryInterface(IID_IAAFTypeDefFixedArray, (void **)&pFixedArrayType));
            release(pType);

            checkResult(pFixedArrayType->GetType(&pType));
            checkResult(pType->QueryInterface(IID_IAAFTypeDefInt, (void **)&pIntType));

            aafUInt8 value[2];

            checkResult(pFixedArrayType->GetElementValue(pPropertyValue, 0, &pIntValue));
            checkResult(pIntType->GetInteger(pIntValue, &value[0], 1));

            release(pIntValue);
            checkResult(pFixedArrayType->GetElementValue(pPropertyValue, 1, &pIntValue));
            checkResult(pIntType->GetInteger(pIntValue, &value[1], 1));

            if (value[0] == testValue[0] && value[1] == testValue[1])
            {
                printf("passed\n");
            }
            else
            {
                printf("FAILED\n");
                passed = false;
            }
        }
        catch (...)
        {
            printf("FAILED\n");
            passed = false;
        }
        release(pIntValue);
        release(pIntType);
        release(pFixedArrayType);
        release(pType);
        release(pPropertyValue);
        release(pPropertyDef);
        release(pClassDef);
        release(pObject);

        try
        {
            printf("    * Non-Baseline element type: ");

            const aafUID_t propId =
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:TestFixedArray.cpp

示例12: 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

示例13: 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

示例14: ReadAAFFile


//.........这里部分代码省略.........
			{
			  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();
            pSourceClip = NULL;
			  		pSegment->Release();
            pSegment = NULL;
				}
				
				slot->Release();
				slot = NULL;
				bufLen = 0;
				trackID = 0;
			}			

		  // ChangeRef
		  checkResult(aMob->ChangeRef(MOBTestID3, MOBTestID4));

		  for (s = 1; s < 5; ++s) // These are the SourceClips
		  {
				checkResult(aMob->GetSlotAt(s, &slot));
				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, &MOBTestID4, sizeof(aafMobID_t)) == 0,
		   													 AAFRESULT_TEST_FAILED);
			  	pSourceRef->Release();
			  	pSourceRef = NULL;
开发者ID:mcanthony,项目名称:aaf,代码行数:67,代码来源:CAAFMobTest.cpp

示例15: testRestore

static bool testRestore(const wchar_t* fileName)
{
    bool passed = true;
    
    IAAFFile* pFile = 0;
    IAAFHeader* pHeader = 0;
    IAAFDictionary* pDictionary = 0;
    IAAFContentStorage* pStorage = 0;
    IEnumAAFMobs* pMobs = 0;
    IAAFMob* pMob = 0;
    
    try
    {
        pFile = openFileForReading(fileName);
    }
    catch (...)
    {
        return false;
    }
    
    try
    {
        // get the Mob containing the test data
        checkResult(pFile->GetHeader(&pHeader));
        checkResult(pHeader->GetDictionary(&pDictionary));
        checkResult(pHeader->GetContentStorage(&pStorage));
        aafSearchCrit_t searchCrit;
        searchCrit.searchTag = kAAFByMobKind;
        searchCrit.tags.mobKind = kAAFAllMob;
        checkResult(pStorage->GetMobs(&searchCrit, &pMobs));
        checkResult(pMobs->NextOne(&pMob));
        
        IAAFObject* pObject = 0;
        IAAFClassDef* pClassDef = 0;
        IAAFPropertyDef* pPropertyDef = 0;
        IAAFPropertyValue* pPropertyValue = 0;
        IAAFTypeDef* pType = 0;
        IAAFTypeDefIndirect* pIndirectType = 0;
        IAAFPropertyValue* pActualPropertyValue = 0;
        IAAFTypeDef* pActualType = 0;
        IAAFTypeDefInt* pIntType = 0;
        IAAFTypeDefEnum* pEnumType = 0;
        IAAFTypeDefRecord* pRecordType = 0;

        try
        {
            printf("    * Baseline: ");

            const aafUID_t propId = 
                {0x00000000,0x0000,0x0000,{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
            aafInt8 testValue = -128;
            
            checkResult(pMob->QueryInterface(IID_IAAFObject, (void **)&pObject));
            
            checkResult(pDictionary->LookupClassDef(kAAFClassID_Mob, &pClassDef));
            checkResult(pClassDef->LookupPropertyDef(propId, &pPropertyDef));
            
            checkResult(pObject->GetPropertyValue(pPropertyDef, &pPropertyValue));
            checkResult(pPropertyValue->GetType(&pType));
            checkResult(pType->QueryInterface(IID_IAAFTypeDefIndirect, (void **)&pIndirectType));
            
            checkResult(pIndirectType->GetActualValue(pPropertyValue, &pActualPropertyValue));
            checkResult(pActualPropertyValue->GetType(&pActualType));
            checkResult(pActualType->QueryInterface(IID_IAAFTypeDefInt, (void **)&pIntType));
            
            aafInt8 value;
            checkResult(pIntType->GetInteger(pActualPropertyValue, (aafUInt8*)&value, 1));

            if (value == testValue)
            {
                printf("passed\n");
            }
            else
            {
                printf("FAILED\n");
                passed = false;
            }
        }
        catch (...)
        {
            printf("FAILED\n");
            passed = false;
        }
        release(pRecordType);
        release(pEnumType);
        release(pIntType);
        release(pActualType);
        release(pActualPropertyValue);
        release(pIndirectType);
        release(pType);
        release(pPropertyValue);
        release(pPropertyDef);
        release(pClassDef);
        release(pObject);
        
        try
        {
            printf("    * Non-baseline: ");

            const aafUID_t propId = 
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:aaf,代码行数:101,代码来源:TestIndirect.cpp


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