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


C++ IEnumAAFMobs类代码示例

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


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

示例1: 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;
        IAAFTypeDefIndirect* pIndirectType = 0;
        IAAFPropertyValue* pActualPropertyValue = 0;
        IAAFTypeDef* pActualType = 0;
        IAAFTypeDefInt* pIntType = 0;
        IAAFTypeDefEnum* pEnumType = 0;
        IAAFTypeDefRecord* pRecordType = 0;

        try
        {
            printf("    * Baseline: ");

            const aafUID_t propId = 
                {0x00000000,0x0000,0x0000,{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
            aafInt8 testValue = -128;
            
            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_IAAFTypeDefIndirect, (void **)&pIndirectType));
            
            checkResult(pIndirectType->GetActualValue(pPropertyValue, &pActualPropertyValue));
            checkResult(pActualPropertyValue->GetType(&pActualType));
            checkResult(pActualType->QueryInterface(IID_IAAFTypeDefInt, (void **)&pIntType));
            
            aafInt8 value;
            checkResult(pIntType->GetInteger(pActualPropertyValue, (aafUInt8*)&value, 1));

            if (value == testValue)
            {
                printf("passed\n");
            }
            else
            {
                printf("FAILED\n");
                passed = false;
            }
        }
        catch (...)
        {
            printf("FAILED\n");
            passed = false;
        }
        release(pRecordType);
        release(pEnumType);
        release(pIntType);
        release(pActualType);
        release(pActualPropertyValue);
        release(pIndirectType);
        release(pType);
        release(pPropertyValue);
        release(pPropertyDef);
        release(pClassDef);
        release(pObject);
        
        try
        {
            printf("    * Non-baseline: ");

            const aafUID_t propId = 
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:aaf,代码行数:101,代码来源:TestIndirect.cpp

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

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

示例4: ReadAAFFile

static HRESULT  ReadAAFFile(aafWChar *  pFileName )
{
	HRESULT hr = AAFRESULT_SUCCESS;
	
	IAAFFile *					pFile = NULL;
	IAAFHeader *				pHeader = NULL;
	IEnumAAFMobs*				pMobIter = NULL;
	IAAFCompositionMob *		pCMob = NULL;
	IAAFMob*					pMob = NULL;
	bool bFileOpen = false;
	aafNumSlots_t				numMobs;
	IAAFObject*					pObj = NULL;
	
	IEnumAAFProperties * pEnum = NULL;
	IAAFProperty *pProp = NULL;
	
	IAAFPropertyDef* pPropDef = NULL;
	IAAFPropertyValue* pPropVal = NULL;

	IAAFTypeDef*	pTypeDef  = NULL;

	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));
		
		// Validate that there is only one composition mob.
		checkResult(pHeader->CountMobs(kAAFCompMob, &numMobs));
		checkExpression(1 == numMobs, AAFRESULT_TEST_FAILED);
		
		// Enumerate over all Composition Mobs
		aafSearchCrit_t				criteria;
		criteria.searchTag = kAAFByMobKind;
		criteria.tags.mobKind = kAAFCompMob;
		checkResult(pHeader->GetMobs(&criteria, &pMobIter));
		while (AAFRESULT_SUCCESS == pMobIter->NextOne(&pMob))
		{		
			//Get the Composition mob
			checkResult (pMob->QueryInterface (IID_IAAFCompositionMob,
				(void **) &pCMob));
			
			//Get the Object
			checkResult (pCMob->QueryInterface (IID_IAAFObject,
				(void **) &pObj));
			
			//From the Object, we can get the properties ....
			aafUInt32 propCount = 0;
			checkResult (pObj->CountProperties (&propCount));
			//A composition should have at least 5 properties ...
 			checkExpression(propCount>=5, AAFRESULT_TEST_FAILED);
			
			//Get Enumeration over properties
			checkResult (pObj->GetProperties (&pEnum));
			checkExpression (pEnum != 0, AAFRESULT_TEST_FAILED);
			while (propCount--)
			{
				//Check for property validity
				checkResult (pEnum->NextOne (&pProp));
				checkExpression (pProp != NULL, AAFRESULT_TEST_FAILED);
				//Now call prop methods
				
				//1.  Get Definition
				checkResult( pProp->GetDefinition(&pPropDef) );
				//2. Get Value
				checkResult( pProp->GetValue(&pPropVal) );

				//deal with prop value
				checkResult( pPropVal->GetType(&pTypeDef) );

				//From propval, get the typedef!!!!!!!!!!!!!!!!!!!!!
				IAAFTypeDefSP spTypeDef;
				checkResult( pPropVal->GetType(&spTypeDef) );

				//get category
				eAAFTypeCategory_t typeCat = kAAFTypeCatUnknown;
				checkResult (spTypeDef->GetTypeCategory(&typeCat));
				//make sure it is not unknown
				checkExpression(kAAFTypeCatUnknown != typeCat, AAFRESULT_TEST_FAILED);
				
				//Deal with our Name  String .... 
				if (typeCat == kAAFTypeCatString)
				{
					IAAFTypeDefStringSP  spTypeDefString;
					checkResult( spTypeDef->QueryInterface(IID_IAAFTypeDefString, 
												(void**)&spTypeDefString) );

					aafUInt32 bufSize = 
						//don't forget the NULL char, and factoring in the size of a wchar
						   (wcslen(TEST_NAME)+1) * sizeof(aafCharacter); 

					aafCharacter *nameBuf = new aafCharacter[bufSize];
					checkResult( spTypeDefString->GetElements(pPropVal, (aafMemPtr_t)nameBuf, bufSize) );
					checkExpression( wcscmp(TEST_NAME, nameBuf) == 0, AAFRESULT_TEST_FAILED );
					delete [] nameBuf;
				}

//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CAAFPropertyTest.cpp

示例5: ModifyAAFFile

static HRESULT ModifyAAFFile(aafWChar *filename, int level)
{
	HRESULT			hr = S_OK;

	try
	{
		// Open existing file for modification
		IAAFFile		*pFile = NULL;
		TestProductID.productVersionString = const_cast<aafWChar*>(L"ModifyAAFFile");
		checkResult( AAFFileOpenExistingModify(
						filename,
						0,					// modeFlags
						&TestProductID,
						&pFile) );

		cout << "ModifyAAFFile() - appended Identification" << endl;

		// Get the header & dictionary
		IAAFHeader		*pHeader = NULL;
		IAAFDictionary	*pDictionary = NULL;
		checkResult(pFile->GetHeader(&pHeader));
		checkResult(pHeader->GetDictionary(&pDictionary));

		// Search for Mobs
		IAAFMob			*pFileMob = NULL;
		IEnumAAFMobs	*pFileMobIter = NULL;
		aafSearchCrit_t				criteria;
		criteria.searchTag = kAAFByMobKind;
		criteria.tags.mobKind = kAAFFileMob;		// Search by File Mob
	
		checkResult(pHeader->GetMobs(&criteria, &pFileMobIter));
	
		while (AAFRESULT_SUCCESS == pFileMobIter->NextOne(&pFileMob))
		{
			if (level == 0)
				break;

			IAAFEssenceDescriptor	*edesc = NULL;
			IAAFSourceMob			*pSourceMob = NULL;
			CR(pFileMob->QueryInterface(IID_IAAFSourceMob, (void **)&pSourceMob));
			CR(pSourceMob->GetEssenceDescriptor(&edesc));

			// Change the Name property
			CR(pFileMob->SetName(L"ModifyAAFFile - modified Name"));
			cout << "ModifyAAFFile() - changed FileMob's Name property" << endl;

			if (level == 1)
				break;

			// Change descriptor's properties
			IAAFAIFCDescriptor		*pAIFCDesc = NULL;
			CR(edesc->QueryInterface(IID_IAAFAIFCDescriptor, (void **)&pAIFCDesc));
			aafUInt8				AIFCsum[] = {0xa1,0xfc};
			CR(pAIFCDesc->SetSummary(sizeof(AIFCsum), AIFCsum));
			pAIFCDesc->Release();
			edesc->Release();
			cout << "ModifyAAFFile() - changed AIFCDescriptor's Summary" << endl;

			if (level == 2)
				break;

			// Change descriptor to new one (overwriting old one)
			IAAFClassDef			*classDef = NULL;
			IAAFFileDescriptor		*pFileDesc = NULL;
			IAAFWAVEDescriptor		*pWAVEDesc = NULL;
			IAAFEssenceDescriptor	*pNewEdesc = NULL;

			CR(pDictionary->LookupClassDef(AUID_AAFWAVEDescriptor, &classDef));
			CR(classDef->CreateInstance(IID_IAAFFileDescriptor, (IUnknown **)&pFileDesc));
			CR(pFileDesc->QueryInterface(IID_IAAFWAVEDescriptor, (void **)&pWAVEDesc));
			CR(pFileDesc->QueryInterface(IID_IAAFEssenceDescriptor, (void **)&pNewEdesc));
			aafUInt8				WAVEsum[] = {0x1a,0x1e,0xee,0xee};
			CR(pWAVEDesc->SetSummary(sizeof(WAVEsum), WAVEsum));
			CR(pSourceMob->SetEssenceDescriptor(pNewEdesc));
			pNewEdesc->Release();
			pWAVEDesc->Release();
			pFileDesc->Release();
			classDef->Release();
			cout << "ModifyAAFFile() - replaced AIFCDescriptor with WAVEDescriptor" << endl;

			if (level == 3)
				break;

			// Add EssenceData
			IAAFEssenceData			*pEssenceData = NULL;
			IAAFEssenceData2		*pEssenceData2 = NULL;
			IAAFPlainEssenceData		*pPlainEssenceData = NULL;
			aafUInt32				bytesWritten = 0;
			aafUInt8				essdata[] = "Zaphod Beeblebrox";
			CR(pDictionary->LookupClassDef(AUID_AAFEssenceData, &classDef));
			CR(classDef->CreateInstance(IID_IAAFEssenceData, (IUnknown **)&pEssenceData));
			CR(pEssenceData->SetFileMob(pSourceMob));
			CR(pHeader->AddEssenceData(pEssenceData));
			CR(pEssenceData->QueryInterface(IID_IAAFEssenceData2, (void**)&pEssenceData2));
			CR(pEssenceData2->GetPlainEssenceData(0, &pPlainEssenceData));
			CR(pPlainEssenceData->Write(sizeof(essdata), essdata, &bytesWritten));
			pEssenceData->Release();
			pEssenceData2->Release();
			pPlainEssenceData->Release();
			classDef->Release();
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:OpenExistingModify.cpp

示例6: ReadAAFFile

static HRESULT ReadAAFFile(aafWChar* pFileName)
{
	IAAFFile*			pFile = NULL;
	IAAFHeader*			pHeader = NULL;
	IAAFDictionary*		pDictionary = NULL;
	IEnumAAFOperationDefs *pOperationGroupEnum = NULL;
	IEnumAAFParameterDefs *pParmDefEnum = NULL;
	IAAFOperationDef		*pOperationDef = NULL;
	IAAFParameterDef	*pParmDef = NULL;
	IAAFParameter		*pParameter = NULL;
	IAAFMetaDefinition*		pMetaDefinition = NULL;
	IAAFSegment*		pSeg = NULL;
	IAAFOperationGroup*			pOperationGroup = NULL;
	IEnumAAFMobs		*mobIter = NULL;
	IAAFMob*			pMob = NULL;
	IEnumAAFMobSlots	*slotIter = NULL;
	IAAFMobSlot*		pSlot = NULL;
	IAAFFiller*			pFill = NULL;
	IAAFSourceReference *pSourceRef = NULL;
	IEnumAAFControlPoints *pEnumCP = NULL;
	IAAFControlPoint	*pControlPoint = NULL;
	IAAFVaryingValue	*pVaryingValue = NULL;
	IAAFInterpolationDef	*pInterpDef = NULL;
	IAAFTypeDef			*pTypeDef = NULL;
	bool				bFileOpen = false;
	aafBool				readIsTimeWarp;
	aafUInt32			testNumSources, testNumParam;
	HRESULT				hr = S_OK;
	aafNumSlots_t		s;
	aafNumSlots_t	numSlots;
	aafUInt32			readOverride;
	aafBool				readValidTransition;
	aafRational_t		testTime;
	aafRational_t	sampleValue1 = kTestLevel1, sampleValue2 = kTestLevel2, testValue;
	aafRational_t		checkTime1 = kTestTime1;
	aafRational_t		checkTime2 = kTestTime2;
	aafEditHint_t		checkEditHint;
	aafUID_t			testInterpDef, checkInterpDef = kAAFTypeID_Rational;

	try
	{
		// Open the AAF file
		checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
		bFileOpen = true;
		
		// Get the AAF file header.
		checkResult(pFile->GetHeader(&pHeader));

		aafSearchCrit_t		criteria;
		criteria.searchTag = kAAFNoSearch;
		checkResult(pHeader->GetMobs (&criteria, &mobIter));
				
		checkResult(mobIter->NextOne (&pMob));			
		checkResult(pMob->GetSlots(&slotIter));
		checkResult(pMob->CountSlots (&numSlots));
		
		for(s = 0; s < numSlots; s++)
		{
			checkResult(slotIter->NextOne (&pSlot));
			checkResult(pSlot->GetSegment (&pSeg));
			checkResult(pSeg->QueryInterface (IID_IAAFOperationGroup, (void **)&pOperationGroup));
			pSeg->Release();
			pSeg = NULL;

			checkResult(pOperationGroup->CountSourceSegments(&testNumSources));
			checkExpression(testNumSources == TEST_NUM_INPUTS, AAFRESULT_TEST_FAILED);
			checkResult(pOperationGroup->CountParameters(&testNumParam));
			checkExpression(testNumSources == 1, AAFRESULT_TEST_FAILED);

			checkResult(pOperationGroup->IsATimeWarp (&readIsTimeWarp));
			checkExpression(readIsTimeWarp == kAAFFalse, AAFRESULT_TEST_FAILED);

			checkResult(pOperationGroup->GetBypassOverride (&readOverride));
			checkExpression(readOverride == 1, AAFRESULT_TEST_FAILED);

			checkResult(pOperationGroup->IsValidTranOperation (&readValidTransition));
			checkExpression(readValidTransition == kAAFFalse, AAFRESULT_TEST_FAILED);
			/**/
			checkResult(pOperationGroup->GetInputSegmentAt (0, &pSeg));
 			checkResult(pSeg->QueryInterface(IID_IAAFFiller, (void **) &pFill));
			pFill->Release();
			pFill = NULL;
			/**/
			checkResult(pOperationGroup->LookupParameter (kTestParmID, &pParameter));
 			checkResult(pParameter->QueryInterface(IID_IAAFVaryingValue, (void **) &pVaryingValue));

			/*** Check the VaryingValue methods **/
			aafUInt32		testLen, bytesRead;

			checkResult(pVaryingValue->GetControlPoints(&pEnumCP));
			checkResult(pEnumCP->NextOne(&pControlPoint));
			checkResult(pControlPoint->GetValueBufLen (&testLen));
 			checkExpression(testLen == sizeof(sampleValue1), AAFRESULT_TEST_FAILED);
			checkResult(pControlPoint->GetValue (sizeof(sampleValue1), (aafDataBuffer_t)&testValue, &bytesRead));
 			checkExpression(testValue.numerator == sampleValue1.numerator, AAFRESULT_TEST_FAILED);
 			checkExpression(testValue.denominator == sampleValue1.denominator, AAFRESULT_TEST_FAILED);
 			checkExpression(bytesRead == sizeof(sampleValue1), AAFRESULT_TEST_FAILED);
			checkResult(pControlPoint->GetTime(&testTime));
 			checkExpression(testTime.numerator == checkTime1.numerator, AAFRESULT_TEST_FAILED);
 			checkExpression(testTime.denominator == checkTime1.denominator, AAFRESULT_TEST_FAILED);
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CAAFControlPointTest.cpp

示例7: ReadAAFFile

static HRESULT ReadAAFFile(aafWChar * pFileName)
{
	IAAFFile*				pFile = NULL;
	IAAFHeader*				pHeader = NULL;
	IEnumAAFMobs*			pMobIter = NULL;
	IAAFMob*				pMob = NULL;
	IAAFSourceMob*			pSourceMob = NULL;
	IAAFEssenceDescriptor*	pEssDesc = NULL;
	IAAFDataEssenceDescriptor*		pDataEssenceDesc = NULL;
	aafNumSlots_t			numMobs = 0;
	aafUID_t				dataEssenceCoding, dataEssTestVal;
	HRESULT					hr = AAFRESULT_SUCCESS;


	try
	{
		memset(&dataEssTestVal, 0, sizeof(aafUID_t));
		// Open the AAF file
		checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));

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

		checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
		checkExpression(1 == numMobs, AAFRESULT_TEST_FAILED);

		checkResult(pHeader->GetMobs(NULL, &pMobIter));
		checkResult(pMobIter->NextOne(&pMob));
		checkResult(pMob->QueryInterface(IID_IAAFSourceMob, (void **)&pSourceMob));
		
		// Back into testing mode
		checkResult(pSourceMob->GetEssenceDescriptor(&pEssDesc));
		
		// if there is an Essence Descriptor then it MUST be an (essence) DataEssence Descriptor
		checkResult(pEssDesc->QueryInterface(IID_IAAFDataEssenceDescriptor, (void **) &pDataEssenceDesc));

		checkResult(pDataEssenceDesc->GetDataEssenceCoding(&dataEssenceCoding));
	 	checkExpression(memcmp(&dataEssenceCoding, &dataEssTestVal, sizeof(aafUID_t)) == 0,
                    AAFRESULT_TEST_FAILED);
	}
	catch (HRESULT& rResult)
	{
		hr = rResult;
	}
	
  
	// Cleanup and return
	if (pDataEssenceDesc)
		pDataEssenceDesc->Release();

  if (pEssDesc)
		pEssDesc->Release();

	if (pSourceMob)
		pSourceMob->Release();

	if (pMob)
		pMob->Release();

	if (pMobIter)
		pMobIter->Release();

	if (pHeader)
		pHeader->Release();

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

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

示例8: assert

void HTMLClipTest::OpenHTMLClip()
{
  assert(_pHeader);

  HRESULT hr = S_OK;
  aafNumSlots_t compositionMobs = 0;
  IEnumAAFMobs *pEnumMobs = NULL;
  IAAFMob *pReferencingMob = NULL;
  IAAFCompositionMob *pCompositionMob = NULL;
  aafNumSlots_t mobSlots = 0;
  IEnumAAFMobSlots *pEnumSlots = NULL;
  IAAFMobSlot *pMobSlot = NULL;
  IAAFSegment *pSegment = NULL;
  IAAFHTMLClip *pHTMLClip = NULL;
  aafUInt32 bufSize = 0;
  aafUInt32 actualBufSize = 0;
  aafUInt32 actualLength = 0;
  wchar_t *pBeginAnchor = NULL;
  wchar_t *pEndAnchor = NULL;
  IAAFSourceReference *pSourceReference = NULL;
  aafMobID_t masterMobID = {0};
  IAAFMasterMob *pMasterMob = NULL;
  IAAFMob *pReferencedMob = NULL;


  try
  {
    // Get the number of composition mobs in the file (should be one)
    checkResult(_pHeader->CountMobs(kAAFCompMob, &compositionMobs));
    checkExpression(1 == compositionMobs, AAFRESULT_TEST_FAILED);

    // Get the composition mob. There should only be one.
    aafSearchCrit_t criteria;
    criteria.searchTag = kAAFByMobKind;
    criteria.tags.mobKind = kAAFCompMob;
    checkResult(_pHeader->GetMobs(&criteria, &pEnumMobs));
    checkResult(pEnumMobs->NextOne(&pReferencingMob));
    checkResult(pReferencingMob->QueryInterface(IID_IAAFCompositionMob, (void **)&pCompositionMob));

    // Get the html clip in the slot. There should be only one.
    checkResult(pReferencingMob->CountSlots(&mobSlots));
    checkExpression(1 == mobSlots, AAFRESULT_TEST_FAILED);
    checkResult(pReferencingMob->GetSlots(&pEnumSlots));
    checkResult(pEnumSlots->NextOne(&pMobSlot));
    checkResult(pMobSlot->GetSegment(&pSegment));
    checkResult(pSegment->QueryInterface(IID_IAAFHTMLClip, (void **)&pHTMLClip));

    // Validate the properties...
    checkResult(pHTMLClip->GetBeginAnchorBufLen(&bufSize));
    actualLength = wcslen(_beginAnchor) + 1;
    actualBufSize = actualLength * 2;
    checkExpression(bufSize == actualBufSize, AAFRESULT_TEST_FAILED);
    pBeginAnchor = new wchar_t[actualLength];
    checkExpression(NULL != pBeginAnchor, AAFRESULT_NOMEMORY);
    checkResult(pHTMLClip->GetBeginAnchor(pBeginAnchor, actualBufSize));
    checkExpression(0 == wcscmp(pBeginAnchor, _beginAnchor), AAFRESULT_TEST_FAILED);

    checkResult(pHTMLClip->GetEndAnchorBufLen(&bufSize));
    actualLength = wcslen(_endAnchor) + 1;
    actualBufSize = actualLength * 2;
    checkExpression(bufSize == actualBufSize, AAFRESULT_TEST_FAILED);
    pEndAnchor = new wchar_t[actualLength];
    checkExpression(NULL != pEndAnchor, AAFRESULT_NOMEMORY);
    checkResult(pHTMLClip->GetEndAnchor(pEndAnchor, actualBufSize));
    checkExpression(0 == wcscmp(pEndAnchor, _endAnchor), AAFRESULT_TEST_FAILED);
    

    // Attempt to "resolve" the reference and find the master mob.
    checkResult(pHTMLClip->QueryInterface(IID_IAAFSourceReference, (void **)&pSourceReference));  
    checkResult(pSourceReference->GetSourceID(&masterMobID));
    checkExpression(0 == memcmp(&masterMobID, &_referencedMobID, sizeof(masterMobID)), AAFRESULT_TEST_FAILED);
    checkResult(_pHeader->LookupMob(masterMobID, &pReferencedMob));
    checkResult(pReferencedMob->QueryInterface(IID_IAAFMasterMob, (void **)&pMasterMob));

    
    // Use EssenceAccess to read some html essence
      // Find the file mob for the html essence.
      // Find the corresponding html essence.
      // Read some html essence.
  }
  catch (HRESULT& rHR)
  {
    hr = rHR;
    // fall through and handle cleanup
  }

  // Cleanup local references
  if (pMasterMob)
  {
    pMasterMob->Release();
    pMasterMob = NULL;
  }

  if (pReferencedMob)
  {
    pReferencedMob->Release();
    pReferencedMob = NULL;
  }

  if (pSourceReference)
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:aaf,代码行数:101,代码来源:CAAFHTMLClipTest.cpp

示例9: OpenAAFFile

static HRESULT OpenAAFFile(aafWChar * pFileName)
{
	IAAFFile*					pFile = NULL;
	IAAFHeader*					pHeader = NULL;
	IAAFDictionary*				pDictionary = NULL;
	IAAFMob*					pMob = NULL;
	IAAFEssenceAccess*			pEssenceAccess = NULL;
	IAAFEssenceFormat*			pFormat = NULL;
	IEnumAAFMobs*				pMobIter = NULL;
	aafNumSlots_t				numMobs, numSlots;
	aafSearchCrit_t				criteria;
	aafMobID_t					mobID;
	IAAFDataDef					*pSoundDef = NULL;
	IAAFMobSlot*				pMobSlot = NULL;


	// Open an AAF file
	check(AAFFileOpenExistingRead (pFileName, 0, &pFile));
	check(pFile->GetHeader(&pHeader));

	// Open raw audio output file
	FILE		*output;
	const char	*output_file = "raw.pcm";

	if ((output = fopen(output_file, "wb")) == NULL)
	{
		perror(output_file);
		exit(1);
	}

	// Get the AAF Dictionary from the file
	check(pHeader->GetDictionary(&pDictionary));

	/* Lookup any necessary data definitions. */
	check(pDictionary->LookupDataDef(kAAFDataDef_Sound, &pSoundDef));

	/* Check number of Mobs in file */
	check(pHeader->CountMobs(kAAFMasterMob, &numMobs));
	if (numMobs == 0)
	{
		printf("No Master Mobs found in AAF file\n");
		return 0;
	}

	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];
		aafWChar	namebuf[1204];
		IAAFTimelineMobSlot* pTimelineMobSlot = NULL;
		IAAFDataDef *pDataDef = NULL;
		IAAFEssenceFormat			*fmtTemplate =  NULL;
		unsigned char *dataBuff = NULL;

		IEnumAAFMobSlots* pMobSlotIter = NULL;


		check(pMob->GetMobID (&mobID));
		check(pMob->GetName (namebuf, sizeof(namebuf)));
		MobIDtoString(mobID, mobIDstr);
		printf("    MasterMob Name = '%ls'\n", namebuf);
		printf("        (mobID %s)\n", mobIDstr);
		
		// Get the number of slots
		check(pMob->CountSlots(&numSlots));
		
		// Iterating through all Mob Slots

		check(pMob->GetSlots(&pMobSlotIter));
		while(AAFRESULT_SUCCESS == pMobSlotIter->NextOne(&pMobSlot))
		{
			// Check to see if it is an Audio Timeline Mob Slot
			HRESULT hr;
			aafUInt32 MobSlotID;
	
			hr=pMobSlot->QueryInterface(IID_IAAFTimelineMobSlot,(void **) &pTimelineMobSlot);
			if (SUCCEEDED(hr))
			{
				check(pMobSlot->GetDataDef(&pDataDef));
	
				// Check that we have a sound file by examining its data definition
				aafBool bIsSoundKind = kAAFFalse;
				check(pDataDef->IsSoundKind(&bIsSoundKind));
	
				if (kAAFTrue == bIsSoundKind)
				{
					IAAFMasterMob*			pMasterMob = NULL;

					// Prepare to get audio data: first get MobSlotID
					check(pMobSlot->GetSlotID(&MobSlotID));
	
					// Then get a Master Mob interface
					check(pMob->QueryInterface(IID_IAAFMasterMob, (void **)&pMasterMob));
					
					// Open the Essence Data
					check(pMasterMob->OpenEssence(MobSlotID,
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:ImportPCM.cpp

示例10: ReadAAFFile

static HRESULT ReadAAFFile(aafWChar * pFileName)
{
  IAAFDictionary		*pDictionary = NULL;
  IAAFFile 				*pFile = NULL;
  bool 					bFileOpen = false;
  IAAFHeader 			*pHeader = NULL;
  IEnumAAFMobs 			*mobIter = NULL;
  IAAFMob				*aMob = NULL;
  IEnumAAFMobSlots		*slotIter = NULL;
  IAAFMobSlot			*slot = NULL;
  aafNumSlots_t			numMobs, n, s;
  HRESULT				hr = S_OK;
  aafUInt32 			bufLen = 0;
  aafUInt32 			bytesRead = 0;
  aafUInt32				numFound = 0;
  aafWChar				value[500];
  IEnumAAFTaggedValues 	*enumTaggedVal = NULL;
  IAAFTaggedValue		*taggedVal = NULL;
  aafUID_t				testKey;
  IEnumAAFKLVData		*klvEnum = NULL;
  IAAFKLVData			*pKLVData = NULL;
  IAAFTypeDef*			pBaseType = NULL;
  IAAFSourceClip		*pSourceClip = NULL;
  IAAFSourceReference	*pSourceRef = NULL;
  IAAFSegment			*pSegment = NULL;
  aafMobID_t			sourceID;
  int 					i;


  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));
	  checkResult(pHeader->GetDictionary(&pDictionary));
 	  CAAFBuiltinDefs defs (pDictionary);


	  checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
	  checkExpression(1 == numMobs, AAFRESULT_TEST_FAILED);


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

	  for(n = 0; n < numMobs; n++)
		{
		  aafWChar		name[500], slotName[500];
		  aafNumSlots_t	numSlots;
		  aafMobID_t		mobID;
		  aafSlotID_t		trackID;
		  aafUInt32 nameBufLen = 0;

		  checkResult(mobIter->NextOne (&aMob));
      
	      // Check GetNameBufLen and GetName
	      checkExpression(aMob->GetNameBufLen(NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
	      checkResult(aMob->GetNameBufLen(&nameBufLen));
	      checkExpression(((wcslen(mobName) + 1) * sizeof(aafCharacter)) == nameBufLen, AAFRESULT_TEST_FAILED);
		  checkExpression(aMob->GetName (NULL, nameBufLen) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
		  checkExpression(aMob->GetName (name, 4) == AAFRESULT_SMALLBUF, AAFRESULT_TEST_FAILED);
		  checkResult(aMob->GetName (name, nameBufLen));
		  checkExpression (wcscmp(mobName, name) == 0, AAFRESULT_TEST_FAILED);

	      // Check GetMobID
		  checkExpression(aMob->GetMobID (NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
		  checkResult(aMob->GetMobID (&mobID));
		  checkExpression(memcmp(&MOBTestID, &mobID, sizeof(mobID)) == 0, AAFRESULT_TEST_FAILED);

		  // Check the time stamps
		  aafTimeStamp_t created = { {0,0,0}, {0,0,0,0} };
		  checkExpression(aMob->GetCreateTime(NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
		  checkResult(aMob->GetCreateTime(&created));
		  checkTimeStampsAreEqual(creationTimeStamp, created);
		  aafTimeStamp_t modified = { {0,0,0}, {0,0,0,0} };
		  checkExpression(aMob->GetModTime(NULL) == AAFRESULT_NULL_PARAM, AAFRESULT_TEST_FAILED);
		  checkResult(aMob->GetModTime(&modified));
		  checkTimeStampsAreEqual(modificationTimeStamp, modified);

	      // Check the GetMobInfo data.
	      memset(&created, 0, sizeof(created));
	      memset(&modified, 0, sizeof(modified));
	      checkExpression(aMob->GetMobInfo(NULL, &created, 
      								   name, sizeof(name)) == AAFRESULT_NULL_PARAM,
      														  AAFRESULT_TEST_FAILED);
	      checkExpression(aMob->GetMobInfo(&modified, NULL, 
      								   name, sizeof(name)) == AAFRESULT_NULL_PARAM,
      														  AAFRESULT_TEST_FAILED);
	      checkExpression(aMob->GetMobInfo(&modified, &created, 
      								   NULL, sizeof(name)) == AAFRESULT_NULL_PARAM,
      														  AAFRESULT_TEST_FAILED);
		  checkExpression(aMob->GetMobInfo(&modified, &created, 
      								   name, 1) == AAFRESULT_SMALLBUF,
      												AAFRESULT_TEST_FAILED);
	      checkResult(aMob->GetMobInfo(&modified, &created, name, sizeof(name)));
		  checkTimeStampsAreEqual(creationTimeStamp, created);
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CAAFMobTest.cpp

示例11: ReadAAFFile

static HRESULT ReadAAFFile(aafWChar * pFileName)
{
	IAAFFile				*pFile = NULL;
	bool					bFileOpen = false;
	IAAFHeader				*pHeader = NULL;
	IEnumAAFMobs			*mobIter = NULL;
	IAAFMob					*aMob = NULL;
	IEnumAAFMobSlots		*slotIter = NULL;
	IAAFMobSlot				*slot = NULL;
	IAAFSegment				*pSeg = NULL;
	IAAFSourceClip			*pSourceClip = NULL;
	IAAFDataDef *            pDataDef = 0;
	IAAFDefObject *          pDefObj = 0;
	aafNumSlots_t			numMobs, n;
	aafSlotID_t				s;
	aafUInt32				length;
	HRESULT					hr = S_OK;
	aafUID_t				readUID, typeUID = kAAFDataDef_Picture;
	
	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));
		
		
		checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
		checkExpression(1 == numMobs, AAFRESULT_TEST_FAILED);
		
		
		aafSearchCrit_t		criteria;
		criteria.searchTag = kAAFNoSearch;
		checkResult(pHeader->GetMobs (&criteria, &mobIter));
		
		for(n = 0; n < numMobs; n++)
		{
			aafWChar		name[500], slotName[500];
			aafNumSlots_t	numSlots;
			aafMobID_t		mobID;
			aafSlotID_t		trackID;
			
			checkResult(mobIter->NextOne (&aMob));
			checkResult(aMob->GetName (name, sizeof(name)));
			checkResult(aMob->GetMobID (&mobID));
			
			checkResult(aMob->CountSlots (&numSlots));
			checkExpression(5 == numSlots, AAFRESULT_TEST_FAILED);
			
			checkResult(aMob->GetSlots(&slotIter));
			
			for(s = 0; s < (aafSlotID_t)numSlots; s++)
			{
				checkResult(slotIter->NextOne (&slot));
				checkResult(slot->GetNameBufLen(&length));
				checkResult(slot->GetName (slotName, length));
				checkExpression (wcscmp(slotName, slotNames[s]) == 0, AAFRESULT_TEST_FAILED);
				checkResult(slot->GetSlotID(&trackID));
				checkExpression (trackID == s+1, AAFRESULT_TEST_FAILED);
				checkResult(slot->GetPhysicalNum(&trackID));
				checkExpression (trackID == s+2, AAFRESULT_TEST_FAILED);
				checkResult(slot->GetPhysicalNum(&trackID));
				checkResult(slot->GetDataDef(&pDataDef));
				checkResult(pDataDef->QueryInterface (IID_IAAFDefObject, (void **)&pDefObj));
				checkResult(pDefObj->GetAUID(&readUID));
				checkExpression (memcmp(&typeUID, &readUID, sizeof(typeUID)) == 0, AAFRESULT_TEST_FAILED);
				checkResult(slot->GetSegment(&pSeg));
				checkResult(pSeg->QueryInterface (IID_IAAFSourceClip, (void **)&pSourceClip));
				pDataDef->Release();
				pDataDef = 0;
				pDefObj->Release ();
				pDefObj = 0;
				pSourceClip->Release();
				pSourceClip = NULL;
				pSeg->Release();
				pSeg = NULL;
				slot->Release();
				slot = NULL;
			}
			
			aMob->Release();
			aMob = NULL;
		}
	}
	catch (HRESULT& rResult)
	{
		hr = rResult;
	}
	
	// Cleanup object references
	if (slot)
	  {
		slot->Release();
		slot = 0;
	  }
	
	if (pSeg)
	  {
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CAAFMobSlotTest.cpp

示例12: ReadAAFFile

static HRESULT ReadAAFFile(aafWChar * pFileName)
{
	IAAFFile			*pFile = NULL;
	bool				bFileOpen = false;
	IAAFHeader			*pHeader = NULL;
	IEnumAAFMobs		*mobIter = NULL;
	IAAFMob				*aMob = NULL;
	IEnumAAFMobSlots	*slotIter = NULL;
	IAAFMobSlot			*slot = NULL;
	aafNumSlots_t		numMobs, n, s;
	HRESULT				hr = S_OK;
	IAAFMobSlot*		pArray[2] = { NULL, NULL };
	IAAFMobSlot**		pArrayDef = pArray;
	aafUInt32			resultCount;
	IEnumAAFMobSlots	*slotClone = NULL;
	
	
	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));
		
		
		checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
		checkExpression(1 == numMobs, AAFRESULT_TEST_FAILED);
		
		
		aafSearchCrit_t		criteria;
		criteria.searchTag = kAAFNoSearch;
		checkResult(pHeader->GetMobs (&criteria, &mobIter));
		
		for(n = 0; n < numMobs; n++)
		{
			aafWChar		name[500], slotName[500];
			aafNumSlots_t	numSlots;
			aafMobID_t		mobID;
			aafSlotID_t		trackID;
			
			checkResult(mobIter->NextOne (&aMob));
			checkResult(aMob->GetName (name, sizeof(name)));
			checkResult(aMob->GetMobID (&mobID));
			
			checkResult(aMob->CountSlots (&numSlots));
			checkExpression(5 == numSlots, AAFRESULT_TEST_FAILED);
			
			checkResult(aMob->GetSlots(&slotIter));
			
			/* Read and check all elements using NextOne */
			for(s = 0; s < numSlots; s++)
			{
				checkResult(slotIter->NextOne (&slot));
				checkResult(slot->GetName (slotName, sizeof(slotName)));
				checkResult(slot->GetSlotID(&trackID));
				checkExpression (wcscmp(slotName, slotNames[s]) == 0, AAFRESULT_TEST_FAILED);
				
				slot->Release();
				slot = NULL;
			}
			/* Read one past to make sure that it fails */
			checkExpression(slotIter->NextOne(&slot) != AAFRESULT_SUCCESS, AAFRESULT_TEST_FAILED);
			/* Reset, and check the first element again*/
			checkResult(slotIter->Reset());
			checkResult(slotIter->NextOne (&slot));
			checkResult(slot->GetName (slotName, sizeof(slotName)));
			checkResult(slot->GetSlotID(&trackID));
			checkExpression (wcscmp(slotName, slotNames[0]) == 0, AAFRESULT_TEST_FAILED);
			slot->Release();
			slot = NULL;
			/* Reset, Skip, and check the second element again*/
			checkResult(slotIter->Reset());
			checkResult(slotIter->Skip(1));
			checkResult(slotIter->NextOne (&slot));
			checkResult(slot->GetName (slotName, sizeof(slotName)));
			checkResult(slot->GetSlotID(&trackID));
			checkExpression (wcscmp(slotName, slotNames[1]) == 0, AAFRESULT_TEST_FAILED);
			slot->Release();
			slot = NULL;
			
			/* Reset, and read both elements */
			checkResult(slotIter->Reset());
			checkResult(slotIter->Next (2, (IAAFMobSlot **)&pArray, &resultCount));
			checkExpression (resultCount == 2, AAFRESULT_TEST_FAILED);
			checkResult(pArrayDef[0]->GetName (slotName, sizeof(slotName)));
			checkResult(pArrayDef[0]->GetSlotID(&trackID));
			checkExpression (wcscmp(slotName, slotNames[0]) == 0, AAFRESULT_TEST_FAILED);
			checkResult(pArrayDef[1]->GetName (slotName, sizeof(slotName)));
			checkResult(pArrayDef[1]->GetSlotID(&trackID));
			checkExpression (wcscmp(slotName, slotNames[1]) == 0, AAFRESULT_TEST_FAILED);
			pArrayDef[0]->Release();
			pArrayDef[0] = NULL;
			pArrayDef[1]->Release();
			pArrayDef[1] = NULL;

			/* Clone the enumerator, and read one element */
			checkResult(slotIter->Clone(&slotClone));
			checkResult(slotClone->Reset());
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CEnumAAFMobSlotsTest.cpp

示例13: ReadAAFFile

static HRESULT ReadAAFFile(aafWChar * pFileName)
{
	IAAFFile *					pFile = NULL;
	bool bFileOpen = false;
	IAAFHeader *				pHeader = NULL;
	IEnumAAFMobs *mobIter = NULL;
	IAAFMob			*aMob = NULL;
	IEnumAAFMobSlots	*slotIter = NULL;
	IEnumAAFTaggedValues* pCommentIterator = NULL;
	IAAFTaggedValue*		pComment = NULL;

	IAAFMobSlot		*slot = NULL;
	aafNumSlots_t	numMobs, n, slt;
	aafUInt32		numComments, bytesRead, com;
	HRESULT						hr = S_OK;
	aafWChar		tag[64];
	aafWChar		Value[64];
	aafSearchCrit_t	criteria;

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

		criteria.searchTag = kAAFByMobKind;
		criteria.tags.mobKind = kAAFCompMob;


		checkResult(pHeader->CountMobs(kAAFCompMob, &numMobs));
		checkExpression(1 == numMobs, AAFRESULT_TEST_FAILED);


		checkResult(pHeader->GetMobs (&criteria, &mobIter));

		for(n = 0; n < numMobs; n++)
		{
			aafWChar		name[500], slotName[500];
			aafNumSlots_t	numSlots;
			aafMobID_t		mobID;
			aafSlotID_t		trackID;

			checkResult(mobIter->NextOne (&aMob));
			checkResult(aMob->GetName (name, sizeof(name)));
			checkResult(aMob->GetMobID (&mobID));

			// Check for comments
			checkResult(aMob->CountComments(&numComments));
			checkExpression(1 == numComments, AAFRESULT_TEST_FAILED);
			checkResult(aMob->GetComments(&pCommentIterator));
			for(com = 0; com < numComments; com++)
			{
				checkResult(pCommentIterator->NextOne(&pComment));
				checkResult(pComment->GetName(tag, sizeof(tag)));
				checkResult(pComment->GetValue( sizeof(Value), (unsigned char *)Value, &bytesRead));
				checkExpression(wcscmp(tag, TagNames)== 0, AAFRESULT_TEST_FAILED);
				checkExpression(wcscmp(Value, AltComment)== 0, AAFRESULT_TEST_FAILED);
				pComment->Release();
			}
			pCommentIterator->Release();
			
			checkResult(aMob->CountSlots (&numSlots));
			checkExpression(5 == numSlots, AAFRESULT_TEST_FAILED);

			checkResult(aMob->GetSlots(&slotIter));

			for(slt = 0; slt < numSlots; slt++)
			{
				checkResult(slotIter->NextOne (&slot));
				checkResult(slot->GetName (slotName, sizeof(slotName)));
				checkResult(slot->GetSlotID(&trackID));
				checkExpression (wcscmp(slotName, slotNames[slt]) == 0, AAFRESULT_TEST_FAILED);

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

			aMob->Release();
			aMob = NULL;
		}
	}
	catch (HRESULT& rResult)
	{
    hr = rResult;
	}

	// Cleanup object references
  if (slot)
    slot->Release();

  if (slotIter)
    slotIter->Release();

  if (aMob)
    aMob->Release();

  if (mobIter)
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CAAFTaggedValueTest.cpp

示例14: ReadAAFFile

static HRESULT ReadAAFFile(aafWChar * pFileName)
{
	IAAFFile *					pFile = NULL;
	IAAFHeader *				pHeader = NULL;
	IAAFSourceMob*				pSourceMob = NULL;
	IAAFMob*					pMob = NULL;
	IAAFEssenceDescriptor*		pEssDesc = NULL;
	IAAFBWFImportDescriptor*	pBWFImportDesc = NULL;
	IEnumAAFRIFFChunks*		pEnum = NULL;
	IAAFRIFFChunk*				pRIFFChunk = NULL;
	IEnumAAFMobs*				pMobIter = NULL;
	aafUInt32		numData, bytesRead, com, testID;
	aafLength_t 				testLength, testRIFFLen;
	aafPosition_t				dataPos;
	aafNumSlots_t				numMobs;
	char			Value[sizeof(RIFFChunksmiley)];
	char			Value2[sizeof(RIFFChunkfrowney)];
	HRESULT						hr = AAFRESULT_SUCCESS;

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

		checkResult( pFile->GetHeader(&pHeader));

		checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
		if (1 == numMobs )
		{
			checkResult(pHeader->GetMobs(NULL, &pMobIter));
			checkResult(pMobIter->NextOne(&pMob));
			checkResult(pMob->QueryInterface(IID_IAAFSourceMob, (void **)&pSourceMob));
			
			// Back into testing mode
			checkResult(pSourceMob->GetEssenceDescriptor(&pEssDesc));
			checkResult( pEssDesc->QueryInterface( IID_IAAFBWFImportDescriptor, (void**)&pBWFImportDesc ));	 
			checkResult(pBWFImportDesc->CountUnknownBWFChunks(&numData));
			
			checkExpression(1 == numData, AAFRESULT_TEST_FAILED);
			
			checkResult(pBWFImportDesc->GetUnknownBWFChunks(&pEnum));
			
			for(com = 0; com < numData; com++)
			{	
				checkResult(pEnum->NextOne(&pRIFFChunk));
				
				checkResult(pRIFFChunk->GetLength(&testRIFFLen));
				checkExpression((sizeof(RIFFChunksmiley)+sizeof(RIFFChunkfrowney)) == testRIFFLen, AAFRESULT_TEST_FAILED);
				checkResult(pRIFFChunk->Read( sizeof(Value), (unsigned char *)Value, &bytesRead));
				checkExpression(memcmp(Value, RIFFChunksmiley, sizeof(RIFFChunksmiley)) == 0, AAFRESULT_TEST_FAILED);
				checkResult(pRIFFChunk->Read( sizeof(Value2), (unsigned char *)Value2, &bytesRead));
				checkExpression(memcmp(Value2, RIFFChunkfrowney, sizeof(RIFFChunkfrowney)) == 0, AAFRESULT_TEST_FAILED);				
				
				checkResult(pRIFFChunk->GetPosition(&dataPos));
				checkExpression(dataPos==(sizeof(RIFFChunksmiley)+sizeof(RIFFChunkfrowney)), AAFRESULT_TEST_FAILED);
				checkResult(pRIFFChunk->SetPosition(0));
				checkResult(pRIFFChunk->Read( sizeof(Value), (unsigned char *)Value, &bytesRead));
				checkExpression(memcmp(Value, RIFFChunksmiley, sizeof(RIFFChunksmiley)) == 0, AAFRESULT_TEST_FAILED);
				
				pRIFFChunk->GetChunkID(&testID);	
				checkExpression(testID==chunkID, AAFRESULT_TEST_FAILED);
				pRIFFChunk->GetLength(&testLength);	
				checkExpression(testLength == sizeof(RIFFChunksmiley) + sizeof(RIFFChunkfrowney), AAFRESULT_TEST_FAILED);
				pRIFFChunk->Release();
				pRIFFChunk = NULL;
			}
			
			pEnum->Release();
			pEnum = NULL;
			pEssDesc->Release();
			pEssDesc = NULL;
								
			pBWFImportDesc->Release();
			pBWFImportDesc = NULL;

			pSourceMob->Release();
			pSourceMob = NULL;
				
			pMobIter->Release();
			pMobIter = NULL;
	
			
		}
		pMob->Release();
		pMob = NULL;
		
		pHeader->Release();
		pHeader = NULL;
		
		pFile->Close();
    	pFile->Release();
		pFile = NULL;

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

示例15: extensionRead

bool extensionRead (const aafCharacter * filename)
{
  assert (filename);

  IAAFFile *pFile=NULL;
  IAAFHeader *pHead=NULL;
  IAAFDictionary *pDict=NULL;
  IEnumAAFMobs*	pMobIter = NULL;
  IAAFMob *pMob=NULL;
	IAAFObject *pObject=NULL;
	IAAFClassDef *pMobCD=NULL;
	IAAFObject *personnelResource=NULL;
  aafCharacter *givenName=NULL;
  aafCharacter *familyName=NULL;
  aafCharacter *actorRole=NULL;


  try 
  {
    cout << "***Reading file " << filename << "***" << endl;

    check (AAFFileOpenExistingRead ((aafCharacter*) filename,
								    0,
								    &pFile));
  
    check (pFile->GetHeader(&pHead));
    check (pHead->GetDictionary(&pDict));

    VerifyResourceClassExtensions(pDict);

    cout << "Verifying AdminMob instance has been created and added" 
	       << " to header." << endl;
    // Need to find AdminMob, temp iterate through Mobs to find one.
    bool foundAdmin=false;
    check(pHead->GetMobs(NULL, &pMobIter));
    while(!foundAdmin && (AAFRESULT_SUCCESS == pMobIter->NextOne(&pMob)))
    {
	    //Check if Mob is a Admin Mob
	    check(pMob->QueryInterface(IID_IAAFObject,(void **)&pObject));
	    check (pObject->GetDefinition(&pMobCD));
	    pObject->Release();
	    pObject=NULL;
	    if (classDefinitionIsA(pMobCD, kClassID_AdminMob))
	    {
		    foundAdmin = true;
	    } else
	    {
		    // will need to release pMob when it is not the right mob
		    pMob->Release();
		    pMob=NULL;
	    }
 	    pMobCD->Release();
	    pMobCD=NULL;
    }


    if (foundAdmin) 
    {
	    cout << "Printing contents of Admin Mob." << endl;
	    aafUInt32 numPersonnel;
	    AdminMobGetNumPersonnel(pDict, pMob, &numPersonnel);
      cout << "There are " << numPersonnel
           << " personnel record objects." << endl;

      // Print each element in the array.
      aafUInt32 i;
      for (i = 0; i < numPersonnel; i++)
	    {
		    AdminMobGetNthPersonnel(pDict, pMob, i,
							     &personnelResource);
		    aafUInt32 bufferLen,numChars;
		    PersonnelResourceGetGivenNameBufLen (personnelResource, &bufferLen);
		    numChars = bufferLen/sizeof(aafCharacter);

		    givenName = new aafCharacter [numChars+1];
		    PersonnelResourceGetGivenName (personnelResource,
										    givenName,
										    bufferLen+2);
        cout << "Given Name:     " << givenName << endl;
		    delete[] givenName;
        givenName = NULL;

		    PersonnelResourceGetFamilyNameBufLen (personnelResource, &bufferLen);
		    numChars = bufferLen/sizeof(aafCharacter);


		    familyName = new aafCharacter [numChars];
		    PersonnelResourceGetFamilyName (personnelResource,
										    familyName,
										    bufferLen);
        cout << "Family Name:    " << familyName << endl;
		    delete[] familyName;
        familyName = NULL;

		    ePosition position;
		    PersonnelResourceGetPosition (personnelResource,
							   &position);
		    cout << "Position:       ";
		    PrintPosition (pDict, position);
		    cout << endl;
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:aaf,代码行数:101,代码来源:extensionRead.cpp


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