本文整理汇总了C++中IAAFMob::SetName方法的典型用法代码示例。如果您正苦于以下问题:C++ IAAFMob::SetName方法的具体用法?C++ IAAFMob::SetName怎么用?C++ IAAFMob::SetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAAFMob
的用法示例。
在下文中一共展示了IAAFMob::SetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
IAAFSourceMob* pSourceMob = NULL;
IAAFMob* pMob = NULL;
IAAFTIFFDescriptor* pTIFFDesc = NULL;
IAAFEssenceDescriptor* pEssDesc = NULL;
HRESULT hr = AAFRESULT_SUCCESS;
aafUInt8 summary[512];
aafUInt16 numEntries = 2;
unsigned long nOffset;
#if defined( OS_WINDOWS )
tiffHeader.tiff_byteOrder = TIFF_LITTLEENDIAN;
#else
tiffHeader.tiff_byteOrder = TIFF_BIGENDIAN;
#endif
tiffHeader.tiff_identNumber = TIFF_VERSION;
tiffHeader.tiff_firstIFD = 0;
memcpy(summary, (void *)&tiffHeader, sizeof(tiffHeader));
nOffset = sizeof(tiffHeader);
tagImageWidth.tdir_tag = TIFFTAG_IMAGEWIDTH;
tagImageWidth.tdir_type = TIFF_LONG;
tagImageWidth.tdir_count = 1;
tagImageWidth.tdir_offset = 320;
tagImageLength.tdir_tag = TIFFTAG_IMAGELENGTH;
tagImageLength.tdir_type = TIFF_LONG;
tagImageLength.tdir_count = 1;
tagImageLength.tdir_offset = 640;
// Write IFD data
memcpy(summary+nOffset, &numEntries, sizeof(numEntries));
nOffset += sizeof(numEntries);
memcpy((void *)(summary+nOffset), (void *)&tagImageWidth, sizeof(tagImageWidth));
nOffset += sizeof(tagImageWidth);
memcpy((void *)(summary+nOffset), (void *)&tagImageLength, sizeof(tagImageLength));
nOffset += sizeof(tagImageLength);
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the AAF file
checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
// 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);
// Create a source mob
checkResult(defs.cdSourceMob()->
CreateInstance(IID_IAAFSourceMob,
(IUnknown **)&pSourceMob));
checkResult(pSourceMob->QueryInterface(IID_IAAFMob, (void **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
checkResult(pMob->SetName(L"TIFFDescriptorTest"));
checkResult(defs.cdTIFFDescriptor()->
CreateInstance(IID_IAAFTIFFDescriptor,
(IUnknown **)&pTIFFDesc));
checkResult(pTIFFDesc->QueryInterface(IID_IAAFEssenceDescriptor, (void **)&pEssDesc));
checkResult(pTIFFDesc->SetIsUniform(kAAFFalse));
checkResult(pTIFFDesc->SetIsContiguous(kAAFTrue));
checkResult(pTIFFDesc->SetLeadingLines((aafInt32)10));
checkResult(pTIFFDesc->SetTrailingLines((aafInt32)20));
checkResult(pTIFFDesc->SetJPEGTableID((aafJPEGTableID_t)0));
checkResult(pTIFFDesc->SetSummary((aafUInt32)nOffset, (aafDataValue_t) summary));
checkResult(pSourceMob->SetEssenceDescriptor(pEssDesc));
// Add the MOB to the file
checkResult(pHeader->AddMob(pMob));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pTIFFDesc)
pTIFFDesc->Release();
if (pDictionary)
pDictionary->Release();
//.........这里部分代码省略.........
示例2: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFLocator * pLocator = NULL;
IAAFNetworkLocator * pNetLocator = NULL;
IAAFSourceMob *pSourceMob = NULL;
IAAFMob *pMob = NULL;
IAAFEssenceDescriptor *edesc = NULL;
aafUInt32 numLocators;
HRESULT hr = AAFRESULT_SUCCESS;
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the 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);
//Make the first mob
// Create a Mob
checkResult(defs.cdSourceMob()->
CreateInstance(IID_IAAFSourceMob,
(IUnknown **)&pSourceMob));
checkResult(pSourceMob->QueryInterface (IID_IAAFMob, (void **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
checkResult(pMob->SetName(L"SourceMOBTest"));
// Create a concrete subclass of EssenceDescriptor
checkResult(defs.cdAIFCDescriptor()->
CreateInstance(IID_IAAFEssenceDescriptor,
(IUnknown **)&edesc));
IAAFAIFCDescriptor* pAIFCDesc = NULL;
checkResult(edesc->QueryInterface (IID_IAAFAIFCDescriptor, (void **)&pAIFCDesc));
checkResult(pAIFCDesc->SetSummary (5, (unsigned char*)"TEST"));
pAIFCDesc->Release();
pAIFCDesc = NULL;
// Verify that there are no locators
checkResult(edesc->CountLocators(&numLocators));
checkExpression(0 == numLocators, AAFRESULT_TEST_FAILED);
// Make a locator, and attach it to the EssenceDescriptor
checkResult(defs.cdNetworkLocator()->
CreateInstance(IID_IAAFNetworkLocator,
(IUnknown **)&pNetLocator));
checkResult(pNetLocator->QueryInterface (IID_IAAFLocator, (void **)&pLocator));
checkResult(pLocator->SetPath (TEST_PATH));
checkResult(edesc->AppendLocator(pLocator));
checkResult(pSourceMob->SetEssenceDescriptor (edesc));
// Verify that there is now one locator
checkResult(edesc->CountLocators(&numLocators));
checkExpression(1 == numLocators, AAFRESULT_TEST_FAILED);
// Add the source mob into the tree
checkResult(pHeader->AddMob(pMob));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// cleanup
if (pLocator)
pLocator->Release();
if (pNetLocator)
pNetLocator->Release();
if (edesc)
edesc->Release();
if (pMob)
pMob->Release();
//.........这里部分代码省略.........
示例3: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
// IAAFSession* pSession = NULL;
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFMob* pMob = NULL;
IAAFMob* pReferencedMob = NULL;
IAAFTimelineMobSlot* newSlot = NULL;
IAAFSegment* seg = NULL;
IAAFComponent* pComponent = NULL;
IAAFDescriptiveClip* pDescClip = NULL;
bool bFileOpen = false;
HRESULT hr = AAFRESULT_SUCCESS;
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the 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);
//Make the MOB to be referenced
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pReferencedMob));
checkResult(pReferencedMob->SetMobID(TEST_referencedMobID));
checkResult(pReferencedMob->SetName(L"AAFDescriptiveClipTest::ReferencedMob"));
// Create a Mob
checkResult(defs.cdCompositionMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
checkResult(pMob->SetName(L"AAFDescriptiveClipTest"));
// Create a DescriptiveClip
checkResult(defs.cdDescriptiveClip()->
CreateInstance(IID_IAAFDescriptiveClip,
(IUnknown **)&pDescClip));
checkResult(pDescClip->QueryInterface(IID_IAAFComponent, (void **)&pComponent));
checkResult(pComponent->SetDataDef(defs.ddkAAFSound()));
pComponent->Release();
pComponent = NULL;
// Set the properties for the SourceClip
//checkResult(pDescClip->SetFade( fadeInLen, fadeInType, fadeOutLen, fadeOutType));
sourceRef.sourceID = TEST_referencedMobID;
sourceRef.sourceSlotID = 0;
sourceRef.startTime = 0;
checkResult(pDescClip->Initialize(defs.ddkAAFSound(), 1000, sourceRef));
// Get described slots - should not be present.
aafUInt32 size = 0;
AAFRESULT hr = pDescClip->CountDescribedSlotIDs( &size );
checkExpression( AAFRESULT_PROP_NOT_PRESENT == hr, AAFRESULT_TEST_FAILED );
// Set/Get single described slot id
aafUInt32 setSingleDescribedSlotID = 0xdeadbeef;
checkResult( pDescClip->AddDescribedSlotID( setSingleDescribedSlotID ) );
aafUInt32 getSingleDescribedSlotID = 0;
checkResult( pDescClip->GetDescribedSlotIDs( 1, &getSingleDescribedSlotID ) );
checkExpression( setSingleDescribedSlotID == getSingleDescribedSlotID, AAFRESULT_TEST_FAILED );
// Clear the ID set for the next test
checkResult( pDescClip->RemoveDescribedSlotID( setSingleDescribedSlotID ) );
// Set the persistent described slots.
for( aafUInt32 i_tid = 0; i_tid < TestDescribedSlotIDsVectorSize; ++i_tid )
{
checkResult( pDescClip->AddDescribedSlotID( TestDescribedSlotIDsVector[i_tid] ) );
}
aafUInt32 getDescribedSlotIDsVector[TestDescribedSlotIDsVectorSize];
checkResult( pDescClip->GetDescribedSlotIDs( TestDescribedSlotIDsVectorSize, getDescribedSlotIDsVector ) );
checkExpression( 0 == memcmp( getDescribedSlotIDsVector, TestDescribedSlotIDsVector, sizeof(TestDescribedSlotIDsVector) ),
AAFRESULT_TEST_FAILED );
checkResult(pDescClip->QueryInterface (IID_IAAFSegment, (void **)&seg));
aafRational_t editRate = { 0, 1};
checkResult(pMob->AppendNewTimelineSlot (editRate,
seg,
1,
slotName,
//.........这里部分代码省略.........
示例4: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFSourceMob* pSourceMob = NULL;
IAAFMob* pMob = NULL;
IAAFDataEssenceDescriptor* pDataEssenceDesc = NULL;
IAAFEssenceDescriptor* pEssDesc = NULL;
HRESULT hr = AAFRESULT_SUCCESS;
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the AAF file
checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
// 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));
// Create a source mob
CAAFBuiltinDefs defs (pDictionary);
checkResult(defs.cdSourceMob()->
CreateInstance(IID_IAAFSourceMob,
(IUnknown **)&pSourceMob));
checkResult(pSourceMob->QueryInterface(IID_IAAFMob, (void **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
RegisterDataEssenceDescriptorTest( pDictionary );
checkResult(pMob->SetName(L"DataEssenceDescriptorTest"));
checkResult( pDictionary->CreateInstance( TestDataEssenceDescriptorClassID,
IID_IAAFDataEssenceDescriptor,
(IUnknown**)&pDataEssenceDesc ) );
aafUID_t dataEssenceCoding;
memset(&dataEssenceCoding, 0, sizeof(aafUID_t));
checkResult(pDataEssenceDesc->SetDataEssenceCoding(dataEssenceCoding));
checkResult(pDataEssenceDesc->QueryInterface(IID_IAAFEssenceDescriptor, (void **)&pEssDesc));
checkResult(pSourceMob->SetEssenceDescriptor(pEssDesc));
// Add the MOB to the file
checkResult(pHeader->AddMob(pMob));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (pEssDesc)
pEssDesc->Release();
if (pDataEssenceDesc)
pDataEssenceDesc->Release();
if (pMob)
pMob->Release();
if (pSourceMob)
pSourceMob->Release();
if (pDictionary)
pDictionary->Release();
if (pHeader)
pHeader->Release();
if (pFile)
{
pFile->Save();
pFile->Close();
pFile->Release();
}
return hr;
}
示例5: 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();
//.........这里部分代码省略.........
示例6: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFMob *pMob = NULL;
IAAFMobSlot *newSlot = NULL;
IAAFSegment *seg = NULL;
IAAFSourceClip *sclp = NULL;
IAAFComponent *pComp = NULL;
HRESULT hr = S_OK;
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the 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);
//Make the first mob
long test;
// Create a concrete subclass of Mob
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
checkResult(pMob->SetName(L"MOBTest"));
// Add some slots
for(test = 0; test < 5; test++)
{
checkResult(defs.cdSourceClip()->
CreateInstance(IID_IAAFSourceClip,
(IUnknown **)&sclp));
checkResult(sclp->QueryInterface (IID_IAAFComponent, (void **)&pComp));
checkResult(pComp->SetDataDef (defs.ddkAAFPicture()));
pComp->Release();
pComp = NULL;
checkResult(sclp->QueryInterface (IID_IAAFSegment, (void **)&seg));
// Create a concrete subclass of MobSlot
checkResult(defs.cdStaticMobSlot()->
CreateInstance(IID_IAAFMobSlot,
(IUnknown **)&newSlot));
checkResult(newSlot->SetSegment(seg));
checkResult(newSlot->SetSlotID(test+1));
checkResult(newSlot->SetPhysicalNum(test+2));
checkResult(newSlot->SetName(slotNames[test]));
checkResult(pMob->AppendSlot (newSlot));
newSlot->Release();
newSlot = NULL;
seg->Release();
seg = NULL;
sclp->Release();
sclp = NULL;
}
// Add the mob to the file.
checkResult(pHeader->AddMob(pMob));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (newSlot)
newSlot->Release();
if (seg)
seg->Release();
if (sclp)
sclp->Release();
if (pComp)
pComp->Release();
//.........这里部分代码省略.........
示例7: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile* pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFOperationDef* pOperationDef = NULL;
IAAFParameterDef* pParamDef = NULL;
IAAFDefObject* pDefObject = NULL;
IAAFOperationGroup *pOperationGroup = NULL;
IAAFMob *pMob = NULL;
IAAFSegment *pSeg = NULL;
IAAFTimelineMobSlot *pSlot = NULL;
IAAFParameter *pParm = NULL;
IAAFVaryingValue *pVaryingValue = NULL;
IAAFSegment *pFiller = NULL;
IAAFComponent *pComponent = NULL;
IAAFSourceClip *pSourceClip = NULL;
IAAFControlPoint *pControlPoint = NULL;
IAAFSourceReference *pSourceRef = NULL;
IAAFInterpolationDef *pInterpDef = NULL;
IAAFPluginManager *pMgr = NULL;
IAAFTypeDef *pTypeDef = NULL;
bool bFileOpen = false;
HRESULT hr = S_OK;
// aafUID_t testInterpDef = kAAFTypeID_Rational;
aafLength_t effectLen = TEST_EFFECT_LEN;
aafUID_t effectID = kTestEffectID;
aafUID_t parmID = kTestParmID;
aafRational_t testLevel1 = kTestLevel1;
aafRational_t testLevel2 = kTestLevel2;
aafRational_t testTime1 = kTestTime1;
aafRational_t testTime2 = kTestTime2;
/* long test;
*/
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the AAF file
checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
bFileOpen = true;
// Get the AAF file header.
checkResult(pFile->GetHeader(&pHeader));
// Get the AAF Dictionary so that we can create valid AAF objects.
checkResult(pHeader->GetDictionary(&pDictionary));
CAAFBuiltinDefs defs (pDictionary);
checkResult(defs.cdOperationDef()->
CreateInstance(IID_IAAFOperationDef,
(IUnknown **)&pOperationDef));
checkResult(defs.cdParameterDef()->
CreateInstance(IID_IAAFParameterDef,
(IUnknown **)&pParamDef));
checkResult(pDictionary->LookupTypeDef (kAAFTypeID_Rational, &pTypeDef));
checkResult(pParamDef->Initialize (parmID, TEST_PARAM_NAME, TEST_PARAM_DESC, pTypeDef));
checkResult(AAFGetPluginManager(&pMgr));
checkResult(pMgr->CreatePluginDefinition(LinearInterpolator, pDictionary, &pDefObject));
checkResult(pDefObject->QueryInterface(IID_IAAFInterpolationDef, (void **) &pInterpDef));
pDefObject->Release();
pDefObject = NULL;
checkResult(pOperationDef->Initialize (effectID, TEST_EFFECT_NAME, TEST_EFFECT_DESC));
checkResult(pDictionary->RegisterOperationDef (pOperationDef));
checkResult(pDictionary->RegisterParameterDef (pParamDef));
checkResult(pDictionary->RegisterInterpolationDef (pInterpDef));
checkResult(pOperationDef->SetDataDef (defs.ddkAAFPicture()));
checkResult(pOperationDef->SetIsTimeWarp (kAAFFalse));
checkResult(pOperationDef->SetNumberInputs (TEST_NUM_INPUTS));
checkResult(pOperationDef->SetCategory (TEST_CATEGORY));
checkResult(pOperationDef->AddParameterDef (pParamDef));
checkResult(pOperationDef->SetBypass (TEST_BYPASS));
checkResult(pParamDef->SetDisplayUnits(TEST_PARAM_UNITS));
//Make the first mob
long test;
aafRational_t videoRate = { 2997, 100 };
// Create a Mob
checkResult(defs.cdCompositionMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult(pMob->SetName(L"AAFOperationGroupTest"));
// Add some slots
//.........这里部分代码省略.........
示例8: 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;
//.........这里部分代码省略.........
示例9: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFMob *pMob = NULL;
IAAFMob *pMob2 = NULL;
IAAFMob2 *pMobInterface2 = NULL;
IAAFTimelineMobSlot *newSlot = NULL;
IAAFStaticMobSlot *newStaticSlot=NULL;
IAAFEventMobSlot *newEventSlot=NULL;
IAAFSegment *seg = NULL;
IAAFSourceClip *sclp = NULL;
IAAFEvent *event=NULL;
IAAFComponent* pComponent = NULL;
IAAFClassDef *pcdEventMeta=NULL;
IAAFClassDef *pcdEvent=NULL;
IAAFClassDef *pcdEventConcrete=NULL;
HRESULT hr = S_OK;
aafNumSlots_t numMobs;
aafUInt32 bufLen = 0;
aafUInt32 bytesRead = 0;
aafUInt32 numComments = 0;
aafUInt32 numFound = 0;
aafWChar name[500];
aafWChar value[500];
IEnumAAFTaggedValues *enumTaggedVal = NULL;
IAAFTaggedValue *taggedVal = NULL;
IAAFMobSlot *mSlot = NULL;
IAAFFiller *filler = NULL;
IAAFKLVData *pKLVData = NULL;
IAAFTypeDef* pBaseType = NULL;
IAAFSourceReference *pSourceRef = NULL;
IAAFTimecode *pTimecode = NULL;
aafTimecode_t timecode;
int i;
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the 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);
//Make the first mob
long test;
// Create a concrete subclass of Mob
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult( pMob->QueryInterface(IID_IAAFMob2,(void**)&pMobInterface2));
checkResult(pMob->SetMobID(MOBTestID));
checkExpression(pMob->GetNameBufLen(&bufLen) == AAFRESULT_PROP_NOT_PRESENT, AAFRESULT_TEST_FAILED);
checkExpression(pMob->GetName(name, 0) == AAFRESULT_PROP_NOT_PRESENT, AAFRESULT_TEST_FAILED);
checkExpression(pMob->SetName(NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
checkResult(pMob->SetName(mobName));
checkResult(pMob->SetCreateTime(creationTimeStamp));
checkResult(pMob->SetModTime(modificationTimeStamp));
// Add some slots
for(test = 1; test < 6; test++)
{
checkResult(defs.cdSourceClip()->
CreateInstance(IID_IAAFSourceClip,
(IUnknown **)&sclp));
checkResult(sclp->QueryInterface(IID_IAAFSourceReference, (void **)&pSourceRef));
checkResult(pSourceRef->SetSourceID(MOBTestID3));
checkResult(sclp->QueryInterface(IID_IAAFComponent, (void **)&pComponent));
checkResult(pComponent->SetDataDef(defs.ddkAAFPicture()));
checkResult(sclp->QueryInterface (IID_IAAFSegment, (void **)&seg));
aafRational_t editRate = { 0, 1};
checkResult(pMob->AppendNewTimelineSlot (editRate,
seg,
test+1,
slotNames[test],
0,
&newSlot));
//.........这里部分代码省略.........
示例10: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFMob *pMob = NULL;
IAAFMob* pRMob = NULL;
IAAFMasterMob* pReferencedMob = NULL;
IAAFCompositionMob* pCompMob = NULL;
IAAFTimelineMobSlot *newSlot = NULL;
IAAFSegment *seg = NULL;
IAAFSourceClip *sclp = NULL;
HRESULT hr = S_OK;
try
{
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the 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);
//Make the first mob
long test;
// Create a Composition Mob
checkResult(defs.cdCompositionMob()->
CreateInstance(IID_IAAFCompositionMob,
(IUnknown **)&pCompMob));
checkResult(pCompMob->QueryInterface(IID_IAAFMob, (void **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
checkResult(pMob->SetName(L"AAFTaggedValuesTest"));
// append a comment to this mob !!
checkResult(pMob->AppendComment(const_cast<aafWChar*>(TagNames), Comments));
checkResult(pMob->AppendComment(const_cast<aafWChar*>(TagNames), AltComment));
// Create a master mob to be referenced
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMasterMob,
(IUnknown **)&pReferencedMob));
checkResult(pReferencedMob->QueryInterface(IID_IAAFMob, (void **)&pRMob));
checkResult(pRMob->SetMobID(TEST_referencedMobID));
checkResult(pRMob->SetName(L"AAFTaggedValueTest::ReferencedMob"));
// Add some slots
for(test = 0; test < 5; test++)
{
checkResult(defs.cdSourceClip()->
CreateInstance(IID_IAAFSourceClip,
(IUnknown **)&sclp));
// Set the properties for the SourceClip
sourceRef.sourceID = TEST_referencedMobID;
sourceRef.sourceSlotID = 0;
sourceRef.startTime = 0;
IAAFDataDefSP pDataDef;
checkResult(pDictionary->LookupDataDef(*slotDDefs[test], &pDataDef));
checkResult(sclp->Initialize(pDataDef, slotsLength[test], sourceRef));
checkResult(sclp->QueryInterface (IID_IAAFSegment, (void **)&seg));
aafRational_t editRate = { 0, 1};
checkResult(pMob->AppendNewTimelineSlot (editRate,
seg,
test+1,
slotNames[test],
0,
&newSlot));
newSlot->Release();
newSlot = NULL;
seg->Release();
seg = NULL;
sclp->Release();
sclp = NULL;
}
// Add the mob to the file.
checkResult(pHeader->AddMob(pMob));
checkResult(pHeader->AddMob(pRMob));
}
catch (HRESULT& rResult)
//.........这里部分代码省略.........
示例11: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFMob* pMob = NULL;
IAAFRIFFChunk* pRIFFChunk = NULL;
IAAFSourceMob* pSourceMob = NULL;
IAAFEssenceDescriptor* pEssDesc = NULL;
IAAFBWFImportDescriptor* pBWFImportDesc = NULL;
aafUInt32 byteswritten;
aafUInt32 bBytesWrote = 0;
HRESULT hr = S_OK;
// Remove the previous test file if any.
RemoveTestFile(pFileName);
// Create the 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.cdSourceMob()->
CreateInstance(IID_IAAFSourceMob,
(IUnknown **)&pSourceMob));
pSourceMob->QueryInterface(IID_IAAFMob, (void **)&pMob);
pMob->SetMobID(TEST_MobID);
pMob->SetName(L"RIFFChunkTest");
//Create BWFImportDescriptor to hold the RIFFChunk
checkResult( defs.cdBWFImportDescriptor()->
CreateInstance(IID_IAAFBWFImportDescriptor, (IUnknown **)&pBWFImportDesc));
// Create RIFFChunk and add it to BWFImportDescriptor
checkResult(defs.cdRIFFChunk()->CreateInstance(IID_IAAFRIFFChunk,
(IUnknown **)&pRIFFChunk));
checkResult(pBWFImportDesc->AppendUnknownBWFChunk(pRIFFChunk));
checkResult( pBWFImportDesc->QueryInterface(IID_IAAFEssenceDescriptor, (void **)&pEssDesc));
checkResult(pSourceMob->SetEssenceDescriptor(pEssDesc));
//Add the MOB to the file
checkResult(pHeader->AddMob(pMob));
bBytesWrote = 0;
checkResult(pRIFFChunk->Initialize(chunkID));
checkResult(pRIFFChunk->Write(sizeof(RIFFChunksmiley), (unsigned char *)RIFFChunksmiley, &bBytesWrote));
byteswritten = bBytesWrote;
bBytesWrote = 0;
checkResult(pRIFFChunk->Write(sizeof(RIFFChunkfrowney), (unsigned char *)RIFFChunkfrowney, &bBytesWrote));
byteswritten += bBytesWrote;
checkExpression(byteswritten == sizeof(RIFFChunksmiley) + sizeof(RIFFChunkfrowney), AAFRESULT_TEST_FAILED);
pFile->Save();
pEssDesc->Release();
pEssDesc = NULL;
pBWFImportDesc->Release();
pBWFImportDesc = NULL;
pRIFFChunk->Release();
pRIFFChunk = NULL;
pMob->Release();
pMob = NULL;
pSourceMob->Release();
pSourceMob = NULL;
pDictionary->Release();
pDictionary = NULL;
pHeader->Release();
pHeader = NULL;
pFile->Close();
pFile->Release();
pFile = NULL;
return hr;
}
示例12: 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
//.........这里部分代码省略.........
示例13: CreateAAFFile
//.........这里部分代码省略.........
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));
pTapeMob->Release();
pTapeMob = NULL;
// NOTE: TapeMob name is updated to change with number of objects
// requested at cli.
// In order to fit with the specification, it is made wide
char TapeMobNameBuffer[MAX];
sprintf(TapeMobNameBuffer,"Tape Mob %ld",i);
aafWChar TapeMobName[MAX];
mbstowcs(TapeMobName,TapeMobNameBuffer,MAX);
check(pMob->SetName (TapeMobName));
check(pHeader->AddMob(pMob));
check(pMob->GetMobID (&tapeMobID));
pMob->Release();
pMob = NULL;
// Make a FileMob
check(pCDSourceMob->CreateInstance(IID_IAAFSourceMob,
(IUnknown **)&pFileMob));
check(pCDAIFCDescriptor->CreateInstance(IID_IAAFFileDescriptor,
(IUnknown **)&pFileDesc));
check(pFileDesc->QueryInterface (IID_IAAFEssenceDescriptor,
(void **)&aDesc));
check(pFileDesc->QueryInterface (IID_IAAFAIFCDescriptor,
(void **)&pAIFCDesc));
check(pAIFCDesc->SetSummary (5, (unsigned char*)"TEST"));
pAIFCDesc->Release();
pAIFCDesc = NULL;
// Make a locator, and attach it to the EssenceDescriptor
check(pCDNetworkLocator->CreateInstance(IID_IAAFNetworkLocator,
(IUnknown **)&pNetLocator));
check(pNetLocator->QueryInterface (IID_IAAFLocator, (void **)&pLocator));
check(pLocator->SetPath (TEST_PATH));
check(aDesc->AppendLocator(pLocator));
pLocator->Release();
pLocator = NULL;
pNetLocator->Release();
pNetLocator = NULL;
示例14: CreateHTMLClip
void HTMLClipTest::CreateHTMLClip()
{
assert(_pHeader && _pDictionary);
HRESULT hr = S_OK;
IAAFMasterMob *pMasterMob = NULL;
IAAFMob *pReferencedMob = NULL;
IAAFHTMLClip *pHTMLClip = NULL;
IAAFSourceReference *pSourceReference = NULL;
IAAFCompositionMob *pCompositionMob = NULL;
IAAFMob *pReferencingMob = NULL;
IAAFSegment *pSegment = NULL;
IAAFTimelineMobSlot *pMobSlot = NULL;
IAAFComponent *pComponent = NULL;
CAAFBuiltinDefs defs (_pDictionary);
try
{
//Make the MOB to be referenced
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMasterMob,
(IUnknown **)&pMasterMob));
checkResult(pMasterMob->QueryInterface(IID_IAAFMob, (void **)&pReferencedMob));
checkResult(pReferencedMob->GetMobID(&_referencedMobID));
checkResult(pReferencedMob->SetName(L"HTMLClipTest::ReferencedMob"));
// Save the master mob.
checkResult(_pHeader->AddMob(pReferencedMob));
// Use EssenceAccess to write some html essence
// Create a file mob for the html essence.
// Create the corresponding html essence.
// Write some html essence.
// Create a HTMLClip
checkResult(defs.cdHTMLClip()->
CreateInstance(IID_IAAFHTMLClip,
(IUnknown **)&pHTMLClip));
checkResult(pHTMLClip->SetBeginAnchor(const_cast<wchar_t *>(_beginAnchor)));
checkResult(pHTMLClip->SetEndAnchor(const_cast<wchar_t *>(_endAnchor)));
checkResult(pHTMLClip->QueryInterface(IID_IAAFComponent, (void **)&pComponent));
checkResult(pComponent->SetDataDef(defs.ddkAAFPicture()));
pComponent->Release();
pComponent = NULL;
// Initialize the source reference data.
checkResult(pHTMLClip->QueryInterface(IID_IAAFSourceReference, (void **)&pSourceReference));
checkResult(pSourceReference->SetSourceID(_referencedMobID));
checkResult(pSourceReference->SetSourceMobSlotID(0));
// Create a composition mob to hold the html clip.
checkResult(defs.cdCompositionMob()->
CreateInstance(IID_IAAFCompositionMob,
(IUnknown **)&pCompositionMob));
checkResult(pCompositionMob->QueryInterface(IID_IAAFMob, (void **)&pReferencingMob));
checkResult(pReferencingMob->SetName(L"CompositionMob_HTMLClipTest"));
checkResult(pHTMLClip->QueryInterface(IID_IAAFSegment, (void **)&pSegment));
IAAFMobSlot *pSlot = NULL;
aafRational_t editRate = { 0, 1};
checkResult(pReferencingMob->AppendNewTimelineSlot(editRate,
pSegment,
1,
L"HTMLClipTest",
0,
&pMobSlot));
// Save the referencing mob.
checkResult(_pHeader->AddMob(pReferencingMob));
}
catch (HRESULT& rHR)
{
hr = rHR;
// fall through and handle cleanup
}
// Cleanup local references
if (pMobSlot)
{
pMobSlot->Release();
pMobSlot = NULL;
}
if (pComponent)
{
pComponent->Release();
pComponent = NULL;
}
if (pSegment)
{
pSegment->Release();
pSegment = NULL;
}
//.........这里部分代码省略.........
示例15: CreateAAFFile
static HRESULT CreateAAFFile(const aafWChar * pFileName, testDataFile_t *dataFile, testType_t testType,
IAAFFile ** ppFile)
{
IAAFFile* pFile = NULL;
IAAFHeader* pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFMob* pMob = NULL;
IAAFMasterMob* pMasterMob = NULL;
IAAFEssenceAccess* pEssenceAccess = NULL;
IAAFEssenceFormat* pFormat = NULL;
IAAFEssenceFormat *format = NULL;
IAAFLocator *pLocator = NULL;
aafMobID_t masterMobID;
aafProductIdentification_t ProductInfo;
aafRational_t editRate = {44100, 1};
aafRational_t sampleRate = {44100, 1};
FILE* pWavFile = NULL;
unsigned char dataBuff[4096], *dataPtr;
aafUInt32 dataOffset, dataLen;
aafUInt16 bitsPerSample, numCh;
aafInt32 n, numSpecifiers;
aafUID_t essenceFormatCode, testContainer;
int i;
IAAFClassDef *pMasterMobDef = NULL;
IAAFClassDef *pNetworkLocatorDef = NULL;
IAAFDataDef *pSoundDef = NULL;
aafUInt32 samplesWritten, bytesWritten;
// Delete any previous test file before continuing...
char chFileName[1000];
convert(chFileName, sizeof(chFileName), pFileName);
remove(chFileName);
if(dataFile != NULL)
{
// Delete any previous test file before continuing...
char chFileName[1000];
convert(chFileName, sizeof(chFileName), dataFile->dataFilename);
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;
/* Create a new AAF file IN MEMORY */
check(AAFFileOpenNewModifyEx (pFileName, &kAAFFileKind_Aaf4KBinary, 0, &ProductInfo, ppFile));
pFile=*ppFile;
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, &pMasterMobDef));
check(pDictionary->LookupClassDef(AUID_AAFNetworkLocator, &pNetworkLocatorDef));
/* Lookup any necessary data definitions. */
check(pDictionary->LookupDataDef(kAAFDataDef_Sound, &pSoundDef));
/* Create a Mastermob */
// note that there is only one iteration at present because of
// a bug in essenceaccess which prevents this functioning...
for (i = 0; i<1; i++)
{
// Get a Master MOB Interface
check(pMasterMobDef->
CreateInstance(IID_IAAFMasterMob,
(IUnknown **)&pMasterMob));
// Get a Mob interface and set its variables.
check(pMasterMob->QueryInterface(IID_IAAFMob, (void **)&pMob));
check(pMob->GetMobID(&masterMobID));
check(pMob->SetName(L"A Master Mob"));
// Add it to the file
check(pHeader->AddMob(pMob));
if(dataFile != NULL)
{
// Make a locator, and attach it to the EssenceDescriptor
check(pNetworkLocatorDef->
CreateInstance(IID_IAAFLocator,
(IUnknown **)&pLocator));
check(pLocator->SetPath (dataFile->dataFilename));
testContainer = dataFile->dataFormat;
}
else
{
pLocator = NULL;
//.........这里部分代码省略.........