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


C++ IAAFClassDef类代码示例

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


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

示例1: r1

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

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

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

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

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

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

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

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

示例2: testTaggedDefinitions

void testTaggedDefinitions(IAAFDictionary *pDictionary, IAAFMob *pMob)
{
	IAAFDictionary2	*pDic2 = NULL;
	IAAFClassDef *pTAGDataCD = NULL;
	IAAFTaggedValueDefinition *pTAGDef = NULL; 

	const aafCharacter defName[32] = L"Tagged Definition Kappa";
	const aafCharacter defDef[64] = L"This is a test of the Tagged definition!!!";

	checkResult( pDictionary->QueryInterface( IID_IAAFDictionary2, reinterpret_cast<void**>(&pDic2) ) );
	assert(pDic2);

	//Create a tagged value def & register it
	checkResult(pDictionary->LookupClassDef(AUID_AAFTaggedValueDefinition, &pTAGDataCD));
	checkResult(pTAGDataCD->CreateInstance(IID_IAAFTaggedValueDefinition, (IUnknown **)&pTAGDef));	
	checkResult(pTAGDef->Initialize(TAGDef_TestData, defName, defDef));
	checkResult(pDic2->RegisterTaggedValueDef(pTAGDef));

	//cleanup
	pDic2->Release();
	pDic2 = NULL;
	pTAGDataCD->Release();
	pTAGDataCD = NULL;
	pTAGDef->Release();
	pTAGDef = NULL; 
}
开发者ID:mcanthony,项目名称:aaf,代码行数:26,代码来源:CAAFDictionaryTest.cpp

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

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

示例5:

