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


C++ IAAFFile::Save方法代码示例

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


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

示例1: Close

void EventTest::Close()
{
  if (_pDictionary)
  {
    _pDictionary->Release();
    _pDictionary = NULL;
  }

  if (_pHeader)
  {
    _pHeader->Release();
    _pHeader = NULL;
  }
  
  if (_pFile)
  {
    if (_bWritableFile)
      checkResult(_pFile->Save());

    checkResult(_pFile->Close());

    _pFile->Release();
    _pFile = NULL;
  }  
}
开发者ID:mcanthony,项目名称:aaf,代码行数:25,代码来源:CAAFEventTest.cpp

示例2: createFile

void EnumEssenceDataTest::createFile(const wchar_t *pFileName)
{
  // Remove the previous test file if any.
  removeTestFile(pFileName);


  check(CreateTestFile( pFileName, _fileKind, _rawStorageType, _productInfo, &_pFile ));
  _bFileOpen = true;
  check(_pFile->GetHeader(&_pHeader));
  check(_pHeader->GetDictionary(&_pDictionary));

  for (aafUInt32 item = 0; item < _maxMobCount; ++item)
    createFileMob(item);
 
  check(_pFile->Save());

  cleanupReferences();
}
开发者ID:mcanthony,项目名称:aaf,代码行数:18,代码来源:CEnumAAFEssenceDataTest.cpp

示例3: createFile

void EssenceDataTest::createFile(
    wchar_t *pFileName,
    aafUID_constref fileKind,
    testRawStorageType_t rawStorageType)
{
  // Delete the test file if it already exists.
  remove(convert(pFileName));

  check(CreateTestFile( pFileName, fileKind, rawStorageType, _productInfo, &_pFile ));
  _bFileOpen = true;
  check(_pFile->GetHeader(&_pHeader));
  check(_pHeader->GetDictionary(&_pDictionary));

  createFileMob(0); //use unique mobid's (without using cocreate guid()
  createFileMob(1); //use unique mobid's (without using cocreate guid()

  check(_pFile->Save());

  cleanupReferences();
}
开发者ID:mcanthony,项目名称:aaf,代码行数:20,代码来源:CAAFEssenceDataTest.cpp

示例4:

