本文整理汇总了C++中IAAFClassDef::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ IAAFClassDef::Release方法的具体用法?C++ IAAFClassDef::Release怎么用?C++ IAAFClassDef::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAAFClassDef
的用法示例。
在下文中一共展示了IAAFClassDef::Release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例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;
}
示例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;
}
示例4:
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;
}
示例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;
}
示例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;
}
示例7: 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;
}
示例8: 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));
//.........这里部分代码省略.........
示例9: 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();
//.........这里部分代码省略.........
示例10: 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* pPlugDef = NULL;
IAAFDataDef *pDataDef = NULL;
IAAFClassDef *classDef = NULL;
IAAFClassDef *pWaveClassDef=0,*pReturnedClassDef=0;
bool bFileOpen = false;
HRESULT hr = S_OK;
aafUID_t uid;
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.cdCodecDef()->
CreateInstance(IID_IAAFCodecDef,
(IUnknown **)&pPlugDef));
uid = kAAFCodecWAVE;
checkResult(pPlugDef->Initialize (uid, L"TestCodec", L"TestCodecDescription"));
checkResult(pPlugDef->AddEssenceKind (defs.ddkAAFMatte()));
checkResult(pDictionary->RegisterCodecDef(pPlugDef));
uid = kAAFClassID_WAVEDescriptor;
checkResult(pDictionary->LookupClassDef(uid, &classDef));
checkResult(pPlugDef->SetFileDescriptorClass (classDef));
// Make sure GetFileDescriptorClass() returns correct value
aafUID_t uid = kAAFClassID_WAVEDescriptor;
checkResult(pDictionary->LookupClassDef(uid, &pWaveClassDef));
checkResult(pPlugDef->GetFileDescriptorClass(&pReturnedClassDef));
// COM interface pointers pReturnedClassDef and pWaveClassDef should be
// equal
checkExpression(AreUnksSame(pReturnedClassDef,pWaveClassDef)==kAAFTrue,
AAFRESULT_TEST_FAILED);
/* Not tested
virtual HRESULT STDMETHODCALLTYPE RemoveEssenceKind();
virtual HRESULT STDMETHODCALLTYPE CountEssenceKinds();
virtual HRESULT STDMETHODCALLTYPE GetEssenceKinds();
*/
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pReturnedClassDef)
pReturnedClassDef->Release();
if (pWaveClassDef)
pWaveClassDef->Release();
if (classDef)
classDef->Release();
if (pDataDef)
pDataDef->Release();
if (pPlugDef)
pPlugDef->Release();
if (pDictionary)
pDictionary->Release();
if (pHeader)
pHeader->Release();
if (pFile)
{ // Close file
if (bFileOpen)
{
pFile->Save();
pFile->Close();
}
pFile->Release();
}
//.........这里部分代码省略.........
示例11: CreateAAFFile
//.........这里部分代码省略.........
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
check(pCDCompositionMob->CreateInstance(IID_IAAFMob,
(IUnknown **)&pCompMob));
check(pCDSequence->CreateInstance(IID_IAAFSequence,
(IUnknown **)&pSequence));
check(pSequence->QueryInterface (IID_IAAFSegment, (void **)&seg));
check(pSequence->QueryInterface(IID_IAAFComponent, (void **)&aComponent));
check(aComponent->SetDataDef(pDdefPicture));
aComponent->Release();
aComponent = NULL;
check(pCompMob->QueryInterface (IID_IAAFMob, (void **)&pMob));
check(pMob->AppendNewTimelineSlot(videoRate, seg, i, slotName, 0, &newSlot));
pMob->Release();
pMob = NULL;
newSlot->Release();
newSlot = NULL;
seg->Release();
seg = NULL;
check(pHeader->AddMob(pCompMob));
// now looping around the remainder N times to make N components
for (i=0; i < N; i++) {
//Make the Tape MOB
check(pCDSourceMob->CreateInstance(IID_IAAFSourceMob,
(IUnknown **)&pTapeMob));
check(pCDTapeDescriptor->CreateInstance(IID_IAAFTapeDescriptor,
(IUnknown **)&pTapeDesc));
check(pTapeDesc->QueryInterface (IID_IAAFEssenceDescriptor,
(void **)&aDesc));
check(pTapeMob->SetEssenceDescriptor(aDesc));
aDesc->Release();
aDesc = NULL;
pTapeDesc->Release();
pTapeDesc = NULL;
check(pTapeMob->AppendTimecodeSlot (videoRate, 0, tapeTC, TAPE_LENGTH));
check(pTapeMob->AddNilReference (1,TAPE_LENGTH, pDdefPicture, videoRate));
check(pTapeMob->QueryInterface (IID_IAAFMob, (void **)&pMob));
示例12: 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;
//.........这里部分代码省略.........
示例13: CreateAAFFile
//.........这里部分代码省略.........
GetPixelsPerLine(ComprID), GetLinesPerField(ComprID)*(IsInterlaced(ComprID)?2:1),
input_video,
input_type==BGRAI, false, true, false );
while( Duration-- )
{
samplesWritten=0;
check(pEssenceAccess->WriteSamples(1, nwant, video_buffer, &samplesWritten, &bytesWritten));
total_samples += samplesWritten;
}
delete[] video_buffer;
}
else if( input_type==BGRA )
{
// never get here with VC3Codec
// Load a single frame of uncompressed
aafUInt32 nwant = GetLinesPerField(ComprID)*(IsInterlaced(ComprID)?2:1)*GetPixelsPerLine(ComprID)*8;
unsigned char* video_buffer = new unsigned char [ nwant ];
// int LoadXRGB( BufferLayout_t target, byte *video_buffer, int len, int H, int V, const char *input_video,
// bool isLittleEndian=true, bool isBigEndian=false, bool hasA=false, bool isRGB=false );
LoadXRGB( Layout_BGRA,
video_buffer, nwant,
GetPixelsPerLine(ComprID), GetLinesPerField(ComprID)*(IsInterlaced(ComprID)?2:1),
input_video,
input_type==BGRAI, false, true, false );
while( Duration-- )
{
samplesWritten=0;
check(pEssenceAccess->WriteSamples(1, nwant, video_buffer, &samplesWritten, &bytesWritten));
total_samples += samplesWritten;
}
delete[] video_buffer;
}
else if( input_type==BarsRGB ) // using generated rgb colo(u)r bars
{
// never get here with VC3Codec
// Create a frame of colour bars
aafUInt32 nwant = GetLinesPerField(ComprID)*(IsInterlaced(ComprID)?2:1)*GetPixelsPerLine(ComprID)*8;
unsigned char* video_buffer = new unsigned char [ nwant ];
LoadXBars( Layout_BGRAI, video_buffer, nwant, GetPixelsPerLine(ComprID), GetLinesPerField(ComprID)*(IsInterlaced(ComprID)?2:1) );
while( Duration-- )
{
samplesWritten=0;
check(pEssenceAccess->WriteSamples(1, nwant, video_buffer, &samplesWritten, &bytesWritten));
total_samples += samplesWritten;
}
delete[] video_buffer;
}
else // if( input_type==BarsUYVY || input_video == NULL || others... ) // using generated component colo(u)r bars
{
// Create a frame of colour bars
aafUInt32 nwant = GetLinesPerField(ComprID)*(IsInterlaced(ComprID)?2:1)*(GetPixelsPerLine(ComprID)/2)*(UseDNX?5:8);
unsigned char* video_buffer = new unsigned char [ nwant ];
LoadXBars( UseDNX?Layout_P_UYVY:Layout_UYVYM, video_buffer, nwant, GetPixelsPerLine(ComprID), GetLinesPerField(ComprID)*(IsInterlaced(ComprID)?2:1) );
while( Duration-- )
{
samplesWritten=0;
check(pEssenceAccess->WriteSamples(1, nwant, video_buffer, &samplesWritten, &bytesWritten));
total_samples += samplesWritten;
}
delete[] video_buffer;
}
printf("Completed Write\n");
/* Set the essence to indicate that you have finished writing the samples */
check(pEssenceAccess->CompleteWrite());
check(pHeader2->UpdateEssenceContainers());
pEssenceAccess->Release();
pMob->Release();
pMasterMob->Release();
pPictureDef->Release();
pCDMasterMob->Release();
pDictionary->Release();
pHeader->Release();
pHeader2->Release();
/* Save the AAF file */
pFile->Save();
/* Close the AAF file */
pFile->Close();
pFile->Release();
return moduleErrorTmp;
}
示例14: CreateAAFFile
//.........这里部分代码省略.........
}
// open the Essence file to be included in this AAF file("Laser.wav")
pWavFile = fopen("Laser.wav", "r");
if (pWavFile)
{
// read in the essence data
fread(dataBuff, sizeof(unsigned char), sizeof(dataBuff), pWavFile);
check(loadWAVEHeader(dataBuff,
&bitsPerSample,
&numCh,
&sampleRate,
&dataOffset,
&dataLen));
dataPtr = dataBuff + dataOffset;
// now create the Essence data file
check(pMasterMob->CreateEssence(1, // Slot ID
pDdefSound, // MediaKind
kAAFCodecWAVE, // codecID
editRate, // edit rate
sampleRate, // sample rate
kAAFCompressionDisable,
pLocator, // In current file
testContainer, // In AAF Format
&pEssenceAccess));// Compress disabled
check(pEssenceAccess->GetFileFormatParameterList (&format));
check(format->NumFormatSpecifiers (&numSpecifiers));
for(n = 0; n < numSpecifiers; n++)
{
check(format->GetIndexedFormatSpecifier (n, &essenceFormatCode, 0, NULL, NULL));
}
format->Release();
format = NULL;
// Tell the AAFEssenceAccess what the format is.
check(pEssenceAccess->GetEmptyFileFormat (&pFormat));
check(pFormat->NumFormatSpecifiers (&numSpecifiers));
aafInt32 sampleSize = bitsPerSample;
check(pFormat->AddFormatSpecifier (kAAFAudioSampleBits, sizeof(sampleSize), (aafUInt8 *)&sampleSize));
check(pEssenceAccess->PutFileFormat (pFormat));
pFormat->Release();
pFormat = NULL;
// write out the data
check(pEssenceAccess->WriteSamples( dataLen,//!!! hardcoded bytes/sample ==1// Number of Samples
sizeof(dataBuff), // buffer size
dataPtr, // THE data
&samplesWritten,
&bytesWritten));
// close essence data file
fclose(pWavFile);
pWavFile = NULL;
// Finish writing the destination
check(pEssenceAccess->CompleteWrite());
pEssenceAccess->Release();
pEssenceAccess=NULL;
// First register DataDef for SceneDescription
// Is SceneDescription in dictionary already
// Try using Timecode for MC compat
hr = pDictionary->LookupDataDef(kAAFDataDef_Timecode,
&pDDefSceneDesc);
// hr = pDictionary->LookupDataDef(kAAFDataDef_SceneDescription,
示例15: 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)
{
//.........这里部分代码省略.........