本文整理汇总了C++中IAAFHeader::AddMob方法的典型用法代码示例。如果您正苦于以下问题:C++ IAAFHeader::AddMob方法的具体用法?C++ IAAFHeader::AddMob怎么用?C++ IAAFHeader::AddMob使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAAFHeader
的用法示例。
在下文中一共展示了IAAFHeader::AddMob方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createFileMob
void EssenceDataTest::createFileMob(unsigned int mobid_Index)
{
assert(_pFile && _pHeader && _pDictionary);
assert(NULL == _pSourceMob);
assert(NULL == _pMob);
assert(NULL == _pFileDescriptor);
assert(NULL == _pEssenceDescriptor);
assert(NULL == _pSourceMob);
CAAFBuiltinDefs defs (_pDictionary);
// Create a Mob
check(defs.cdSourceMob()->CreateInstance(IID_IAAFSourceMob,
(IUnknown **)&_pSourceMob));
check(_pSourceMob->QueryInterface (IID_IAAFMob, (void **)&_pMob));
check(_pMob->SetMobID(TEST_MobIDs[mobid_Index]));
check(_pMob->SetName(L"EssenceDataTest File Mob"));
// instantiate a concrete subclass of FileDescriptor
check(defs.cdAIFCDescriptor()->
CreateInstance(IID_IAAFFileDescriptor,
(IUnknown **)&_pFileDescriptor));
IAAFAIFCDescriptor* pAIFCDesc = NULL;
check(_pFileDescriptor->QueryInterface (IID_IAAFAIFCDescriptor, (void **)&pAIFCDesc));
check(pAIFCDesc->SetSummary (5, (unsigned char*)"TEST"));
pAIFCDesc->Release();
pAIFCDesc = NULL;
check(_pFileDescriptor->QueryInterface (IID_IAAFEssenceDescriptor,
(void **)&_pEssenceDescriptor));
check(_pSourceMob->SetEssenceDescriptor (_pEssenceDescriptor));
check(_pHeader->AddMob(_pMob));
createEssenceData(_pSourceMob);
// Cleanup instance data for reuse...
_pEssenceDescriptor->Release();
_pEssenceDescriptor = NULL;
_pFileDescriptor->Release();
_pFileDescriptor = NULL;
_pMob->Release();
_pMob = NULL;
_pSourceMob->Release();
_pSourceMob = NULL;
}
示例2: 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
//.........这里部分代码省略.........
示例3: CreateAAFFile
static HRESULT CreateAAFFile(const aafWChar * pFileName, testDataFile_t *dataFile, testType_t testType)
{
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;
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 */
check(AAFFileOpenNewModifyEx (pFileName, &kAAFFileKind_Aaf4KBinary, 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, &pMasterMobDef));
check(pDictionary->LookupClassDef(AUID_AAFNetworkLocator, &pNetworkLocatorDef));
/* Lookup any necessary data definitions. */
check(pDictionary->LookupDataDef(kAAFDataDef_Sound, &pSoundDef));
/* Create a Mastermob */
// 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;
testContainer = ContainerAAF;
}
// Open the Essence file to be included in this AAF file("Laser.wav")
pWavFile = fopen("Laser.wav", "r");
if (pWavFile)
//.........这里部分代码省略.........
示例4: 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;
bool bFileOpen = false;
HRESULT hr = AAFRESULT_SUCCESS;
IAAFComponent* pComponent = NULL;
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"AAFSourceClipTest::ReferencedMob"));
// Create a Mob
checkResult(defs.cdCompositionMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult(pMob->SetMobID(TEST_MobID));
checkResult(pMob->SetName(L"AAFSourceClipTest"));
// Create a SourceClip
checkResult(defs.cdSourceClip()->
CreateInstance(IID_IAAFSegment,
(IUnknown **)&seg));
checkResult(seg->QueryInterface(IID_IAAFComponent, (void **)&pComponent));
checkResult(pComponent->SetDataDef(defs.ddkAAFPicture()));
pComponent->Release();
pComponent = NULL;
aafRational_t editRate = { 0, 1};
checkResult(pMob->AppendNewTimelineSlot (editRate,
seg,
1,
slotName,
0,
&newSlot));
checkResult(pHeader->AddMob(pMob));
checkResult(pHeader->AddMob(pReferencedMob));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if (newSlot)
newSlot->Release();
if (pComponent)
pComponent->Release();
if (seg)
seg->Release();
if (pMob)
pMob->Release();
if (pReferencedMob)
pReferencedMob->Release();
if (pDictionary)
pDictionary->Release();
if (pHeader)
pHeader->Release();
if (pFile)
{
if (bFileOpen)
{
pFile->Save();
//.........这里部分代码省略.........
示例5: 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;
IAAFRIFFChunk* pRIFFChunk2 = NULL;
IAAFSourceMob* pSourceMob = NULL;
IAAFEssenceDescriptor* pEssDesc = NULL;
IAAFBWFImportDescriptor* pBWFImportDesc = NULL;
aafUInt32 testNum;
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"BWFImportDescriptorTest");
//Create BWFImportDescriptor to hold the RIFFChunk
checkResult( defs.cdBWFImportDescriptor()->
CreateInstance(IID_IAAFBWFImportDescriptor, (IUnknown **)&pBWFImportDesc));
// Create RIFFChunks and append them to BWFImportDescriptor
checkResult(defs.cdRIFFChunk()->CreateInstance(IID_IAAFRIFFChunk,
(IUnknown **)&pRIFFChunk));
checkResult(defs.cdRIFFChunk()->CreateInstance(IID_IAAFRIFFChunk,
(IUnknown **)&pRIFFChunk2));
checkResult(pBWFImportDesc->AppendUnknownBWFChunk(pRIFFChunk));
checkResult(pBWFImportDesc->AppendUnknownBWFChunk(pRIFFChunk2));
checkExpression(pBWFImportDesc->AppendUnknownBWFChunk(pRIFFChunk)==AAFRESULT_OBJECT_ALREADY_ATTACHED, AAFRESULT_TEST_FAILED);
checkResult(pBWFImportDesc->SetFileSecurityReport(TEST_FileSecurityReport));
checkResult(pBWFImportDesc->SetFileSecurityWave(TEST_FileSecurityWave));
checkResult(pBWFImportDesc->SetCodingHistory(TEST_CodingHistory));
checkResult(pBWFImportDesc->SetBasicData(TEST_BasicData));
checkResult(pBWFImportDesc->SetStartOfModulation(TEST_StartOfModulation));
checkResult(pBWFImportDesc->SetQualityEvent(TEST_QualityEvent));
checkResult(pBWFImportDesc->SetEndOfModulation(TEST_EndOfModulation));
checkResult(pBWFImportDesc->SetQualityParameter(TEST_QualityParameter));
checkResult(pBWFImportDesc->SetOperatorComment(TEST_OperatorComment));
checkResult(pBWFImportDesc->SetCueSheet(TEST_CueSheet));
checkResult( pBWFImportDesc->QueryInterface(IID_IAAFEssenceDescriptor, (void **)&pEssDesc));
checkResult(pSourceMob->SetEssenceDescriptor(pEssDesc));
//Add the MOB to the file
checkResult(pHeader->AddMob(pMob));
testNum = 0;
checkResult(pRIFFChunk->Initialize(chunkID));
checkResult(pRIFFChunk->Write(sizeof(RIFFChunksmiley), (unsigned char *)RIFFChunksmiley, &testNum));
checkExpression(testNum == sizeof(RIFFChunksmiley), AAFRESULT_TEST_FAILED);
testNum = 0;
checkResult(pRIFFChunk2->Initialize(chunkID2));
checkResult(pRIFFChunk2->Write(sizeof(RIFFChunkfrowney), (unsigned char *)RIFFChunkfrowney, &testNum));
checkExpression(testNum == sizeof(RIFFChunkfrowney), AAFRESULT_TEST_FAILED);
pFile->Save();
pEssDesc->Release();
pEssDesc = NULL;
pBWFImportDesc->Release();
pBWFImportDesc = NULL;
pRIFFChunk->Release();
pRIFFChunk = NULL;
pRIFFChunk2->Release();
pRIFFChunk2 = NULL;
pMob->Release();
pMob = NULL;
pSourceMob->Release();
pSourceMob = NULL;
//.........这里部分代码省略.........
示例6: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
// IAAFSession * pSession = NULL;
IAAFFile * pFile = NULL;
bool bFileOpen = false;
IAAFHeader * pHeader = NULL;
IAAFDictionary* pDictionary = NULL;
IAAFSourceMob *pSourceMob = NULL;
IAAFMob *pMob = NULL;
IAAFEssenceDescriptor *edesc = 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
// Create a FileMob
checkResult(defs.cdSourceMob()->
CreateInstance(IID_IAAFSourceMob,
(IUnknown **)&pSourceMob));
checkResult(pSourceMob->QueryInterface (IID_IAAFMob, (void **)&pMob));
checkResult(pMob->SetMobID(TEST_File_MobID));
checkResult(pMob->SetName(L"File Mob"));
// Check the Mob2 usage code implementations.
// Need IAAFMob2 for to do that.
{
IAAFSmartPointer<IAAFMob2> pMobInterface2;
checkResult( pMob->QueryInterface( IID_IAAFMob2, reinterpret_cast<void**>(&pMobInterface2) ) );
checkResult( pMobInterface2->SetUsageCode( kAAFUsage_Template ) );
}
// Create a concrete subclass of FileDescriptor
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;
checkResult(pSourceMob->SetEssenceDescriptor (edesc));
checkResult(pHeader->AddMob(pMob));
// Reusing local variable so we need to release the inteface.
pMob->Release();
pMob = NULL;
// Create a MasterMob
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
checkResult(pMob->SetMobID(TEST_Master_MobID));
checkResult(pMob->SetName(L"Master Mob"));
// Check the Mob2 usage code implementations.
// Need IAAFMob2 for to do that.
{
IAAFSmartPointer<IAAFMob2> pMobInterface2;
checkResult( pMob->QueryInterface( IID_IAAFMob2, reinterpret_cast<void**>(&pMobInterface2) ) );
checkResult( pMobInterface2->SetUsageCode( kAAFUsage_Template ) );
}
checkResult(pHeader->AddMob(pMob));
// Reusing local variable so we need to release the inteface.
pMob->Release();
pMob = NULL;
// Create a CompositionMob
checkResult(defs.cdCompositionMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob));
//.........这里部分代码省略.........
示例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;
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;
}
示例8: CreateAAFFile
//.........这里部分代码省略.........
(IUnknown **)&pSourceClip));
aafSourceRef_t sourceRef;
sourceRef.sourceID = zeroMobID;
sourceRef.sourceSlotID = 0;
sourceRef.startTime = 0;
checkResult(pSourceClip->Initialize (defs.ddkAAFPicture(), effectLen, sourceRef));
checkResult(pSourceClip->QueryInterface (IID_IAAFSourceReference, (void **)&pSourceRef));
checkResult(pOperationGroup->SetRender (pSourceRef));
checkResult(pOperationGroup->QueryInterface (IID_IAAFSegment, (void **)&pSeg));
checkResult(pMob->AppendNewTimelineSlot (videoRate, pSeg, test+1, slotNames[test], 0, &pSlot));
pSlot->Release();
pSlot = NULL;
pSeg->Release();
pSeg = NULL;
pOperationGroup->Release();
pOperationGroup = NULL;
pParm->Release();
pParm = NULL;
pVaryingValue->Release();
pVaryingValue = NULL;
pComponent->Release();
pComponent = NULL;
pSourceRef->Release();
pSourceRef = NULL;
pSourceClip->Release();
pSourceClip = NULL;
}
// Add the mob to the file.
checkResult(pHeader->AddMob(pMob));
}
catch (HRESULT& rResult)
{
hr = rResult;
}
// Cleanup and return
if(pSourceRef)
pSourceRef->Release();
if(pControlPoint)
pControlPoint->Release();
if(pSourceClip)
pSourceClip->Release();
if (pDefObject)
pDefObject->Release();
if (pOperationGroup)
pOperationGroup->Release();
if (pMob)
pMob->Release();
if (pSeg)
pSeg->Release();
if (pSlot)
pSlot->Release();
if (pComponent)
pComponent->Release();
if (pParm)
pParm->Release();
// if (pIntDef)
// pIntDef->Release();
if (pInterpDef)
示例9: 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;
}
//.........这里部分代码省略.........
示例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;
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();
//.........这里部分代码省略.........
示例11: CreateAAFFile
static HRESULT CreateAAFFile(
aafWChar * pFileName,
aafUID_constref fileKind,
testRawStorageType_t rawStorageType,
aafProductIdentification_constref productID)
{
HRESULT hr = AAFRESULT_SUCCESS;
IAAFFile* pFile = NULL;
IAAFHeader * pHeader = NULL;
IAAFDictionary * pDict = NULL;
try
{
//Do the usual ...
RemoveTestFile (pFileName);
checkResult (CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
assert (pFile);
checkResult (pFile->GetHeader (&pHeader));
assert (pHeader);
checkResult (pHeader->GetDictionary (&pDict));
assert (pDict);
CAAFBuiltinDefs defs (pDict);
///////////////////////
//checkResult(createCHARType (pDict));
checkResult(addCHARTypeToComponent (pDict));
///////////
//Create a concrete subclass of mob
IAAFMobSP spMob;
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&spMob));
checkResult(spMob->SetMobID(TEST_MobID));
checkResult(spMob->SetName(L"Some Mob"));
//Add a slot - make it our Filler
/// first, create Filler
IAAFFillerSP spFill;
checkResult(defs.cdFiller()->CreateInstance(IID_IAAFFiller, (IUnknown**)&spFill));
checkResult(spFill->Initialize(defs.ddkAAFSound(), 10));
checkResult(createCHARFiller(pDict, spFill));
//seg
//QI the filler for its segment
IAAFSegmentSP spSeg;
checkResult(spFill->QueryInterface (IID_IAAFSegment, (void **)&spSeg));
//Create a concrete subclass of mob slot
IAAFMobSlotSP spMobSlot;
checkResult(defs.cdStaticMobSlot()->
CreateInstance(IID_IAAFMobSlot,
(IUnknown **)&spMobSlot));
//Add the segment to the mobslot
checkResult(spMobSlot->SetSegment(spSeg));
checkResult(spMobSlot->SetSlotID(TEST_SLOT_ID));
checkResult(spMobSlot->SetName(TEST_SLOT_NAME));
//Append the slot to the Mob ....
checkResult(spMob->AppendSlot (spMobSlot));
//FINALLY .... Add mob to header
checkResult (pHeader->AddMob (spMob));
//////////////////// done /!!!!!!!!!!!!!!!!!!!!!!
//Verify results right away (during this creation process) ....
checkResult(verifyContents (pHeader, pDict, kAAFTrue)); //True => minimal testing
}
catch (HRESULT & rResult)
{
hr = rResult;
}
if (pDict) pDict->Release();
if (pHeader) pHeader->Release();
if (pFile)
{
stopGap(pFile->Save());
stopGap(pFile->Close());
pFile->Release();
}
return hr;
}//CreateAAFFile()
示例12: CreateAAFFile
//.........这里部分代码省略.........
taggedVal = NULL;
enumTaggedVal->Reset();
for (i = 0; i < 5; ++i)
{
if (i==2)
continue;
checkResult(enumTaggedVal->NextOne(&taggedVal));
checkResult(taggedVal->GetNameBufLen(&bufLen));
checkResult(taggedVal->GetName(name, bufLen));
checkExpression(wcscmp(name, pCategory[i]) == 0, AAFRESULT_TEST_FAILED);
checkResult(taggedVal->GetValueBufLen(&bufLen));
checkResult(taggedVal->GetValue(bufLen, (aafDataBuffer_t)value, &bytesRead));
checkExpression(wcscmp(value, pComment[i]) == 0, AAFRESULT_TEST_FAILED);
taggedVal->Release();
taggedVal = NULL;
}
enumTaggedVal->Release();
enumTaggedVal = NULL;
// Check the Mob2 attribute and usage code implementations.
// Need IAAFMob2 for that;
checkResult( pMobInterface2->AppendAttribute( AttributeNames[0], AttributeValues[0] ) );
checkResult( pMobInterface2->AppendAttribute( AttributeNames[1], AttributeValues[1] ) );
checkResult( pMobInterface2->SetUsageCode( kAAFUsage_SubClip ) );
// Add the mob to the file.
checkResult(pHeader->AddMob(pMob));
// Test changing the mob id after the mob is attached to the
// content store. Change it, then reset to the original id.
checkResult(pMob->SetMobID(MOBTestID2));
checkResult(pMob->SetMobID(MOBTestID));
// Create another Mob, check mob count, then delete and recheck count
checkResult(defs.cdMasterMob()->
CreateInstance(IID_IAAFMob,
(IUnknown **)&pMob2));
checkResult(pMob2->SetMobID(MOBTestID2));
checkResult(pMob2->SetName(mobName));
checkResult(pMob2->SetCreateTime(creationTimeStamp));
checkResult(pMob2->SetModTime(modificationTimeStamp));
// Add the mob to the file.
checkResult(pHeader->AddMob(pMob2));
checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
checkExpression(numMobs == 2, AAFRESULT_TEST_FAILED);
checkResult(pHeader->RemoveMob(pMob2));
checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
checkExpression(numMobs == 1, AAFRESULT_TEST_FAILED);
//try Copy()
const aafCharacter *copy_name = L"Name of Copied Mob";
IAAFMobSP spCopiedMob;
checkResult(pMob->Copy(copy_name, &spCopiedMob));
checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
checkExpression(numMobs == 2, AAFRESULT_TEST_FAILED);
checkResult(pHeader->RemoveMob(spCopiedMob));
checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
示例13: main
//.........这里部分代码省略.........
{ ++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;
check(pMob->GetNameBufLen(&size_before));
check(pHeader->AddMob(pMob));
pMob->Release();
pHeader->Release();
pDictionary->Release();
// All the work of storing to disk happens during Save()
// The bits() variable is next read in OMType::contract() at OMType.cpp:137
// which is called by ImplAAFTypeDefCharacter::externalize() at ImplAAFTypeDefCharacter.cpp:307
// which is called by ImplAAFTypeDefString::externalize() at ImplAAFTypeDefString.cpp:584
// which is called by OMSSStoredObject::save() at OMSSStoredObject.cpp:382
check(pFile->Save());
check(pFile->Close());
pFile->Release();
// OMCharacterStringProperty<CharacterType>::stringLength() at OMVariableSizePropertyT.h:80
// calculates string length of AAF string properties
// Read AAF file back in
check(AAFFileOpenExistingRead(filename, mode, &pFile));
// Get the Mob
check(pFile->GetHeader(&pHeader));
check(pHeader->LookupMob(TEST_MobID, &pMob));
aafUInt32 size_after = 0;
check(pMob->GetNameBufLen(&size_after));
aafCharacter *mobname_after = new aafCharacter[size_after];
check(pMob->GetName(mobname_after, size_after));
// Compare Mob name before storing to disk with Mob name read back from disk
int test_result = 0;
if (size_before != size_after) {
printf("size_before=%d != size_after=%d\n", size_before, size_after);
test_result = 1;
示例14: 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)
//.........这里部分代码省略.........
示例15: 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;
}