extern "C" HRESULT CAAFPluginManager_test(
    testMode_t mode,
    aafUID_t fileKind,
    testRawStorageType_t rawStorageType,
    aafProductIdentification_t productID)
{
	HRESULT hr = AAFRESULT_SUCCESS;
	IEnumAAFLoadedPlugins	*pEnum = NULL;
	IAAFPluginManager		*pMgr = NULL;
	aafUID_t				testUID;
	IAAFFile*		pFile = NULL;
	bool bFileOpen = false;
	IAAFHeader *        pHeader = NULL;
	IAAFDictionary*  pDictionary = NULL;
	IAAFDefObject	*pPluginDef = NULL;
	IAAFPlugin	*plugin			= NULL;

	const size_t fileNameBufLen = 128;
	aafWChar pFileName[ fileNameBufLen ] = L"";
	GenerateTestFileName( productID.productName, fileKind, fileNameBufLen, pFileName );

	try
	{
		if(mode != kAAFUnitTestReadWrite)
			return AAFRESULT_SUCCESS;			// Can't run this test read-only

		// Remove the previous test file if any.
		RemoveTestFile(pFileName);

		
		checkResult(AAFGetPluginManager (&pMgr));
		
		// 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));

		checkResult(pMgr->EnumLoadedPlugins (AUID_AAFCodecDef, &pEnum));
		while(pEnum->NextOne (&testUID) == AAFRESULT_SUCCESS)
		{
			checkResult(pMgr->CreatePluginDefinition (testUID, pDictionary, &pPluginDef));
			pPluginDef->Release();
			pPluginDef = NULL;
		}
		hr = AAFRESULT_SUCCESS;

		checkResult(pMgr->CreateInstance(CLSID_AAFBasicInterp,
			NULL, 
			IID_IAAFPlugin, 
			(void **)&plugin));
	}
	catch (HRESULT& rhr)
	{
		hr = rhr;
	}

	if (plugin)
		plugin->Release();

	if (pEnum)
		pEnum->Release();

	if (pMgr)
		pMgr->Release();

	if (pDictionary)
		pDictionary->Release();
	
	if (pHeader)
		pHeader->Release();
	
	if (pFile)
	{  // Close file
		if (bFileOpen)
		{
			pFile->Save();
			pFile->Close();
		}
		pFile->Release();
	}
	
	// JeffB: RegisterPluginDirectory and RegisterPluginFile have their implementations tested
	// by the RegisterStandard() function, and will require a special local plugin to test.  Therefore
	// I'm pushing the test off post 1.0 and declaring success here.
	// When all of the functionality of this class is tested, we can return success.
	// When a method and its unit test have been implemented, remove it from the list.
//	if (SUCCEEDED(hr))
//	{
//		cout << "The following IAAFPluginManager tests have not been implemented:" << endl; 
////!!!		cout << "     RegisterPluginDirectory" << endl; 
////!!!		cout << "     RegisterPluginFile" << endl; 
////		cout << "     EnumLoadedPlugins" << endl; 
//		cout << "     CreateInstance" << endl; 
//		hr = AAFRESULT_TEST_PARTIAL_SUCCESS;
//	}
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:aaf,代码行数:101,代码来源:CAAFPluginManagerTest.cpp

示例5: CreateAAFFile


//.........这里部分代码省略.........
	aafUID_t			testParmID = kParmID;
	aafInt32			index;
	IAAFOperationDef	*pOperationDef = NULL, *defResults[3] = { NULL, NULL, NULL };

/*	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.cdParameterDef()->
					CreateInstance(IID_IAAFParameterDef, 
								   (IUnknown **)&pParamDef));
		checkResult(pParamDef->Initialize (testParmID, TEST_PARAM_NAME, TEST_PARAM_DESC, defs.tdRational()));
		checkResult(pDictionary->RegisterParameterDef(pParamDef));

		for(index = 0; index < 3; index++)
		{
			checkResult(defs.cdOperationDef()->
						CreateInstance(IID_IAAFOperationDef, 
									   (IUnknown **)&pOperationDef));
			checkResult(pOperationDef->Initialize (effectID[index], effectNames[index], effectDesc[index]));
			checkResult(pDictionary->RegisterOperationDef(pOperationDef));
			
			
			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));
			
			defResults[index] = pOperationDef;
			pOperationDef = NULL;
		}

		checkResult(defResults[1]->AppendDegradeToOperation (defResults[1]));
		checkResult(defResults[2]->AppendDegradeToOperation (defResults[2]));
		checkResult(defResults[0]->AppendDegradeToOperation (defResults[1]));
		checkResult(defResults[0]->PrependDegradeToOperation (defResults[2]));
		// Add an extra one to delete for the test
//!!!		checkResult(defResults[0]->CountDegradeToOperations(&numDegrade));
//		checkExpression(2 == numDegrade, AAFRESULT_TEST_FAILED);
//		checkResult(defResults[0]->AppendDegradeToOperation (defResults[1]));
//		checkResult(defResults[0]->CountDegradeToOperations(&numDegrade));
//		checkExpression(3 == numDegrade, AAFRESULT_TEST_FAILED);
//		checkResult(defResults[0]->RemoveDegradeToOperationAt (2));
//		checkResult(defResults[0]->CountDegradeToOperations(&numDegrade));
//		checkExpression(2 == numDegrade, AAFRESULT_TEST_FAILED);

		for(index = 0; index < 3; index++)
		{
			defResults[index]->Release();
			defResults[index] = NULL;
		}
	}
	catch (HRESULT& rResult)
	{
		hr = rResult;
	}


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

	if (pParamDef)
		pParamDef->Release();

	if (pDictionary)
		pDictionary->Release();

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

	return hr;
}
开发者ID:UIKit0,项目名称:aaf,代码行数:101,代码来源:CAAFOperationDefTest.cpp

示例6: CreateAAFFile


//.........这里部分代码省略.........
			checkResult(defs.cdSourceMob()->
				CreateInstance(IID_IAAFSourceMob, 
				(IUnknown **)&pSrcMob));		
			
			ref.sourceID = tapeMobID;
			ref.sourceSlotID = test;
			ref.startTime = TAPE_MOB_OFFSET_ARR[test];
			IAAFDataDefSP pDDef;
			checkResult(pDictionary->LookupDataDef(*slotDDefs[test], &pDDef));
			checkResult(pSrcMob->AppendPhysSourceRef (slotRates[test],
				test,
				pDDef,
				ref,
				TAPE_MOB_LENGTH_ARR[test]));
			
			// Create a concrete subclass of EssenceDescriptor
			checkResult(defs.cdAIFCDescriptor()->
				CreateInstance(IID_IAAFEssenceDescriptor, 
				(IUnknown **)&pDesc));	

			IAAFAIFCDescriptor*			pAIFCDesc = NULL;
			checkResult(pDesc->QueryInterface (IID_IAAFAIFCDescriptor, (void **)&pAIFCDesc));
			checkResult(pAIFCDesc->SetSummary (5, (unsigned char*)"TEST"));
			pAIFCDesc->Release();
			pAIFCDesc = NULL;

			checkResult(pSrcMob->SetEssenceDescriptor(pDesc));
			pDesc->Release();
			pDesc = NULL;
			
			// Append source MOB to header
			checkResult(pSrcMob->QueryInterface(IID_IAAFMob, (void **) &pTempMob));
			checkResult(pTempMob->SetMobID(TEST_Source_MobIDs[test]));
			checkResult(pTempMob->SetName(L"source mob"));
			
			checkResult(pHeader->AddMob(pTempMob));
			pTempMob->Release();
			pTempMob = NULL;
			
			IAAFDataDefSP pDataDef;
			checkResult (pDictionary->LookupDataDef (*slotDDefs[test], &pDataDef));
			checkResult(pMasterMob->AddMasterSlot(pDataDef, test, pSrcMob, test+1, slotNames[test]));
			
			pSrcMob->Release();
			pSrcMob = NULL;
		}
		
		// Add the master mob to the file and cleanup
		checkResult(pHeader->AddMob(pMob));
	}
	catch (HRESULT& rResult)
	{
		hr = rResult;
	}
	
	
	// Cleanup and return
	if (pTempMob)
		pTempMob->Release();
	
	if (pEssDesc)
		pEssDesc->Release();
	
	if (pTapeDesc)
		pTapeDesc->Release();
	
	
	if (pDesc)
		pDesc->Release();
	
	if (pSrcMob)
		pSrcMob->Release();
	
	if (pTapeMob)
		pTapeMob->Release();
	
	if (pMasterMob)
		pMasterMob->Release();
	
	if (pMob)
		pMob->Release();
	
	if (pDictionary)
		pDictionary->Release();
	
	if (pHeader)
		pHeader->Release();
	
	if (pFile)
	{  // Close file
		if (bFileOpen)
		{
			pFile->Save();
			pFile->Close();
		}
		pFile->Release();
	}
	
	return hr;
}
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CAAFFindSourceInfoTest.cpp

示例7: CreateAAFFile


//.........这里部分代码省略.........
			check(pEssenceAccess->WriteSamples(	samplesToWrite,	// Number of Samples
												sizeof(dataBuff), // buffer size
												dataPtr,	// THE data
												&samplesWritten,
												&bytesWritten));
			samplesLeft = samplesLeft-samplesToWrite;
			if (samplesLeft <= 0)
				break;
			
			aafUInt32 bytesToWrite = fread(dataBuff, sizeof(unsigned char), sizeof(dataBuff), pWavFile);
			samplesToWrite = bytesToWrite/bytesPerSample;
			dataPtr = dataBuff;
		}

		// Close the essence data file
		fclose(pWavFile);

		/* Set the essence to indicate that you have finished writing the samples */
		check(pEssenceAccess->CompleteWrite());

    pEssenceAccess->Release();
    pEssenceAccess = NULL;
	}
	else
	{
		printf("***Failed to open Wave file Laser.wav\n");
	}

	/* Release COM interfaces */

	pMob->Release();
	pMob = NULL;
	pMasterMob->Release();
	pMasterMob = NULL;

  pSoundDef->Release();
  pSoundDef = NULL;
  pNetworkLocatorDef->Release();
  pNetworkLocatorDef = NULL;
  pMasterMobDef->Release();
  pMasterMobDef = NULL;

	pDictionary->Release();
	pDictionary = NULL;
	pHeader->Release();
	pHeader = NULL;
	
	/* Save the AAF file */
	pFile->Save();
	
	/* Close the AAF file */
	pFile->Close();
	pFile->Release();
	pFile = NULL;


