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


C++ IAAFFile类代码示例

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


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

示例1: ReadAAFFile

// now need the reading functionality
static HRESULT ReadAAFFile(aafWChar * pFileName)
{
  IAAFFile * pFile = NULL;
  // printing file open time

  clock_t start = clock();
  clock_t finish;
  double duration;

  check(AAFFileOpenExistingRead ( pFileName, 0, &pFile));

  finish = clock();
  duration = ((double) (finish - start) / CLOCKS_PER_SEC);

  pFile->Close();
  pFile->Release();
  pFile=NULL;

#if 0
  printf("Open time = %f seconds\n", duration);
#endif

cleanup:
  if (pFile) {
    pFile->Close();
    pFile->Release();
  }
  return AAFRESULT_SUCCESS;
}
开发者ID:mcanthony,项目名称:aaf,代码行数:30,代码来源:CreateSequence.cpp

示例2: ReadAAFFile

static HRESULT  ReadAAFFile(aafWChar *  pFileName )
{
	HRESULT hr = AAFRESULT_SUCCESS;
	
	IAAFFile* pFile = NULL;
	IAAFHeader * pHeader = NULL;
	IAAFDictionary * pDict = NULL;
	aafBoolean_t  bFileOpen = kAAFFalse;
	
	try
	{
		// Open the file
		checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
		bFileOpen = kAAFTrue;
		
		checkResult (pFile->GetHeader (&pHeader));
		assert (pHeader);
		checkResult (pHeader->GetDictionary (&pDict));
		assert (pDict);
		
		// Read the mob, slots, etc  to verify the contents ...
		checkResult(verifyContents (pHeader, pDict, kAAFFalse));  //False => NOT minimal testing; i.e. test everything 
		
		
	}//try
	catch (HRESULT & rResult)
	{
		hr = rResult;
	}
	
	if (pDict) pDict->Release();
	if (pHeader) pHeader->Release();
	
	if (bFileOpen && pFile)
	{
		stopGap(pFile->Close());
		pFile->Release();
	}
	
	return hr;
	
}//ReadAAFFile()
开发者ID:mcanthony,项目名称:aaf,代码行数:42,代码来源:CAAFTypeDefCharacterTest.cpp

示例3: main

extern int main(int argc, char *argv[])
{
	if (argc < 2)
	{
		printUsage(argv[0]);
		return 1;
	}

	aafWChar Filename[FILENAME_MAX];
	size_t status = mbstowcs(Filename, argv[1], sizeof(Filename));
	if (status == (size_t)-1) {
		fprintf(stderr, "mbstowcs failed for \"%s\"\n", argv[1]);
		return 1;
	}

	IAAFFile *pFile = NULL;
	int mode = 0;
	HRESULT res_open;

	// Perform the simplest possible use of the AAF SDK to open an
	// existing AAF file. This is enough to cause a memory leak in
	// AAF SDK v1.1.2 and up to at least CVS snapshot 2008-05-12.

	res_open = AAFFileOpenExistingRead(Filename, mode, &pFile);
	if (AAFRESULT_FAILED(res_open))
	{
		aafCharacter buf[100] = L"";
		AAFResultToText(res_open, buf, sizeof(buf));
		fprintf(stderr, "AAFFileOpenExistingRead() failed, result=0x%08x %ls\n", res_open, buf);
		return 1;
	}

	pFile->Close();
	pFile->Release();

	return 0;
}
开发者ID:UIKit0,项目名称:aaf,代码行数:37,代码来源:MemoryLeakTest.cpp

示例4: ReadAAFFile