HRESULT STDMETHODCALLTYPE
    CAAFEssenceFileContainer::GetIndexedDefinitionObject (aafUInt32 /* index */, IAAFDictionary *dict, IAAFDefObject **def)
{
	aafUID_t			uid;
	IAAFContainerDef	*container = NULL;
    IAAFClassDef        *pcd = 0;

	if((dict == NULL) || (def == NULL))
		return AAFRESULT_NULL_PARAM;

	XPROTECT()
	{
		CHECK(dict->LookupClassDef(AUID_AAFContainerDef, &pcd));
		CHECK(pcd->CreateInstance(IID_IAAFContainerDef, 
								  (IUnknown **)&container));
		pcd->Release();
		pcd = 0;
		uid = ContainerFile;
		CHECK(container->SetEssenceIsIdentified(kAAFFalse));
		CHECK(container->Initialize(uid, L"Raw file Container", L"Essence is in a non-container file."));
		CHECK(container->QueryInterface(IID_IAAFDefObject, (void **)def));
		container->Release();
		container = NULL;
	}
	XEXCEPT
	{
		if(container != NULL)
		  {
			container->Release();
			container = 0;
		  }
		if (pcd)
		  {
			pcd->Release();
			pcd = 0;
		  }
	}
	XEND

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

示例6: GetPropertyType

AAFRESULT GetPropertyType(
    IUnknown* pUnknown,
    const aafUID_t& propertyId,
    IAAFTypeDef** ppPropTypeDef )
{
    AAFRESULT hr = AAFRESULT_SUCCESS;


    IAAFObject*  pObject = 0;
    hr = pUnknown->QueryInterface( IID_IAAFObject, (void **)&pObject );
    if( hr == AAFRESULT_SUCCESS )
    {
        IAAFClassDef*  pClassDef = 0;
        hr = pObject->GetDefinition( &pClassDef );
        if( hr == AAFRESULT_SUCCESS )
        {
            IAAFPropertyDef* pPropDef = 0;
            hr = pClassDef->LookupPropertyDef( propertyId, &pPropDef );
            if( hr == AAFRESULT_SUCCESS )
            {
                hr = pPropDef->GetTypeDef( ppPropTypeDef );

                pPropDef->Release();
                pPropDef = 0;
            }

            pClassDef->Release();
            pClassDef = 0;
        }

        pObject->Release();
        pObject = 0;
    }


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

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

示例8: ModifyAAFFile

static HRESULT ModifyAAFFile(aafWChar *filename, int level)
{
	HRESULT			hr = S_OK;

	try
	{
		// Open existing file for modification
		IAAFFile		*pFile = NULL;
		TestProductID.productVersionString = const_cast<aafWChar*>(L"ModifyAAFFile");
		checkResult( AAFFileOpenExistingModify(
						filename,
						0,					// modeFlags
						&TestProductID,
						&pFile) );

		cout << "ModifyAAFFile() - appended Identification" << endl;

		// Get the header & dictionary
		IAAFHeader		*pHeader = NULL;
		IAAFDictionary	*pDictionary = NULL;
		checkResult(pFile->GetHeader(&pHeader));
		checkResult(pHeader->GetDictionary(&pDictionary));

		// Search for Mobs
		IAAFMob			*pFileMob = NULL;
		IEnumAAFMobs	*pFileMobIter = NULL;
		aafSearchCrit_t				criteria;
		criteria.searchTag = kAAFByMobKind;
		criteria.tags.mobKind = kAAFFileMob;		// Search by File Mob
	
		checkResult(pHeader->GetMobs(&criteria, &pFileMobIter));
	
		while (AAFRESULT_SUCCESS == pFileMobIter->NextOne(&pFileMob))
		{
			if (level == 0)
				break;

			IAAFEssenceDescriptor	*edesc = NULL;
			IAAFSourceMob			*pSourceMob = NULL;
			CR(pFileMob->QueryInterface(IID_IAAFSourceMob, (void **)&pSourceMob));
			CR(pSourceMob->GetEssenceDescriptor(&edesc));

			// Change the Name property
			CR(pFileMob->SetName(L"ModifyAAFFile - modified Name"));
			cout << "ModifyAAFFile() - changed FileMob's Name property" << endl;

			if (level == 1)
				break;

			// Change descriptor's properties
			IAAFAIFCDescriptor		*pAIFCDesc = NULL;
			CR(edesc->QueryInterface(IID_IAAFAIFCDescriptor, (void **)&pAIFCDesc));
			aafUInt8				AIFCsum[] = {0xa1,0xfc};
			CR(pAIFCDesc->SetSummary(sizeof(AIFCsum), AIFCsum));
			pAIFCDesc->Release();
			edesc->Release();
			cout << "ModifyAAFFile() - changed AIFCDescriptor's Summary" << endl;

			if (level == 2)
				break;

			// Change descriptor to new one (overwriting old one)
			IAAFClassDef			*classDef = NULL;
			IAAFFileDescriptor		*pFileDesc = NULL;
			IAAFWAVEDescriptor		*pWAVEDesc = NULL;
			IAAFEssenceDescriptor	*pNewEdesc = NULL;

			CR(pDictionary->LookupClassDef(AUID_AAFWAVEDescriptor, &classDef));
			CR(classDef->CreateInstance(IID_IAAFFileDescriptor, (IUnknown **)&pFileDesc));
			CR(pFileDesc->QueryInterface(IID_IAAFWAVEDescriptor, (void **)&pWAVEDesc));
			CR(pFileDesc->QueryInterface(IID_IAAFEssenceDescriptor, (void **)&pNewEdesc));
			aafUInt8				WAVEsum[] = {0x1a,0x1e,0xee,0xee};
			CR(pWAVEDesc->SetSummary(sizeof(WAVEsum), WAVEsum));
			CR(pSourceMob->SetEssenceDescriptor(pNewEdesc));
			pNewEdesc->Release();
			pWAVEDesc->Release();
			pFileDesc->Release();
			classDef->Release();
			cout << "ModifyAAFFile() - replaced AIFCDescriptor with WAVEDescriptor" << endl;

			if (level == 3)
				break;

			// Add EssenceData
			IAAFEssenceData			*pEssenceData = NULL;
			IAAFEssenceData2		*pEssenceData2 = NULL;
			IAAFPlainEssenceData		*pPlainEssenceData = NULL;
			aafUInt32				bytesWritten = 0;
			aafUInt8				essdata[] = "Zaphod Beeblebrox";
			CR(pDictionary->LookupClassDef(AUID_AAFEssenceData, &classDef));
			CR(classDef->CreateInstance(IID_IAAFEssenceData, (IUnknown **)&pEssenceData));
			CR(pEssenceData->SetFileMob(pSourceMob));
			CR(pHeader->AddEssenceData(pEssenceData));
			CR(pEssenceData->QueryInterface(IID_IAAFEssenceData2, (void**)&pEssenceData2));
			CR(pEssenceData2->GetPlainEssenceData(0, &pPlainEssenceData));
			CR(pPlainEssenceData->Write(sizeof(essdata), essdata, &bytesWritten));
			pEssenceData->Release();
			pEssenceData2->Release();
			pPlainEssenceData->Release();
			classDef->Release();
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:OpenExistingModify.cpp

示例9: CreateAAFFile

static HRESULT CreateAAFFile(aafWChar *filename, aafUID_constref fileKind)
{
	TestProductID.companyName = companyName;
	TestProductID.productName = productName;
	TestProductID.productVersionString = NULL;
	TestProductID.productID = UnitTestProductID;
	TestProductID.platform = NULL;
	TestProductID.productVersion = &TestVersion;

	HRESULT			hr = S_OK;

	try
	{
		RemoveTestFile(filename);

		// Open new file
		IAAFFile		*pFile = NULL;
		TestProductID.productVersionString = const_cast<aafWChar*>(L"CreateAAFFile");
		checkResult( AAFFileOpenNewModifyEx(
						filename,
						&fileKind,
						0,
						&TestProductID,
						&pFile) );

		// Get the header & dictionary
		IAAFHeader		*pHeader = NULL;
		IAAFDictionary	*pDictionary = NULL;
		checkResult(pFile->GetHeader(&pHeader));
		checkResult(pHeader->GetDictionary(&pDictionary));

		// Create a MasterMob
		IAAFMob			*pMob = NULL;
		IAAFClassDef	*classDef = NULL;
		checkResult(pDictionary->LookupClassDef(AUID_AAFMasterMob, &classDef));
		checkResult(classDef->CreateInstance(IID_IAAFMob, (IUnknown **)&pMob));
		classDef->Release();
		checkResult(pMob->SetMobID(TEST_MobID));
		checkResult(pMob->SetName(L"CreateAAFFile - MasterMob"));
		checkResult(pHeader->AddMob(pMob));
		pMob->Release();

		// Create a SourceMob 
		IAAFSourceMob			*pSourceMob = NULL;
		checkResult(pDictionary->LookupClassDef(AUID_AAFSourceMob, &classDef));
		checkResult(classDef->CreateInstance(IID_IAAFSourceMob, (IUnknown **)&pSourceMob));
		classDef->Release();
		checkResult(pSourceMob->QueryInterface(IID_IAAFMob, (void **)&pMob));
		checkResult(pMob->SetMobID(TEST_SourceMobID));
		checkResult(pMob->SetName(L"CreateAAFFile - SourceMob"));

		IAAFEssenceDescriptor	*edesc = NULL;
		IAAFAIFCDescriptor		*pAIFCDesc = NULL;
		checkResult(pDictionary->LookupClassDef(AUID_AAFAIFCDescriptor, &classDef));
		checkResult(classDef->CreateInstance(IID_IAAFEssenceDescriptor, (IUnknown **)&edesc));
		classDef->Release();
		checkResult(edesc->QueryInterface(IID_IAAFAIFCDescriptor, (void **)&pAIFCDesc));
		aafUInt8	buf[] = {0x00};
		checkResult(pAIFCDesc->SetSummary(sizeof(buf), buf));
		checkResult(pSourceMob->SetEssenceDescriptor(edesc));
		checkResult(pHeader->AddMob(pMob));
		pAIFCDesc->Release();
		edesc->Release();
		pSourceMob->Release();
		pMob->Release();

		pDictionary->Release();
		pHeader->Release();

		// Save & close the file
		checkResult(pFile->Save());
		checkResult(pFile->Close());
		checkResult(pFile->Release());

		cout << "CreateAAFFile() - created new file" << endl;
	}
	catch (HRESULT& rResult)
	{
		hr = rResult;
		cout << "*** CreateAAFFile: caught error hr=0x" << hex << hr << dec << endl;
	}

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

示例10: testRestore

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

示例11: CreateAAFFile

static HRESULT CreateAAFFile(aafWChar * pFileName, long int N)
{
  IAAFFile*                   pFile = NULL;
  IAAFHeader*                 pHeader = NULL;
  IAAFDictionary*             pDictionary = NULL;
  IAAFMob*                    pMob = NULL;
  IAAFMob*                    pCompMob = NULL;
  IAAFEssenceDescriptor*      aDesc = NULL;
  IAAFMasterMob*              pMasterMob = NULL;
  IAAFSourceMob*              pFileMob = NULL;
  IAAFSourceMob*              pTapeMob = NULL;
  IAAFSequence*               pSequence = NULL;
  IAAFComponent*              aComponent = NULL;
  IAAFFileDescriptor*         pFileDesc = NULL;
  IAAFAIFCDescriptor*         pAIFCDesc = NULL;
  IAAFTapeDescriptor*         pTapeDesc = NULL;
  IAAFTimelineMobSlot*        newSlot = NULL;
  IAAFSegment*                seg = NULL;
  IAAFSourceClip*             fileSclp = NULL;
  IAAFSourceClip*             masterSclp = NULL;
  IAAFSourceClip*             compSclp = NULL;
  IAAFComponent*              compFill = NULL;
  IAAFLocator*                pLocator = NULL;
  IAAFNetworkLocator*         pNetLocator = NULL;
  IAAFClassDef *              pCDCompositionMob = 0;
  IAAFClassDef *              pCDSequence = 0;
  IAAFClassDef *              pCDSourceMob = 0;
  IAAFClassDef *              pCDTapeDescriptor = 0;
  IAAFClassDef *              pCDAIFCDescriptor = 0;
  IAAFClassDef *              pCDNetworkLocator = 0;
  IAAFClassDef *              pCDMasterMob = 0;
  IAAFClassDef *              pCDSourceClip = 0;
  IAAFClassDef *              pCDFiller = 0;
  IAAFDataDef *               pDdefPicture = 0;
  aafRational_t               videoRate = { 30000, 1001 };
  aafMobID_t                  tapeMobID, fileMobID, masterMobID;
  aafTimecode_t               tapeTC = { 108000, kAAFTcNonDrop, 30};
  aafLength_t                 fileLen = FILE1_LENGTH;
  aafLength_t                 fillLen = FILL_LENGTH;
  aafLength_t                 segLen = SEG_LENGTH;
  aafProductIdentification_t  ProductInfo;
  long int                    i = 0;

  moduleErrorTmp = S_OK;


  // delete any previous test file before continuing...
  char chFileName[1000];
  convert(chFileName, sizeof(chFileName), pFileName);
  remove(chFileName);

  aafProductVersion_t v;
  v.major = 1;
  v.minor = 0;
  v.tertiary = 0;
  v.patchLevel = 0;
  v.type = kAAFVersionUnknown;
  ProductInfo.companyName = companyName;
  ProductInfo.productName = productName;
  ProductInfo.productVersion = &v;
  ProductInfo.productVersionString = NULL;
  ProductInfo.productID = NIL_UID;
  ProductInfo.platform = NULL;

#if defined(USE_MEMORY_FILE)
  check(MemoryFileOpenNewModify (0, &ProductInfo, &pFile));
#else
  check(AAFFileOpenNewModifyEx (pFileName, &kAAFFileKind_Aaf4KBinary, 0, &ProductInfo, &pFile));
#endif

  check(pFile->GetHeader(&pHeader));

  // Get the AAF Dictionary so that we can create valid AAF objects.
  check(pHeader->GetDictionary(&pDictionary));

  check(pDictionary->LookupClassDef(AUID_AAFCompositionMob,
                                    &pCDCompositionMob));
  check(pDictionary->LookupClassDef(AUID_AAFSequence,
                                    &pCDSequence));
  check(pDictionary->LookupClassDef(AUID_AAFSourceMob,
                                    &pCDSourceMob));
  check(pDictionary->LookupClassDef(AUID_AAFTapeDescriptor,
                                    &pCDTapeDescriptor));
  check(pDictionary->LookupClassDef(AUID_AAFAIFCDescriptor,
                                    &pCDAIFCDescriptor));
  check(pDictionary->LookupClassDef(AUID_AAFNetworkLocator,
                                    &pCDNetworkLocator));
  check(pDictionary->LookupClassDef(AUID_AAFMasterMob,
                                    &pCDMasterMob));
  check(pDictionary->LookupClassDef(AUID_AAFSourceClip,
                                    &pCDSourceClip));
  check(pDictionary->LookupClassDef(AUID_AAFFiller,
                                    &pCDFiller));
  check(pDictionary->LookupDataDef(kAAFDataDef_Picture,
                                   &pDdefPicture));

// IMPORTANT: major remodification is from this point onwards...

  // sequence creation code pulled out of the subsequent loop.
  // Create a Composition Mob
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CreateSequence.cpp

示例12: ProcessAAFFile

static HRESULT ProcessAAFFile(const aafWChar * pFileName, testType_t testType)
{
	IAAFFile *					pFile = NULL;
	IAAFHeader *				pHeader = NULL;
	IAAFDictionary*				pDictionary = NULL;
	IEnumAAFMobs*				pMobIter = NULL;
	aafNumSlots_t				numMobs, numSlots;
	aafSearchCrit_t				criteria;
	aafMobID_t					mobID;
	aafWChar					namebuf[1204];
	const aafWChar*				slotName = L"A slot in Composition Mob";
	IAAFComponent*				pComponent = NULL;
	IAAFComponent*				aComponent = NULL;
	IEnumAAFMobSlots*			pMobSlotIter = NULL;
	IAAFMobSlot*				pMobSlot = NULL;
	IAAFTimelineMobSlot*		newSlot = NULL;
	IAAFSegment*				seg = NULL;
	IAAFSegment*				pSegment = NULL;
	IAAFMob*					pCompMob = NULL;
	IAAFMob*					pMob = NULL;
	aafPosition_t				zeroPos = 0;
	IAAFSequence*				pAudioSequence = NULL;
	IAAFSourceClip*				pSourceClip = NULL;
	aafLength_t					duration;
	IAAFTimelineMobSlot* pTimelineMobSlot = NULL;
  IAAFClassDef *pCompositionMobDef = NULL;
  IAAFClassDef *pSequenceDef = NULL;
  IAAFClassDef *pSourceClipDef = NULL;
  IAAFDataDef *pSoundDef = NULL;
  IAAFDataDef *pDataDef = NULL;
	

	// Set the edit rate information
	aafRational_t				editRate;
	editRate.numerator = 48000;
	editRate.denominator = 1;

	// Set search condition to true
	bool lookingForAudio = true;

	// Call the routine (from ExportAudioExample) to make the file for processing
	check(CreateAAFFile(pwFileName, NULL, testStandardCalls, &pFile));

	/* Get the Header and iterate through the Master Mobs in the existing file */
	check(pFile->GetHeader(&pHeader));
	check(pHeader->GetDictionary(&pDictionary));

	
  /* Lookup class definitions for the objects we want to create. */
  check(pDictionary->LookupClassDef(AUID_AAFCompositionMob, &pCompositionMobDef));
  check(pDictionary->LookupClassDef(AUID_AAFSequence, &pSequenceDef));
  check(pDictionary->LookupClassDef(AUID_AAFSourceClip, &pSourceClipDef));

  /* Lookup any necessary data definitions. */
  check(pDictionary->LookupDataDef(kAAFDataDef_Sound, &pSoundDef));
  

	// Get the number of master mobs in the existing file (must not be zero)
	check(pHeader->CountMobs(kAAFMasterMob, &numMobs));
	if (numMobs != 0)
	{
		printf("Found %d Master Mobs\n", numMobs);
		criteria.searchTag = kAAFByMobKind;
		criteria.tags.mobKind = kAAFMasterMob;
		check(pHeader->GetMobs(&criteria, &pMobIter));

		/* Create a Composition Mob */
		check(pCompositionMobDef->
			  CreateInstance(IID_IAAFMob,
							 (IUnknown **)&pCompMob));
		/* Append the Mob to the Header */
		check(pHeader->AddMob(pCompMob));
 
		/* Create a TimelineMobSlot with an audio sequence */
		check(pSequenceDef->
			  CreateInstance(IID_IAAFSequence,
							 (IUnknown **)&pAudioSequence));
		check(pAudioSequence->QueryInterface(IID_IAAFSegment, (void **)&seg));

		check(pAudioSequence->QueryInterface(IID_IAAFComponent,
											 (void **)&aComponent));

		check(aComponent->SetDataDef(pSoundDef));
		check(pCompMob->AppendNewTimelineSlot(editRate, seg, 1, slotName, zeroPos, &newSlot));
    seg->Release();
    seg = NULL;
    newSlot->Release();
    newSlot = NULL;

		// This variable is about to be overwritten so we need to release the old interface
		aComponent->Release();
		aComponent = NULL;

		while((AAFRESULT_SUCCESS == pMobIter->NextOne(&pMob)))
		{
			//  Print out information about the Mob
			char mobIDstr[256];
			char mobName[256];

			check(pMob->GetMobID (&mobID));
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:ExportSimpleComposition.cpp

示例13: main

extern int main(int argc, char *argv[])
{
	const char *filename_cstr = "test.aaf";

#ifndef _MSC_VER
	setlocale (LC_ALL, "en_US.UTF-8");
#endif

	if (argc >= 2)
	{
		filename_cstr = argv[1];
	}

	// convert C str to wide string
	aafWChar filename[FILENAME_MAX];
	size_t status = mbstowcs(filename, filename_cstr, sizeof(filename));
	if (status == (size_t)-1) {
		fprintf(stderr, "mbstowcs failed for \"%s\"\n", filename_cstr);
		return 1;
	}
	remove(filename_cstr);

	IAAFFile *pFile = NULL;
	int mode = 0;

	aafProductIdentification_t productID;
	aafProductVersion_t TestVersion = {1, 1, 0, 0, kAAFVersionUnknown};
	productID.companyName = (aafCharacter*)L"HSC";
	productID.productName = (aafCharacter*)L"String Tester";
	productID.productVersion = &TestVersion;
	productID.productVersionString = NULL;
	productID.productID = TestProductID;
	productID.platform = (aafCharacter*)L"Linux";

	// Create new AAF file
	check(AAFFileOpenNewModify(filename, mode, &productID, &pFile));

	// Create a simple Mob
	IAAFClassDef	*classDef = NULL;
	IAAFMob			*pMob = NULL;
	IAAFHeader		*pHeader = NULL;
	IAAFDictionary	*pDictionary = NULL;

	check(pFile->GetHeader(&pHeader));
	check(pHeader->GetDictionary(&pDictionary));
	check(pDictionary->LookupClassDef(AUID_AAFMasterMob, &classDef));
	check(classDef->CreateInstance(IID_IAAFMob, (IUnknown **)&pMob));
	classDef->Release();

	
	check(pMob->SetMobID(TEST_MobID));

	// UTF-8 for codepoint U+1D11E (musical G Clef): 0xf0,0x9d,0x84,0x9e
	// UTF-8 for codepoint U+1D122 (musical F Clef): 0xf0,0x9d,0x84,0xa2
	// http://unicode.org/charts/PDF/U1D100.pdf 
	// http://en.wikipedia.org/wiki/UTF-8
	aafCharacter *mobname;
	const unsigned char inputStr[] = {	0xf0,0x9d,0x84,0x9e,	// U+1D11E
										0xf0,0x9d,0x84,0xa2,	// U+1D122
										0x4d, 0x6f, 0x62,		// 'M' 'o' 'b'
										0x0 };

	// Convert UTF-8 inputStr to native wchar_t representation (UTF-32 Unix, UTF-16 Windows)
	int wlen = 0, n;
#ifndef _MSC_VER
	int ret;
	char *p = (char *)inputStr;
	while ((ret = mblen(p, 4)) > 0)
	{ ++wlen; p+=ret; }
	mobname = new aafCharacter[wlen+1];
	n = mbstowcs(mobname, (const char *)inputStr, wlen+1);

	if (n == -1)
	{
		fprintf (stderr, "mbstowcs returned -1. Invalid multibyte string\n");
		exit(1);
	}
#else
	// Under Windows we must use MultiByteToWideChar() to get correct UTF-8 conversion to UTF-16
	// since mbstowcs() is broken for UTF-8.
	wlen = MultiByteToWideChar (CP_UTF8, MB_ERR_INVALID_CHARS, (LPCSTR)inputStr, -1, NULL, 0);
	if (wlen == 0)
	{
		fprintf (stderr, "MultiByteToWideChar returned 0. Invalid multibyte string\n");
		exit(1);
	}
	mobname = new aafCharacter[wlen];
	n = MultiByteToWideChar (CP_UTF8, MB_ERR_INVALID_CHARS, (LPCSTR)inputStr, -1, mobname, wlen);
	if (n == 0)
	{
		fprintf (stderr, "MultiByteToWideChar returned 0. Invalid multibyte string\n");
		exit(1);
	}
#endif

	// SetName() calls OMSimpleProperty::set() which does a memcpy of the mobname string
	// to an OMByte* variable 'bits()' at OMProperty.cpp:399
	// Found by setting an rwatch on mobname address.
	check(pMob->SetName(mobname));
	aafUInt32 size_before = 0;
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:UTF16StoredString.cpp

示例14: CreateAAFFile

static HRESULT CreateAAFFile(
    aafWChar * pFileName,
    aafUID_constref fileKind,
    testRawStorageType_t rawStorageType,
    aafProductIdentification_constref productID)
{
	IAAFFile*			pFile = NULL;
	IAAFHeader *		pHeader = NULL;
	IAAFDictionary*		pDictionary = NULL;
	IAAFCodecDef*	pCodecDef = NULL;
	IAAFClassDef*		pClass = NULL;
	bool				bFileOpen = false;
	HRESULT				hr = S_OK;
	aafUID_t			uid;
/*	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;

	// We can't really do anthing in AAF without the header.
	checkResult(pFile->GetHeader(&pHeader));

    // Get the AAF Dictionary so that we can create valid AAF objects.
    checkResult(pHeader->GetDictionary(&pDictionary));
	CAAFBuiltinDefs defs (pDictionary);
    
	checkResult(defs.cdCodecDef()->
				CreateInstance(IID_IAAFCodecDef, 
							   (IUnknown **)&pCodecDef));
    
	checkResult(pCodecDef->AddEssenceKind (defs.ddkAAFMatte()));
	uid = kAAFNoCodec;
	checkResult(pCodecDef->Initialize (uid, sName1, sDescription1));
	checkResult(pDictionary->LookupClassDef(kAAFClassID_EssenceDescriptor, &pClass));
	checkResult(pCodecDef->SetFileDescriptorClass (pClass));
	checkResult(pDictionary->RegisterCodecDef(pCodecDef));
	pCodecDef->Release();
	pCodecDef = NULL;
	checkResult(defs.cdCodecDef()->
				CreateInstance(IID_IAAFCodecDef, 
							   (IUnknown **)&pCodecDef));
    
	checkResult(pCodecDef->AddEssenceKind (defs.ddkAAFMatte()));
	uid = TESTID_2;
	checkResult(pCodecDef->Initialize (uid, sName2, sDescription2));
	checkResult(pCodecDef->SetFileDescriptorClass (pClass));

	checkResult(pDictionary->RegisterCodecDef(pCodecDef));
  }
  catch (HRESULT& rResult)
  {
    hr = rResult;
  }


  // Cleanup and return
  if (pCodecDef)
    pCodecDef->Release();

  if (pDictionary)
    pDictionary->Release();

  if (pHeader)
    pHeader->Release();
      
  if (pClass)
    pClass->Release();
      
  if (pFile)
  {  // Close file
    if (bFileOpen)
	{
		pFile->Save();
		pFile->Close();
	}
     pFile->Release();
  }

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

示例15: CreateAAFFile

static HRESULT CreateAAFFile(const aafWChar * pFileName)
{
	IAAFFile*					pFile = NULL;
	IAAFHeader*					pHeader = NULL;
	IAAFDictionary*				pDictionary = NULL;
	IAAFMob*					pMob = NULL;
	IAAFMasterMob*				pMasterMob = NULL;
	IAAFEssenceAccess*			pEssenceAccess = NULL;
	IAAFEssenceFormat*			pFormat = NULL;
	IAAFLocator					*pLocator = NULL;
	aafMobID_t					masterMobID;
	aafProductIdentification_t	ProductInfo;
	aafRational_t				editRate = {11025, 1};
	aafRational_t				sampleRate = {11025, 1};
	IAAFClassDef				*pCDMasterMob = NULL;
	IAAFDataDef					*pSoundDef = NULL;
	aafUInt32					samplesWritten, bytesWritten;

	// Delete any previous test file before continuing...
	char cFileName[FILENAME_MAX];
	convert(cFileName, sizeof(cFileName), pFileName);
	remove(cFileName);

	aafProductVersion_t ver = {1, 0, 0, 0, kAAFVersionBeta};
	ProductInfo.companyName = companyName;
	ProductInfo.productName = productName;
	ProductInfo.productVersion = &ver;
	ProductInfo.productVersionString = NULL;
	ProductInfo.productID = NIL_UID;
	ProductInfo.platform = NULL;		// Set by SDK when saving

	// Create a new AAF file
	check(AAFFileOpenNewModify (pFileName, 0, &ProductInfo, &pFile));
	check(pFile->GetHeader(&pHeader));

	// Get the AAF Dictionary from the file
	check(pHeader->GetDictionary(&pDictionary));

	/* Lookup class definitions for the objects we want to create. */
	check(pDictionary->LookupClassDef(AUID_AAFMasterMob, &pCDMasterMob));

	/* Lookup any necessary data definitions. */
	check(pDictionary->LookupDataDef(kAAFDataDef_Sound, &pSoundDef));

	/* Create a Mastermob */

	// Get a Master MOB Interface
	check(pCDMasterMob->CreateInstance(IID_IAAFMasterMob, (IUnknown **)&pMasterMob));

	// Get a Mob interface and set its variables.
	check(pMasterMob->QueryInterface(IID_IAAFMob, (void **)&pMob));
	check(pMob->GetMobID(&masterMobID));
	if (input_video == NULL)
	{
		check(pMob->SetName(L"Laser"));
	}
	else
	{
		check(pMob->SetName(pFileName));
	}

	// Add Mobs to the Header
	check(pHeader->AddMob(pMob));

	// Locator needed for non-embedded essence
	IAAFClassDef *classDef = NULL;
	check(pDictionary->LookupClassDef(AUID_AAFNetworkLocator, &classDef));
	check(classDef->CreateInstance(IID_IAAFLocator, (IUnknown **)&pLocator));
	classDef->Release();
	classDef = NULL;

	if (container == NIL_UID)
	{
		pLocator = NULL;
	}
	else if (container == ContainerAAF)
	{
		check(pLocator->SetPath(L"Laser.aaf"));
		remove("Laser.aaf");
	}
	else if (container == ContainerFile)
	{
		check(pLocator->SetPath(L"Laser.pcm"));
		remove("Laser.pcm");
	}
	else	// RIFFWAVE container
	{
		check(pLocator->SetPath(L"Laser.wav"));
		remove("Laser.wav");
	}

	// Get a pointer to video data for WriteSamples
	unsigned char *dataPtr, buf[4096];
	memcpy(buf, uncompressedWAVE_Laser+44, sizeof(uncompressedWAVE_Laser));
	dataPtr = buf;

	/* Create the Essence Data specifying the codec, container, edit rate and sample rate */
	check(pMasterMob->CreateEssence(1,			// Slot ID within MasterMob
						pSoundDef,				// MediaKind
						kAAFCodecPCM,			// codecID
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:aaf,代码行数:101,代码来源:ExportPCM.cpp


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