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


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

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


在下文中一共展示了IAAFFile::Close方法的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: 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

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

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

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

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

示例7: CreateAAFFile


//.........这里部分代码省略.........
											 transitionLength,
											 cutPoint,
											 pOperationGroup));
		checkResult(pTransition->QueryInterface (IID_IAAFComponent,
												 (void **)&pComponent));

		// now append the transition
		checkResult(pSequence->AppendComponent(pComponent));

		// Release the component - because we need to reuse the pointer later
		pComponent->Release();
		pComponent = NULL;

		// Create the second filler 
		checkResult(defs.cdFiller()->
					CreateInstance(IID_IAAFFiller,
								   (IUnknown **) &pFiller));

		checkResult(pFiller->QueryInterface(IID_IAAFComponent, (void **) &pComponent));
		// Set values for the filler
	    checkResult(pFiller->Initialize(defs.ddkAAFPicture(), fillerLength));
		// append the filler to the sequence
		checkResult(pSequence->AppendComponent(pComponent));
		pComponent->Release();
		pComponent = NULL;
		pFiller->Release();
		pFiller = NULL;

		// Now, we append the composition mob to the file	
		checkResult(pHeader->AddMob(pMob));
		// and we are done !
	}
	catch (HRESULT& rResult)
	{
		hr = rResult;
	}
	

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

  if (pConstantValue)
		pConstantValue->Release();

	if (pParamDef)
		pParamDef->Release();

	if (pSourceClip)
		pSourceClip->Release();

	if (pSourceRef)
		pSourceRef->Release();

	if (pNewSlot)
		pNewSlot->Release();

	if (pSegment)
		pSegment->Release();

	if (pSequence)
		pSequence->Release();

	if (pFiller)
		pFiller->Release();
	if (pOperationDef)
		pOperationDef->Release();


	if (pOperationGroup)
		pOperationGroup->Release();

	if (pMob)
		pMob->Release();

	if (pCompMob)
		pCompMob->Release();

	if (pDictionary)
		pDictionary->Release();

	if (pHeader)
		pHeader->Release();


	if (pTransition)
		pTransition->Release();

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

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

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

示例9: ReadAAFFile


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

		      check(pEssenceAccess->QueryInterface(IID_IAAFEssenceMultiAccess, (void **)&pMultiEssence));
		      xfer.numSamples = dataLen;	//!!! Hardcoded	// Number of Samples 
		      xfer.buflen = sizeof(AAFDataBuf);
		      xfer.buffer = AAFDataBuf;
		      result.bytesXfered = 0;
		      check(pMultiEssence->ReadMultiSamples(1, &xfer, &result));
		      samplesRead = result.samplesXfered;
		      AAFBytesRead = result.bytesXfered;
		      pMultiEssence->Release();
		      pMultiEssence = NULL;
		    }

		  // Now compare the data read from the AAF file to the actual WAV file
		  if (dataLen != AAFBytesRead)
		    {
		      printf("***Wrong number of bytes read (was %u , should be %zu)\n",
			     AAFBytesRead, WAVBytesRead);
		    }
		  if (memcmp( dataPtr, AAFDataBuf, dataLen) != 0)
		    {
		      printf("*** Data Read is different than the data in the WAV file ***\n");
		    }
		}
	      else
		{
		  printf("***Failed to open Wave file Laser.wav for comparison\n");
		}
	    }
	  else
	    {
	      printf("***Wrong number of slots in the Master Mob (was %d should be %d)\n",
		     numSlots, 2);
	    }
	  if (pMasterMob)
	    {
	      pMasterMob->Release();
	      pMasterMob = NULL;
	    }

	  pMob->Release();
	  pMob = NULL;
	  if (pEssenceAccess)
	    {
	      pEssenceAccess->Release();
	      pEssenceAccess = NULL;
	    }
	} // while pMobIter->NextOne
      pMobIter->Release();
      pMobIter = NULL;

    }
  else
    {
      printf("***Wrong number of Master mobs in the file (was %d should be %d)\n",
	     numMobs, 1);
    }
  printf("--------\n");

 cleanup:
  // Cleanup and return

  if (pWavFile)
    fclose(pWavFile);
  if (pMultiEssence)
    pMultiEssence->Release();
  pMultiEssence=NULL;
  if(fmtTemplate)
    {
      fmtTemplate->Release();
      fmtTemplate = NULL;
    }
  if (pEssenceAccess)
    {
      pEssenceAccess->Release();
      pEssenceAccess = NULL;
    }
  if (pDictionary)
    pDictionary->Release();
  pDictionary=NULL;

  if (pHeader)
    pHeader->Release();
  pHeader=NULL;
  if (pMobIter)
    pMobIter->Release();
  pMobIter=NULL;
  if (pFormat)
    pFormat->Release();
  pFormat=NULL;

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

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

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

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