static HRESULT ReadAAFFile(aafWChar * pFileName)
{
	IAAFFile *					pFile = NULL;
	bool bFileOpen = false;
	IAAFHeader *				pHeader = NULL;
	HRESULT						hr = S_OK;

  try
  {
    // Open the file
    checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
	  bFileOpen = true;

    // We can't really do anthing in AAF without the header.
  	checkResult(pFile->GetHeader(&pHeader));

  }
  catch (HRESULT& rResult)
  {
    hr = rResult;
  }


	// Cleanup and return
  if (pHeader)
		pHeader->Release();
			
	if (pFile)
	{	// Close file
		if (bFileOpen)
			pFile->Close();
 		pFile->Release();
	}

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

示例5: 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;
	IAAFCompositionMob * pCMob = NULL;
	IAAFMob * pMob = NULL;
	IAAFObject * pObj = 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);
		
		//Create a composition ...
		checkResult (defs.cdCompositionMob()->
			CreateInstance (IID_IAAFCompositionMob,
			(IUnknown **) &pCMob));
		assert (pCMob);
		checkResult (pCMob->Initialize (TEST_NAME));
		
		//... Get its mob, and add it to the header info
		checkResult (pCMob->QueryInterface (IID_IAAFMob,
										  (void **) &pMob));
		assert (pMob);
		checkResult (pHeader->AddMob (pMob));
		
	}
	catch (HRESULT & rResult)
	{
		hr = rResult;
	}
	
	if (pCMob) pCMob->Release();
	if (pMob) pCMob->Release();
	if (pObj) pObj->Release();
	if (pDict) pDict->Release();
	if (pHeader) pHeader->Release();
	if (pFile)
	{
		AAFRESULT temphr = pFile->Save();
		if (! SUCCEEDED (temphr)) return temphr;
		temphr = pFile->Close();
		if (! SUCCEEDED (temphr)) return temphr;
		pFile->Release();
	}
	
	return hr;
}
开发者ID:mcanthony,项目名称:aaf,代码行数:62,代码来源:CAAFPropertyTest.cpp

示例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;
	IAAFCompositionMob*			pCompMob=NULL;
	IAAFMob*					pMob = NULL;
	IAAFTimelineMobSlot*		pNewSlot = NULL;
	IAAFSourceClip*				pSourceClip = NULL;
	IAAFSourceReference*		pSourceRef = NULL;
	IAAFTransition*				pTransition = NULL;
	IAAFOperationGroup*			pOperationGroup = NULL;
	IAAFSegment*				pSegment = NULL;
	IAAFSegment*				pEffectFiller = NULL;
	IAAFComponent*				pComponent = NULL;
	IAAFFiller*					pFiller = NULL;
	IAAFSequence*				pSequence = NULL;
	IAAFOperationDef*				pOperationDef = NULL;
	IAAFParameter				*pParm = NULL;
	IAAFParameterDef*			pParamDef = NULL;
	IAAFConstantValue*			pConstantValue = NULL;
	
	HRESULT						hr = S_OK;
	aafLength_t					transitionLength;
	aafPosition_t				cutPoint = 0;
	aafLength_t					effectLen = TEST_EFFECT_LEN;
	aafUID_t					effectID = kTestEffectID;
	aafUID_t					parmID = kTestParmID;

	transitionLength = 100;

	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);
 		
		// Create the effect and parameter definitions
		checkResult(defs.cdOperationDef()->
					CreateInstance(IID_IAAFOperationDef, 
								   (IUnknown **)&pOperationDef));
    
		checkResult(defs.cdParameterDef()->
					CreateInstance(IID_IAAFParameterDef, 
								   (IUnknown **)&pParamDef));

		checkResult(pOperationDef->Initialize (effectID, TEST_EFFECT_NAME, TEST_EFFECT_DESC));
		checkResult(pDictionary->RegisterOperationDef(pOperationDef));
		checkResult(pParamDef->Initialize (parmID, TEST_PARAM_NAME, TEST_PARAM_DESC, defs.tdRational ()));
		checkResult(pParamDef->SetDisplayUnits(TEST_PARAM_UNITS));
		checkResult(pDictionary->RegisterParameterDef(pParamDef));


		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));


		// ------------------------------------------------------------
		//	To test a Transition we need to create a Sequence which will 
		//	a Filler, a transition and another Filler. I know this is not 
		//  very interesting, but it will let us test the Transition 
		//  interface with the least amount of other stuff.
		// ------------------------------------------------------------
		//
		// Create a CompositionMob
		checkResult(defs.cdCompositionMob()->
					CreateInstance(IID_IAAFCompositionMob, 
								   (IUnknown **)&pCompMob));

		checkResult(pCompMob->Initialize(L"Transition Test"));
		// Get a MOB interface
		checkResult(pCompMob->QueryInterface (IID_IAAFMob, (void **)&pMob));
		checkResult(pMob->SetMobID(TEST_MobID));

		// Create a Sequence
		checkResult(defs.cdSequence()->
					CreateInstance(IID_IAAFSequence,
								   (IUnknown **) &pSequence));

		// Get a Segment interface
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:aaf,代码行数:101,代码来源:CAAFTransitionTest.cpp

示例7: ReadAAFFile

