本文整理汇总了C++中CAAFBuiltinDefs::cdCodecDef方法的典型用法代码示例。如果您正苦于以下问题:C++ CAAFBuiltinDefs::cdCodecDef方法的具体用法?C++ CAAFBuiltinDefs::cdCodecDef怎么用?C++ CAAFBuiltinDefs::cdCodecDef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAAFBuiltinDefs
的用法示例。
在下文中一共展示了CAAFBuiltinDefs::cdCodecDef方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: RegisterDefs
static HRESULT RegisterDefs (IAAFDictionary * pDict)
{
assert (pDict);
CAAFBuiltinDefs defs (pDict);
// IAAFTypeDefSP pTypeUInt8;
// checkResult(pDict->LookupTypeDef(kAAFTypeID_UInt8, &pTypeUInt8));
{ // Create an opaque type and register it in the dictionary.
IAAFTypeDefSP pOpaqueType;
IAAFTypeDefRenameSP pOpaqueTestType;
checkResult(pDict->CreateMetaInstance(AUID_AAFTypeDefRename, IID_IAAFTypeDefRename, (IUnknown **)&pOpaqueTestType));
checkResult(pOpaqueTestType->Initialize(kTestTypeID, defs.tdUInt8(), L"TestUInt8"));
checkResult(pOpaqueTestType->QueryInterface(IID_IAAFTypeDef, (void **)&pOpaqueType));
checkResult(pDict->RegisterOpaqueTypeDef(pOpaqueType));
}
RegisterOneMetaDef (/* dictionary*/ pDict,
/* def object's class id */ AUID_AAFTypeDefRename,
/* IID of def to pass to Init */ IID_IAAFTypeDefRename,
/* SP of def to use with Init */ IAAFTypeDefRenameSP,
/* Init() invocation */
Initialize (kTestTypeID, defs.tdUInt8(), L"TestUInt8"),
/* IID of type to QI */ IID_IAAFMetaDefinition,
/* SP for type to QI */ IAAFMetaDefinitionSP,
/* IID of def to register */ IID_IAAFTypeDef,
/* SP for def to register */ IAAFTypeDefSP,
/* reg method on pDict */ RegisterTypeDef);
{ // Make sure that "TestUInt8" is no longer opaque.
IAAFTypeDefSP pOpaqueTestType;
checkExpression(FAILED(pDict->LookupOpaqueTypeDef(kTestTypeID, &pOpaqueTestType)),
AAFRESULT_TEST_FAILED);
}
RegisterOneDef (/* dictionary*/ pDict,
/* def object's class */ defs.cdDataDef(),
/* IID of def to pass to Init */ IID_IAAFDataDef,
/* SP of def to use with Init */ IAAFDataDefSP,
/* Init() invocation */
Initialize (kTestDataDefID, L"TestDataDef", L"Desc"),
/* IID of type to QI */ IID_IAAFDefObject,
/* SP for type to QI */ IAAFDefObjectSP,
/* IID of def to register */ IID_IAAFDataDef,
/* SP for def to register */ IAAFDataDefSP,
/* reg method on pDict */ RegisterDataDef);
RegisterOneDef (/* dictionary*/ pDict,
/* def object's class */ defs.cdOperationDef(),
/* IID of def to pass to Init */ IID_IAAFOperationDef,
/* SP of def to use with Init */ IAAFOperationDefSP,
/* Init() invocation */
Initialize (kTestOperationDefID, L"TestOperationDef", L"Desc"),
/* IID of type to QI */ IID_IAAFDefObject,
/* SP for type to QI */ IAAFDefObjectSP,
/* IID of def to register */ IID_IAAFOperationDef,
/* SP for def to register */ IAAFOperationDefSP,
/* reg method on pDict */ RegisterOperationDef);
// Hack!
{
IAAFOperationDefSP od;
checkResult (pDict->LookupOperationDef (kTestOperationDefID,
&od));
checkResult (od->SetDataDef (defs.ddkAAFMatte()));
}
RegisterOneDef (/* dictionary*/ pDict,
/* def object's class */ defs.cdParameterDef(),
/* IID of def to pass to Init */ IID_IAAFParameterDef,
/* SP of def to use with Init */ IAAFParameterDefSP,
/* Init() invocation */
Initialize (kTestParameterDefID, L"TestParameterDef", L"Desc", defs.tdRational()),
/* IID of type to QI */ IID_IAAFDefObject,
/* SP for type to QI */ IAAFDefObjectSP,
/* IID of def to register */ IID_IAAFParameterDef,
/* SP for def to register */ IAAFParameterDefSP,
/* reg method on pDict */ RegisterParameterDef);
RegisterOneDef (/* dictionary*/ pDict,
/* def object's class */ defs.cdCodecDef(),
/* IID of def to pass to Init */ IID_IAAFCodecDef,
/* SP of def to use with Init */ IAAFCodecDefSP,
/* Init() invocation */
Initialize (kTestCodecDefID, L"TestCodecDef", L"Desc"),
/* IID of type to QI */ IID_IAAFDefObject,
/* SP for type to QI */ IAAFDefObjectSP,
/* IID of def to register */ IID_IAAFCodecDef,
/* SP for def to register */ IAAFCodecDefSP,
/* reg method on pDict */ RegisterCodecDef);
// Hack! Codec defs must have at least one data def appended in
// order to be saved correctly...
{
IAAFCodecDefSP cd;
IAAFClassDefSP pClassDef;
checkResult (pDict->LookupCodecDef (kTestCodecDefID,
&cd));
//.........这里部分代码省略.........
示例3: 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();
}
//.........这里部分代码省略.........