示例12: ReadAAFFile


//.........这里部分代码省略.........
                    else if (memcmp( &id, &kAAFDataDef_Timecode, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as Timecode)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_PictureWithMatte, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as PictureWithMatte)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_Edgecode, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as Edgecode)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_Auxiliary, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as Auxiliary)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_DescriptiveMetadata, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as DescriptiveMetadata)\n", chName);
                    else if (memcmp( &id, &kAAFDataDef_Matte, sizeof(id)) == 0)
                        printf("\"%s\" (recognized as Matte)\n", chName);
                    else
                        printf("\"%s\"\n", chName);
                    printf("                       ");
                }

                // Check if file contains TypeDefs known to cause a v1.0 reader to assert.
                // Known instances of this are UInt32Set and AUIDSet added to the v1.1 SDK.
                // Cannot use Dictionary::LookupTypeDef to check for them, because this
                // has the side effect of registering the typedef we are checking for
                // from the built-in model. Instead, iterate through typedefs (in file)
                // and check for the known instances.
                printf("\nTypes incompatible with SDK v1.0.x =");
                IEnumAAFTypeDefsSP pEnumTypeDef;
                check(pDictionary->GetTypeDefs(&pEnumTypeDef));
                IAAFTypeDef* pTypeDef;
                bool foundToxic = false;
                while (SUCCEEDED(pEnumTypeDef->NextOne(&pTypeDef)))
                {
                    IAAFMetaDefinitionSP pMetaDef;
                    check(pTypeDef->QueryInterface(IID_IAAFMetaDefinition, (void**)&pMetaDef));
                    pTypeDef->Release();
                    pTypeDef = NULL;

                    aafUID_t typeUID;
                    check(pMetaDef->GetAUID(&typeUID));

                    aafWChar wchName[500];
                    char chName[1000];
                    check( pMetaDef->GetName(wchName, sizeof (wchName)) );
                    convert(chName, sizeof(chName), wchName);

                    if ((memcmp( &typeUID, &kAAFTypeID_AUIDSet, sizeof(typeUID)) == 0)
                            || (memcmp( &typeUID, &kAAFTypeID_UInt32Set, sizeof(typeUID)) == 0))
                    {
                        printf(" %s", chName);
                        foundToxic = true;
                    }
                }
                if (!foundToxic)
                    printf(" (none)");
                printf("\n\n");

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

        hr = pFile->Close();
        check(hr);

        pFile->Release();
        pFile = NULL;

        // Get file kind.
        // Since AAF SDK v1.0.2, the file kind actually identifies the implementation
        // of the file kind, from which the file kind is inferred.
        aafUID_t fileKind = {0};
        aafBool isAAFFile = kAAFFalse;

        check(AAFFileIsAAFFile(pFileName, &fileKind, &isAAFFile));
        if (isAAFFile)
        {
            if (memcmp( &fileKind, &kAAFFileKind_AafM512Binary, sizeof(fileKind)) == 0)
                printf("Filekind             = 512-byte SS (reading with Microsoft)\n");
            else if (memcmp( &fileKind, &kAAFFileKind_AafS512Binary, sizeof(fileKind)) == 0)
                printf("Filekind             = 512-byte SS (reading with Schemasoft)\n");
            else if (memcmp( &fileKind, &kAAFFileKind_AafG512Binary, sizeof(fileKind)) == 0)
                printf("Filekind             = 512-byte SS (reading with GSF)\n");
            else if (memcmp( &fileKind, &kAAFFileKind_Aaf512Binary, sizeof(fileKind)) == 0)
                printf("Filekind             = 512-byte SS (reading with default implementation)\n");
            else if (memcmp( &fileKind, &kAAFFileKind_AafM4KBinary, sizeof(fileKind)) == 0)
                printf("Filekind             = 4096-byte SS (reading with Microsoft)\n");
            else if (memcmp( &fileKind, &kAAFFileKind_AafS4KBinary, sizeof(fileKind)) == 0)
                printf("Filekind             = 4096-byte SS (reading with Schemasoft)\n");
            else if (memcmp( &fileKind, &kAAFFileKind_AafG4KBinary, sizeof(fileKind)) == 0)
                printf("Filekind             = 4096-byte SS (reading with GSF)\n");
            else if (memcmp( &fileKind, &kAAFFileKind_Aaf4KBinary, sizeof(fileKind)) == 0)
                printf("Filekind             = 4096-byte SS (reading with default implementation)\n");
            else
                printf("Filekind             = Recognized by SDK but unknown to AAFInfo\n");
        }
    }
    else
    {
        fprintf(stderr, "Error : Failed to open file (result = %0x).\n", hr);
        exit(1);
    }
}
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:AAFInfo.cpp