cleanup:
	// Cleanup and return
	if(pFormat)
		pFormat->Release();

	if(format)
		format->Release();

	if(pLocator)
		pLocator->Release();

  if (pEssenceAccess)
		pEssenceAccess->Release();
	
	if (pMasterMob)
		pMasterMob->Release();

	if (pMob)
		pMob->Release();

  if (pSoundDef)
    pSoundDef->Release();

  if (pNetworkLocatorDef)
    pNetworkLocatorDef->Release();

  if (pMasterMobDef)
    pMasterMobDef->Release();

	if (pDictionary)
		pDictionary->Release();

	if (pHeader)
		pHeader->Release();

	if (pFile)
  {
    pFile->Close();
		pFile->Release();
  }


	return moduleErrorTmp;
}
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:ExportAudioExample.cpp

示例8: CreateAAFFile


//.........这里部分代码省略.........
	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();

	if (pEssDesc)
		pEssDesc->Release();

	if (pMob)
		pMob->Release();

	if (pSourceMob)
		pSourceMob->Release();

	if (pHeader)
		pHeader->Release();

	if (pFile)
	{
		pFile->Save();
		pFile->Close();
		pFile->Release();
	}

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

示例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;
	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;
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CAAFBWFImportDescriptorTest.cpp

示例10: ModifyAAFFile