static HRESULT ReadAAFFile(aafWChar* pFileName)
{
	IAAFFile*			pFile = NULL;
	IAAFHeader*			pHeader = NULL;
	IAAFDictionary*		pDictionary = NULL;
	IEnumAAFContainerDefs *pPlug = NULL;
	IAAFDefObject*		pDef = NULL;
	IAAFContainerDef*	pContainerDef = NULL;
	bool				bFileOpen = false;
	HRESULT				hr = S_OK;
	aafUID_t			readUID;
	wchar_t				testString[256];

	try
	{
		// Open the AAF file
		checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
		bFileOpen = true;

		// Get the AAF file header.
		checkResult(pFile->GetHeader(&pHeader));

		checkResult(pHeader->GetDictionary(&pDictionary));
	
		checkResult(pDictionary->GetContainerDefs(&pPlug));
		while(pPlug->NextOne (&pContainerDef) == AAFRESULT_SUCCESS)
		{
			checkResult(pContainerDef->QueryInterface (IID_IAAFDefObject, (void **)&pDef));
			checkResult(pDef->GetAUID(&readUID));
			if(memcmp(&readUID, &testUID, sizeof(aafUID_t)) == 0)
			{
				checkResult(pDef->GetName (testString, sizeof(testString)));
				checkExpression (wcscmp(testString, sName) == 0, AAFRESULT_TEST_FAILED);

				aafUInt32 nameLen;
				checkResult (pDef->GetNameBufLen (&nameLen));
				checkExpression (((wcslen (sName)+1) * sizeof (aafCharacter) == nameLen),
						 AAFRESULT_TEST_FAILED);

				checkResult(pDef->GetDescription (testString, sizeof(testString)));
				checkExpression (wcscmp(testString, sDescription) == 0, AAFRESULT_TEST_FAILED);

				checkResult (pDef->GetDescriptionBufLen (&nameLen));
				checkExpression (((wcslen (sDescription)+1) * sizeof (aafCharacter) == nameLen),
						 AAFRESULT_TEST_FAILED);

				break;
			}

                        pDef->Release();
                        pDef = NULL;
                        pContainerDef->Release();
                        pContainerDef = NULL;

		}//		checkResult(pPlug->NextOne(&pContainerDef));


	}
	catch (HRESULT& rResult)
	{
		hr = rResult;
	}

	// Cleanup and return
	if (pHeader)
		pHeader->Release();
      
	if (pPlug)
		pPlug->Release();

	if (pDef)
		pDef->Release();
      
	if (pContainerDef)
		pContainerDef->Release();
            
	if (pDictionary)
		pDictionary->Release();
            
	if (pFile)
	{  // Close file
		if (bFileOpen)
			pFile->Close();
		pFile->Release();
	}

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

示例8: ReadAAFFile

static HRESULT ReadAAFFile(const aafWChar * pFileName, testType_t testType)
{
  IAAFFile *					pFile = NULL;
  IAAFHeader *				pHeader = NULL;
  IAAFDictionary*					pDictionary = NULL;
  IAAFEssenceAccess*			pEssenceAccess = NULL;
  IAAFEssenceMultiAccess*		pMultiEssence = NULL;
  IAAFEssenceFormat			*fmtTemplate =  NULL;
  IEnumAAFMobs*				pMobIter = NULL;
  IAAFMob*					pMob = NULL;
  IAAFMasterMob*				pMasterMob = NULL;
  IAAFEssenceFormat*			pFormat = NULL;

  aafNumSlots_t				numMobs, numSlots;
  aafSearchCrit_t				criteria;
  aafRational_t				readSampleRate;
  aafMobID_t					mobID;
  aafWChar					namebuf[1204];
  unsigned char				AAFDataBuf[4096];
  aafUInt32					AAFBytesRead, samplesRead;
  FILE*						pWavFile = NULL;
  unsigned char				WAVDataBuf[4096], *dataPtr;
  size_t						WAVBytesRead;
  aafUInt32					dataOffset, dataLen;
  aafUInt16					bitsPerSample, numCh;

  check(AAFFileOpenExistingRead ( pFileName, 0, &pFile));
  check(pFile->GetHeader(&pHeader));

  // Get the AAF Dictionary so that we can create valid AAF objects.
  check(pHeader->GetDictionary(&pDictionary));


  // Here we check on the number of mobs in the file. 
  // Get the number of master mobs in the file (should be one)
  check(pHeader->CountMobs(kAAFMasterMob, &numMobs));
  // ** causes leak

  if (1 == numMobs )
    {
      printf("Found %d Master Mobs\n", numMobs);
      criteria.searchTag = kAAFByMobKind;
      criteria.tags.mobKind = kAAFMasterMob;
      check(pHeader->GetMobs(&criteria, &pMobIter));
      while(AAFRESULT_SUCCESS == pMobIter->NextOne(&pMob))
	{
	  char mobIDstr[256];
	  char mobName[256];


	  check(pMob->GetMobID (&mobID));
	  check(pMob->GetName (namebuf, sizeof(namebuf)));
	  convert(mobName, sizeof(mobName), namebuf);
	  MobIDtoString(mobID, mobIDstr);
	  printf("    MasterMob Name = '%s'\n", mobName);
	  printf("        (mobID %s)\n", mobIDstr);
	  // Make sure we have two slots 
	  check(pMob->CountSlots(&numSlots));
	  if (2 == numSlots)
	    {
				// The essence data is in SlotID 1
				// Get a Master Mob interface
	      check(pMob->QueryInterface(IID_IAAFMasterMob, (void **)&pMasterMob));

				// Open the Essence Data
	      check(pMasterMob->OpenEssence(	1,     // SlotID 1
						NULL,  // mediaCriteria (Don't care)
						kAAFMediaOpenReadOnly,	// Open mode
						kAAFCompressionDisable,// Compress disabled
						&pEssenceAccess));

				// Open and read the Wave file (for comparison)
	      pWavFile = fopen("Laser.wav", "r");
	      if (pWavFile)
		{
		  // read in the essence data
		  WAVBytesRead = fread(WAVDataBuf, sizeof(unsigned char), sizeof(WAVDataBuf), pWavFile);
		  fclose(pWavFile);
		  pWavFile = NULL;
		  check(loadWAVEHeader(WAVDataBuf,
				       &bitsPerSample,
				       &numCh,
				       &readSampleRate,
				       &dataOffset,
				       &dataLen));
		  dataPtr = WAVDataBuf + dataOffset;

		  aafUInt32			sampleBits;
		  aafInt32			bytesRead;
					
		  check(pEssenceAccess->GetEmptyFileFormat (&fmtTemplate));
		  check(fmtTemplate->AddFormatSpecifier (kAAFAudioSampleBits, 0, NULL));
		  check(pEssenceAccess->GetFileFormat (fmtTemplate, &pFormat));
		  fmtTemplate->Release();
		  fmtTemplate = NULL;
					
		  check(pFormat->GetFormatSpecifier (kAAFAudioSampleBits, sizeof(sampleBits),
						     (aafDataBuffer_t)&sampleBits, &bytesRead));
		  pFormat->Release();
		  pFormat = NULL;
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:aaf,代码行数:101,代码来源:MetadataExample.cpp

示例9: CAAFCachePageAllocator_test

HRESULT CAAFCachePageAllocator_test(testMode_t /* mode */,
    aafUID_t fileKind,
    testRawStorageType_t /* rawStorageType */,
    aafProductIdentification_t productID)
{
  const size_t fileNameBufLen = 128;
  aafWChar pFileName[ fileNameBufLen ] = L"";
  GenerateTestFileName( productID.productName, fileKind, fileNameBufLen, pFileName );

  (void)RemoveTestFile(pFileName );

  IAAFRawStorage* pRawStorage = 0;
  HRESULT hr = AAFCreateRawStorageDisk(pFileName,
                                       kAAFFileExistence_new,
                                       kAAFFileAccess_modify,
                                       &pRawStorage);
  if (!AAFRESULT_SUCCEEDED(hr)) return hr;

  IAAFCachePageAllocator* pAllocator = 0;
  hr = TestCachePageAllocator::Create(&pAllocator);
  if (!AAFRESULT_SUCCEEDED(hr)) {
    pRawStorage->Release();
    pRawStorage = 0;
    return hr;
  }

  IAAFRawStorage* pCachedRawStorage = 0;
  hr = AAFCreateRawStorageCached2(pRawStorage,
                                  16,
                                  4096,
                                  pAllocator,
                                  &pCachedRawStorage);
  if (!AAFRESULT_SUCCEEDED(hr)) {
    pRawStorage->Release();
    pRawStorage = 0;
    pAllocator->Release();
    pAllocator = 0;
    return hr;
  }
  aafUID_t encoding = EffectiveTestFileEncoding(fileKind);
  IAAFFile* pFile = 0;
  hr = AAFCreateAAFFileOnRawStorage(pCachedRawStorage,
                                    kAAFFileExistence_new,
                                    kAAFFileAccess_modify,
                                    &encoding,
                                    0,
                                    &productID,
                                    &pFile);
  if (!AAFRESULT_SUCCEEDED(hr)) {
    pRawStorage->Release();
    pRawStorage = 0;
    pAllocator->Release();
    pAllocator = 0;
    pCachedRawStorage->Release();
    pCachedRawStorage = 0;
    return hr;
  }
  hr = pFile->Open();
  if (!AAFRESULT_SUCCEEDED(hr)) {
    pRawStorage->Release();
    pRawStorage = 0;
    pAllocator->Release();
    pAllocator = 0;
    pCachedRawStorage->Release();
    pCachedRawStorage = 0;
    pFile->Release();
    pFile = 0;
    return hr;
  }

  hr = pFile->Save();
  if (!AAFRESULT_SUCCEEDED(hr)) return hr;
  hr = pFile->Close();
  if (!AAFRESULT_SUCCEEDED(hr)) return hr;
  pRawStorage->Release();
  pRawStorage = 0;
  pAllocator->Release();
  pAllocator = 0;
  pCachedRawStorage->Release();
  pCachedRawStorage = 0;
  pFile->Release();
  pFile = 0;
  return hr;
}
开发者ID:mcanthony,项目名称:aaf,代码行数:84,代码来源:CAAFCachePageAllocatorTest.cpp

示例10: ReadAAFFile

static HRESULT ReadAAFFile(aafWChar * pFileName)
{
	// IAAFSession *				pSession = NULL;
	IAAFFile *					pFile = NULL;
	IAAFHeader *				pHeader = NULL;
	IEnumAAFMobs*				pMobIter = NULL;
	IAAFMob*					pMob = NULL;
	IAAFMob*					pReferencedMob = NULL;
	IEnumAAFMobSlots*			pSlotIter = NULL;
	IAAFMobSlot*				pSlot = NULL;
	IAAFSegment*				pSegment = NULL;
	IAAFSourceClip*				pSourceClip = NULL;
	bool bFileOpen = false;
	aafSearchCrit_t				criteria;
	aafNumSlots_t				numMobs, numSlots;
	HRESULT						hr = AAFRESULT_SUCCESS;

	try
	{ 
    // Open the file
		checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
		bFileOpen = true;
 
    // We can't really do anthing in AAF without the header.
		checkResult(pFile->GetHeader(&pHeader));

		// Get the number of mobs in the file (should be one)
		checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
		checkExpression(2 == numMobs, AAFRESULT_TEST_FAILED);

		// Enumerate over all Composition Mobs
		criteria.searchTag = kAAFByMobKind;
		criteria.tags.mobKind = kAAFCompMob;
		checkResult(pHeader->GetMobs(&criteria, &pMobIter));
		while (AAFRESULT_SUCCESS == pMobIter->NextOne(&pMob))
		{
			checkResult(pMob->CountSlots(&numSlots));
			checkExpression(1 == numSlots, AAFRESULT_TEST_FAILED);

			checkResult(pMob->GetSlots(&pSlotIter));
			while (AAFRESULT_SUCCESS == pSlotIter->NextOne(&pSlot))
			{
				// The segment should be a source clip...
				checkResult(pSlot->GetSegment(&pSegment));
				pSegment->Release();
				pSegment = NULL;
				pSlot->Release();
				pSlot = NULL;
			}

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

	}
  catch (HRESULT& rResult)
  {
    hr = rResult;
  }

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

	if (pSourceClip)
		pSourceClip->Release();

	if (pSegment)
		pSegment->Release();

	if (pSlot)
		pSlot->Release();

	if (pSlotIter)
		pSlotIter->Release();

	if (pMob)
		pMob->Release();

	if (pMobIter)
		pMobIter->Release();

	if (pHeader)
		pHeader->Release();

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

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

示例11: testRestore

static bool testRestore(const wchar_t* fileName)
{
    bool passed = true;
    
    IAAFFile* pFile = 0;
    IAAFHeader* pHeader = 0;
    IAAFDictionary* pDictionary = 0;
    IAAFContentStorage* pStorage = 0;
    IEnumAAFMobs* pMobs = 0;
    IAAFMob* pMob = 0;
    
    try
    {
        pFile = openFileForReading(fileName);
    }
    catch (...)
    {
        return false;
    }
    
    try
    {
        // get the Mob containing the test data
        checkResult(pFile->GetHeader(&pHeader));
        checkResult(pHeader->GetDictionary(&pDictionary));
        checkResult(pHeader->GetContentStorage(&pStorage));
        aafSearchCrit_t searchCrit;
        searchCrit.searchTag = kAAFByMobKind;
        searchCrit.tags.mobKind = kAAFAllMob;
        checkResult(pStorage->GetMobs(&searchCrit, &pMobs));
        checkResult(pMobs->NextOne(&pMob));
        
        IAAFObject* pObject = 0;
        IAAFClassDef* pClassDef = 0;
        IAAFPropertyDef* pPropertyDef = 0;
        IAAFPropertyValue* pPropertyValue = 0;
        IAAFTypeDef* pType = 0;
        IAAFTypeDefCharacter* pCharacterType = 0;

        // test simple
        try
        {
            printf("    * Simple: ");

            const aafUID_t propId = 
                {0x00000000,0x0000,0x0000,{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
            wchar_t testCharacter = L'A';
            
            checkResult(pMob->QueryInterface(IID_IAAFObject, (void **)&pObject));
            
            checkResult(pDictionary->LookupClassDef(kAAFClassID_Mob, &pClassDef));
            checkResult(pClassDef->LookupPropertyDef(propId, &pPropertyDef));
            
            checkResult(pObject->GetPropertyValue(pPropertyDef, &pPropertyValue));
            checkResult(pPropertyValue->GetType(&pType));
            checkResult(pType->QueryInterface(IID_IAAFTypeDefCharacter, (void **)&pCharacterType));
            
            aafCharacter value;
            checkResult(pCharacterType->GetCharacter(pPropertyValue, &value));

            if (value == testCharacter)
            {
                printf("passed\n");
            }
            else
            {
                printf("FAILED\n");
                passed = false;
            }
        }
        catch (...)
        {
            printf("FAILED\n");
            passed = false;
        }
        release(pCharacterType);
        release(pType);
        release(pPropertyValue);
        release(pPropertyDef);
        release(pClassDef);
        release(pObject);
        
        // test XML escaped
        try
        {
            printf("    * XML escaped: ");

            const aafUID_t propId = 
                {0x10000000,0x0000,0x0000,{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
            wchar_t testCharacter = L'\r';
            
            checkResult(pMob->QueryInterface(IID_IAAFObject, (void **)&pObject));
            
            checkResult(pDictionary->LookupClassDef(kAAFClassID_Mob, &pClassDef));
            checkResult(pClassDef->LookupPropertyDef(propId, &pPropertyDef));
            
            checkResult(pObject->GetPropertyValue(pPropertyDef, &pPropertyValue));
            checkResult(pPropertyValue->GetType(&pType));
            checkResult(pType->QueryInterface(IID_IAAFTypeDefCharacter, (void **)&pCharacterType));
            
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:TestCharacter.cpp

示例12: ReadAAFFile

static HRESULT ReadAAFFile(aafWChar * pFileName)
{
	IAAFFile *					pFile = NULL;
	bool 						bFileOpen = false;
	IAAFHeader *				pHeader = NULL;
	aafNumSlots_t				numMobs, i;
	HRESULT						hr = S_OK;
	HRESULT						localhr = S_OK;
	IEnumAAFMobs 				*mobIter = NULL;
	IEnumAAFMobs 				*cloneMobIter = NULL;
	IAAFMob						*aMob = NULL;
	IAAFMob						**mobArray = NULL;
	aafSearchCrit_t				criteria;
	aafUInt32					numFetched = 0;


  try
  {
    // Open the file
		checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
		bFileOpen = true;
 
    // We can't really do anthing in AAF without the header.
		checkResult(pFile->GetHeader(&pHeader));

	  // Make sure that we have one master, one file, and one composition (three total)
	  checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
	  checkExpression (3 == numMobs, AAFRESULT_TEST_FAILED);

	  
	  criteria.searchTag = kAAFNoSearch;
	  checkResult(pHeader->GetMobs (&criteria, &mobIter));
	  

/* Test the Reset method *******************************/
	if (mobIter->Reset() == AAFRESULT_SUCCESS)
		cout<< "	Reset() ...		Passed" << endl;	
	else	{
		cout<< "	Reset() ...		Failed!!!" << endl;	
		hr = AAFRESULT_TEST_FAILED;
	}


/* Test the NextOne method ******************************/
	
	// Call NextOne once for each mob for a total of numMobs times	
	for (i=0; i<numMobs; i++)	{
		if (mobIter->NextOne(&aMob) == AAFRESULT_SUCCESS)	{
			aMob->Release();
			aMob = NULL;
		}
		else
			localhr = AAFRESULT_TEST_FAILED;
	}

	// Make sure we are at the end
	if (mobIter->NextOne(&aMob) != AAFRESULT_NO_MORE_OBJECTS)
			localhr = AAFRESULT_TEST_FAILED;
	
	mobIter->Reset();
	// this should return AAFRESULT_NULL_PARAM
	if (mobIter->NextOne(NULL) != AAFRESULT_NULL_PARAM)
			localhr = AAFRESULT_TEST_FAILED;

	if (SUCCEEDED(localhr))
		cout<< "	NextOne() ...	Passed" << endl;	
	else	{
		cout<< "	NextOne() ...	Failed!!!" << endl;	
		hr = AAFRESULT_TEST_FAILED;
	}

/* Test the Skip method ******************************/

	localhr = S_OK;
	mobIter->Reset();
	
	// skip over each Mob one at a time.
	for (i=0; i<numMobs; i++)
		if (mobIter->Skip(1) != AAFRESULT_SUCCESS)
			localhr = AAFRESULT_TEST_FAILED;

	// Make sure we are at the end.
	if (mobIter->Skip(1) != AAFRESULT_NO_MORE_OBJECTS)
			localhr = AAFRESULT_TEST_FAILED;
	
	mobIter->Reset();
	// Skip over multiple Mobs at a time.		
	for (i=2; i<=numMobs; i++)	{
		if (mobIter->Skip(i) != AAFRESULT_SUCCESS)
			localhr = AAFRESULT_TEST_FAILED;

		mobIter->Reset();
	}

	// Make sure we are at the end.
	if (mobIter->Skip(numMobs+1) != AAFRESULT_NO_MORE_OBJECTS)
			localhr = AAFRESULT_TEST_FAILED;
			
	if (SUCCEEDED(localhr))
		cout<< "	Skip() ...		Passed" << endl;
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CEnumAAFMobsTest.cpp

示例13: 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

示例14: cleanupReferences

void EnumEssenceDataTest::cleanupReferences()
{
  if (NULL != _pEssenceData)
  {
    _pEssenceData->Release();
    _pEssenceData = NULL;
  }

  if (NULL != _pEnumEssenceData)
  {
    _pEnumEssenceData->Release();
    _pEnumEssenceData = NULL;
  }

  if (NULL != _pFileDescriptor)
  {
    _pFileDescriptor->Release();
    _pFileDescriptor = NULL;
  }

  if (NULL != _pEssenceDescriptor)
  {
    _pEssenceDescriptor->Release();
    _pEssenceDescriptor = NULL;
  }

  if (NULL != _pSourceMob)
  {
    _pSourceMob->Release();
    _pSourceMob = NULL;
  }

  if (NULL != _pMob)
  {
    _pMob->Release();
    _pMob = NULL;
  }

  
  if (NULL != _pDictionary)
  {
    _pDictionary->Release();
    _pDictionary = NULL;
  }

  if (NULL != _pHeader)
  {
    _pHeader->Release();
    _pHeader = NULL;
  }

  if (NULL != _pFile)
  {
    if (_bFileOpen)
      _pFile->Close();
    _pFile->Release();
    _pFile = NULL;
  }
}
开发者ID:mcanthony,项目名称:aaf,代码行数:59,代码来源:CEnumAAFEssenceDataTest.cpp

示例15: Create

void EventTest::Create(
    aafWChar * pFileName,
    aafUID_constref fileKind,
    testRawStorageType_t rawStorageType,
    aafProductIdentification_constref productID)
{
  assert(NULL == _pFile);

  // Remove the previous test file if any.
  RemoveTestFile(pFileName);
    
  // Create the file
  checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &_pFile ));
  _bWritableFile = 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));

  // Make a text clip.
  CreateEvent();

  // cleanup
  Close();
}
开发者ID:mcanthony,项目名称:aaf,代码行数:27,代码来源:CAAFEventTest.cpp


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