示例13:

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

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

示例15: ReadAAFFile


//.........这里部分代码省略.........
		checkResult(pEffectEnum->NextOne (&pOperationDef));
		checkResult(pOperationDef->GetDataDef(&pReadDataDef));

		checkResult(pOperationDef->QueryInterface(IID_IAAFDefObject, (void **) &pDefObject));
		checkResult(pDefObject->GetName (checkName, sizeof(checkName)));
		checkExpression(wcscmp(checkName, effectNames[0]) == 0, AAFRESULT_TEST_FAILED);
		checkResult(pDefObject->GetDescription (checkName, sizeof(checkName)));
		checkExpression(wcscmp(checkName, effectDesc[0]) == 0, AAFRESULT_TEST_FAILED);
		pDefObject->Release();
		pDefObject = NULL;
		
		checkResult(pReadDataDef->IsDataDefOf(defs.ddkAAFPicture(), &bResult));
		checkExpression(bResult == kAAFTrue, AAFRESULT_TEST_FAILED);
						
		checkResult(pOperationDef->IsTimeWarp (&readIsTimeWarp));
		checkExpression(readIsTimeWarp == kAAFFalse, AAFRESULT_TEST_FAILED);
		checkResult(pOperationDef->GetCategory (&checkCat));
		checkExpression(memcmp(&checkCat, &TEST_CATEGORY, sizeof(aafUID_t)) == 0, AAFRESULT_TEST_FAILED);
		checkResult(pOperationDef->GetBypass (&checkBypass));
		checkExpression(checkBypass == TEST_BYPASS, AAFRESULT_TEST_FAILED);
		checkResult(pOperationDef->GetNumberInputs (&checkNumInputs));
		checkExpression(checkNumInputs == TEST_NUM_INPUTS, AAFRESULT_TEST_FAILED);
		checkResult(pOperationDef->GetParameterDefs (&pParmDefEnum));
		checkResult(pParmDefEnum->NextOne (&pParmDef));

		checkResult(pParmDef->QueryInterface(IID_IAAFDefObject, (void **) &pDefObject));
		checkResult(pDefObject->GetName (checkName, sizeof(checkName)));
		checkExpression(wcscmp(checkName, TEST_PARAM_NAME) == 0, AAFRESULT_TEST_FAILED);
		checkResult(pDefObject->GetDescription (checkName, sizeof(checkName)));
		checkExpression(wcscmp(checkName, TEST_PARAM_DESC) == 0, AAFRESULT_TEST_FAILED);
		pDefObject->Release();
		pDefObject = NULL;

		checkResult(pOperationDef->GetDegradeToOperations (&pDegradeEnum));
		pOperationDef->Release();
		pOperationDef = NULL;

		// Check for prepended one first
		checkResult(pDegradeEnum->NextOne (&pOperationDef));
		checkResult(pOperationDef->QueryInterface(IID_IAAFDefObject, (void **) &pDefObject));
		checkResult(pDefObject->GetName (checkName, sizeof(checkName)));
		checkExpression(wcscmp(checkName, effectNames[2]) == 0, AAFRESULT_TEST_FAILED);
		checkResult(pDefObject->GetDescription (checkName, sizeof(checkName)));
		checkExpression(wcscmp(checkName, effectDesc[2]) == 0, AAFRESULT_TEST_FAILED);
		pDefObject->Release();
		pDefObject = NULL;
		pOperationDef->Release();
		pOperationDef = NULL;

		// Check for appended one second
		checkResult(pDegradeEnum->NextOne (&pOperationDef));
		checkResult(pOperationDef->QueryInterface(IID_IAAFDefObject, (void **) &pDefObject));
		checkResult(pDefObject->GetName (checkName, sizeof(checkName)));
		checkExpression(wcscmp(checkName, effectNames[1]) == 0, AAFRESULT_TEST_FAILED);
		checkResult(pDefObject->GetDescription (checkName, sizeof(checkName)));
		checkExpression(wcscmp(checkName, effectDesc[1]) == 0, AAFRESULT_TEST_FAILED);
		pDefObject->Release();
		pDefObject = NULL;
		pOperationDef->Release();
		pOperationDef = NULL;
	}
	catch (HRESULT& rResult)
	{
		hr = rResult;
	}

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

	if (pDegradeEnum)
		pDegradeEnum->Release();

	if (pParmDefEnum)
		pParmDefEnum->Release();
      
	if (pOperationDef)
		pOperationDef->Release();
      
	if (pDefObject)
		pDefObject->Release();

	if (pParmDef)
		pParmDef->Release();

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

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


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