//.........这里部分代码省略.........
		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();
			cout << "ModifyAAFFile() - added EssenceData" << endl;


			pSourceMob->Release();
		}
		pFileMob->Release();
		pFileMobIter->Release();

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

		// Save & close the file
		checkResult(pFile->Save());
		checkResult(pFile->Close());
		checkResult(pFile->Release());
	}
	catch (HRESULT& rResult)
	{
		hr = rResult;
		cout << "*** ModifyAAFFile: caught error hr=0x" << hex << hr << dec << endl;
	}

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

示例11: TestPropertyValue


//.........这里部分代码省略.........

  CAAFBuiltinDefs defs (pDict);

  // Let's try to do something interesting with a type definition
  IAAFTypeDefInt * pTypeDef = NULL;
  hr = defs.tdInt32()->QueryInterface (IID_IAAFTypeDefInt, (void **) &pTypeDef);
  if (! SUCCEEDED (hr)) return hr;
  assert (pTypeDef);

  if(mode == kAAFUnitTestReadWrite)
	{
		  // Now attempt to create invalid property values; check for errors.
	  const aafInt32 forty_two = 42;
	  IAAFPropertyValue * pv = NULL;
	  // This is what a correct one would look like; we're not ready for that yet:
	  // hr = pTypeDef->CreateValue (&forty_two, 4, &pv);

	  // set this to -1 to see if it gets modified
	  pv = (IAAFPropertyValue *) (-1);

	  // Try null pVal
	  hr = pTypeDef->CreateValue (NULL, 4, &pv);
	  if (AAFRESULT_NULL_PARAM != hr)
		return AAFRESULT_TEST_FAILED;
	  if ((IAAFPropertyValue *)(-1) != pv)
		return AAFRESULT_TEST_FAILED;

	  // Try valSize too large
	  hr = pTypeDef->CreateValue ((aafMemPtr_t) &forty_two, 8, &pv);
	  if (AAFRESULT_BAD_SIZE != hr)
		return AAFRESULT_TEST_FAILED;
	  if ((IAAFPropertyValue *)(-1) != pv)
		return AAFRESULT_TEST_FAILED;

	  // Now try correct one
	  pv = NULL;
	  hr = pTypeDef->CreateValue ((aafMemPtr_t) &forty_two, 4, &pv);
	  if (! SUCCEEDED (hr)) return hr;
	  if (! pv)
		return AAFRESULT_TEST_FAILED;

	  // That one worked; let's try one with a smaller init size (should
	  // also work)
	  pv->Release();
	  pv = NULL;
	  const aafInt16 fifty_seven = 57;
	  hr = pTypeDef->CreateValue ((aafMemPtr_t) &fifty_seven, 2, &pv);
	  if (! SUCCEEDED (hr)) return hr;
	  if (! pv)
		return AAFRESULT_TEST_FAILED;

	  // cool.  Now we should have a good property value whose value is 57.
	  // check GetType() for error condition
	  hr = pv->GetType (NULL);
	  if (AAFRESULT_NULL_PARAM != hr)
		return AAFRESULT_TEST_FAILED;

	  // this GetType() call should work, and return the original type def.
	  IAAFTypeDef * propType = NULL;
	  hr = pv->GetType (&propType);
	  if (! SUCCEEDED (hr)) return hr;
	  if (! propType)
		return AAFRESULT_TEST_FAILED;

	  // Convert both to IUnknown for comparison
	  IUnknown * pPropUnknown = NULL;
	  IUnknown * pTypeDefUnknown = NULL;
	  hr = propType->QueryInterface(IID_IUnknown, (void **)&pPropUnknown);
	  if (! SUCCEEDED (hr)) return hr;
	  assert (pPropUnknown);
	  hr = pTypeDef->QueryInterface(IID_IUnknown, (void **)&pTypeDefUnknown);
	  if (! SUCCEEDED (hr)) return hr;
	  assert (pTypeDefUnknown);

	  if (pPropUnknown != pTypeDefUnknown)
		return AAFRESULT_TEST_FAILED;
	  // Test IsDefinedType ()
	  // (Currently only returns true.)
	  aafBool b = kAAFFalse;
	  hr = pv->IsDefinedType (&b);
		if (! SUCCEEDED (hr)) return hr;
	  if (kAAFTrue != b)
		return AAFRESULT_TEST_FAILED;

	  pTypeDefUnknown->Release();
	  pPropUnknown->Release();
	  pTypeDef->Release();
	  propType->Release();
	  pv->Release();
	  pDict->Release();
	  pHeader->Release();
	  hr = pFile->Save();
	}
  if (! SUCCEEDED (hr)) return hr;
  hr = pFile->Close();
  if (! SUCCEEDED (hr)) return hr;
  pFile->Release();

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

示例12: CreateAAFFile


//.........这里部分代码省略.........
									   PRODUCT_NAME,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_SUCCESS);

		TestMethod(pTestIdent->GetRefImplVersion(NULL), AAFRESULT_NULL_PARAM);
		TestMethod(pTestIdent->GetRefImplVersion(&refImplVersion), AAFRESULT_SUCCESS);
		
		pTestIdent->Release();
		PrintTestResult(testName);


	/* GetDate *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetDate()");
		aafTimeStamp_t timeStamp;
		aafTimeStamp_t startTimeStamp;
		checkResult(defs.cdIdentification()->
					CreateInstance(IID_IAAFIdentification, 
								   (IUnknown **)&pTestIdent));	
		TestMethod(pTestIdent->GetDate(&timeStamp), AAFRESULT_NOT_INITIALIZED);

		GetDateTime (&startTimeStamp);
		TestMethod(pTestIdent->Initialize(COMPANY_NAME,
									   PRODUCT_NAME,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_SUCCESS);

		TestMethod(pTestIdent->GetDate(NULL), AAFRESULT_NULL_PARAM);
		TestMethod(pTestIdent->GetDate(&timeStamp), AAFRESULT_SUCCESS);

		if (timeStamp.date.year != startTimeStamp.date.year ||
			timeStamp.date.month != startTimeStamp.date.month ||
			timeStamp.date.day != startTimeStamp.date.day)
			localhr = AAFRESULT_TEST_FAILED;

		if (timeStamp.time.hour != startTimeStamp.time.hour ||
			timeStamp.time.minute != startTimeStamp.time.minute ||
			timeStamp.time.second != startTimeStamp.time.second)
			localhr = AAFRESULT_TEST_FAILED;

		pTestIdent->Release();
		PrintTestResult(testName);


	/* GetGeneration *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetGeneration()");
		aafUID_t generation;
		checkResult(defs.cdIdentification()->
					CreateInstance(IID_IAAFIdentification, 
								   (IUnknown **)&pTestIdent));	
		TestMethod(pTestIdent->GetGenerationID(&generation), AAFRESULT_NOT_INITIALIZED);

		TestMethod(pTestIdent->Initialize(COMPANY_NAME,
									   PRODUCT_NAME,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_SUCCESS);

		TestMethod(pIdent->GetGenerationID(NULL), AAFRESULT_NULL_PARAM);
		TestMethod(pIdent->GetGenerationID(&generation), AAFRESULT_SUCCESS);
		
		pTestIdent->Release();
		PrintTestResult(testName);

		
		// Attempt to save the file.
		checkResult(pFile->Save());
		
		// Attempt to close the file.
		checkResult(pFile->Close());
		bFileOpen = false;
	}
	catch (HRESULT& rResult)
	{
		hr = rResult;
	}
	
	
	// Cleanup and return
	if (pIdent)
		pIdent->Release();
	
	if (pHeader)
		pHeader->Release();
	
	if (pDictionary)
		pDictionary->Release();

	if (pFile)
	{	// Close file
		if (bFileOpen)
		{
			pFile->Save();
			pFile->Close();
		}
		pFile->Release();
	}
	
	return hr;
}
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CAAFIdentificationTest.cpp

示例13: TestTypeDefInt


//.........这里部分代码省略.........

				  pvSize = sizeTable[pvIndex];

				  if ((1 == pvSize) ||
					  (2 == pvSize) ||
					  (4 == pvSize) ||
					  (8 == pvSize))
					{
					  td = typeDefTable[pvIndex][sign];
					}
				  else
					continue;	// skip rest of the loop

				  aafInt64 setData = negVal ? -(aafInt32)setSize : setSize;

				  hr = TestOneValue (setSize,
									 setData,
									 getSize,
									 pvSize,
									 sign? kAAFTrue : kAAFFalse,
									 td);

				  //
				  // first test for expected failures
				  //
				  if ((setSize != 1) &&
					  (setSize != 2) &&
					  (setSize != 4) &&
					  (setSize != 8))
					{
					  if (AAFRESULT_BAD_SIZE != hr)
						throw AAFRESULT_TEST_FAILED;
					}

				  else if ((getSize != 1) &&
					  (getSize != 2) &&
					  (getSize != 4) &&
					  (getSize != 8))
					{
					  if (AAFRESULT_BAD_SIZE != hr)
						throw AAFRESULT_TEST_FAILED;
					}

				  else if ((setSize > pvSize) ||
					  (pvSize > getSize))
					{
					  if (AAFRESULT_BAD_SIZE != hr)
						throw AAFRESULT_TEST_FAILED;
					}

				  else
					{
					  // if we're here, it should pass.
					  checkResult (hr);
					}
				}
	}
  catch (HRESULT & rResult)
	{
	  caughtHr = rResult;
	}

  if (ptds8)
    ptds8->Release();
  if (ptds16)
    ptds16->Release();
  if (ptds32)
    ptds32->Release();
  if (ptds64)
    ptds64->Release();
  if (ptdu8)
    ptdu8->Release();
  if (ptdu16)
    ptdu16->Release();
  if (ptdu32)
  	ptdu32->Release();
  if (ptdu64)
  	ptdu64->Release();
  if (pDict)
    pDict->Release();
  if (pHeader)
  	pHeader->Release();
  if (pFile)
  {
  	if(mode == kAAFUnitTestReadWrite)
	{
		hr = pFile->Save();
		if (! SUCCEEDED (hr))
		{  
	  	pFile->Release();
	  	return hr;
	  	}
	}
	hr = pFile->Close();
	pFile->Release();
  }

  
  return (caughtHr != AAFRESULT_SUCCESS) ? caughtHr : hr;
}
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CAAFTypeDefIntTest.cpp

示例14: CreateAAFFile

static HRESULT CreateAAFFile(
    aafWChar * pFileName,
    aafUID_constref fileKind,
    testRawStorageType_t rawStorageType,
    aafProductIdentification_constref productID)
{
	IAAFFile*		pFile = NULL;
	IAAFHeader *        pHeader = NULL;
	IAAFDictionary*  pDictionary = NULL;
	IAAFContainerDef*	pContainerDef = NULL;
	bool bFileOpen = false;
	aafUID_t		uid = testUID;
	HRESULT			hr = S_OK;
/*	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.cdContainerDef()->
					CreateInstance(IID_IAAFContainerDef, 
								   (IUnknown **)&pContainerDef));
    
		checkResult(pContainerDef->Initialize(uid, L"Test Container", L"Test Container Definition"));

		checkResult(pContainerDef->SetEssenceIsIdentified (kAAFTrue));

		checkResult(pDictionary->RegisterContainerDef(pContainerDef));
	}
	catch (HRESULT& rResult)
	{
		hr = rResult;
	}


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

  if (pDictionary)
    pDictionary->Release();

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

  return hr;
}
开发者ID:UIKit0,项目名称:aaf,代码行数:71,代码来源:CAAFContainerDefTest.cpp

示例15: ProcessAAFFile


//.........这里部分代码省略.........

          pDataDef->Release();
          pDataDef = NULL;
				}	
        
        pMobSlot->Release();
        pMobSlot = NULL;
			}

      pMobSlotIter->Release();
      pMobSlotIter = NULL;
		  pMob->Release();
		  pMob = NULL;
		}
		

    pAudioSequence->Release();
    pAudioSequence = NULL;

    pCompMob->Release();
    pCompMob = NULL;

		pMobIter->Release();
		pMobIter = NULL;
	}
	else
	{
		printf("Error with file: File has no Master mobs.\n");
	}

cleanup:
	// Cleanup and return
  if (pSourceClip)
    pSourceClip->Release();

  if (pComponent)
    pComponent->Release();

  if (pSegment)
    pSegment->Release();

  if (pTimelineMobSlot)
    pTimelineMobSlot->Release();

  if (pMobSlotIter)
    pMobSlotIter->Release();

  if (pMob)
    pMob->Release();

  if (newSlot)
    newSlot->Release();

  if (aComponent)
    aComponent->Release();

  if (seg)
    seg->Release();

  if (pAudioSequence)
    pAudioSequence->Release();

  if (pCompMob)
    pCompMob->Release();

  if (pMobIter)
		pMobIter->Release();

  if (pDataDef)
    pDataDef->Release();

  if (pSoundDef)
    pSoundDef->Release();

  if (pSourceClipDef)
    pSourceClipDef->Release();

  if (pSequenceDef)
    pSequenceDef->Release();

  if (pCompositionMobDef)
    pCompositionMobDef->Release();

	if (pDictionary)
		pDictionary->Release();

	if (pHeader)
		pHeader->Release();

	if (pFile) 
	{
	  /* Save the AAF file */
    pFile->Save();
	  /* Close the AAF file */
		pFile->Close();
		pFile->Release();
	}

	return moduleErrorTmp;
}
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:ExportSimpleComposition.cpp


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