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


C++ IAAFHeader::CountMobs方法代码示例

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


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

示例1: ReadAAFFile

static HRESULT ReadAAFFile(aafWChar * pFileName)
{
    // IAAFSession *				pSession = NULL;
    IAAFFile *					pFile = NULL;
    IAAFHeader *				pHeader = NULL;
    IEnumAAFMobs *mobIter = NULL;
    IAAFMob			*aMob = NULL;
    IAAFEssenceDescriptor		*pEdesc = NULL;
    IAAFSourceMob				*pSourceMob = NULL;
    IEnumAAFLocators *			pEnum = NULL;
    IEnumAAFLocators *			pCloneEnum = NULL;
    IAAFLocator	*				pLocator = NULL;
    aafUInt32					numLocators;
    aafNumSlots_t	numMobs, n;
    HRESULT						hr = AAFRESULT_SUCCESS;
    bool bFileOpen = false;
    wchar_t						testname[256];
    IAAFLocator				*	pArray[2] = { NULL, NULL };
    IAAFLocator				**	pArrayPoint = pArray;
    aafUInt32			resultCount;


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

        checkResult(pHeader->GetMobs (NULL, &mobIter));
        for(n = 0; n < numMobs; n++)
        {
            aafWChar		name[500];
            aafMobID_t		mobID;

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

            checkResult(aMob->QueryInterface (IID_IAAFSourceMob, (void **)&pSourceMob));
            checkResult(pSourceMob->GetEssenceDescriptor (&pEdesc));

            // Verify that there is now two locators
            checkResult(pEdesc->CountLocators(&numLocators));
          checkExpression(2 == numLocators, AAFRESULT_TEST_FAILED);
        
            checkResult(pEdesc->GetLocators(&pEnum));

            /* Read and check the first element */
            checkResult(pEnum->NextOne(&pLocator));
            checkResult(pLocator->GetPath (testname, sizeof(testname)));
            checkExpression(wcscmp(testname, locator1) == 0, AAFRESULT_TEST_FAILED);
            pLocator->Release();
            pLocator = NULL;

            /**/
            /* Read and check the second element */
            checkResult(pEnum->NextOne(&pLocator));
            checkResult(pLocator->GetPath (testname, sizeof(testname)));
            checkExpression(wcscmp(testname, locator2) == 0, AAFRESULT_TEST_FAILED);
            pLocator->Release();
            pLocator = NULL;
            /*****/
            
            /* Reset, and check the first element again*/
            checkResult(pEnum->Reset());
            checkResult(pEnum->NextOne(&pLocator));
            checkResult(pLocator->GetPath (testname, sizeof(testname)));
            checkExpression(wcscmp(testname, locator1) == 0, AAFRESULT_TEST_FAILED);
            pLocator->Release();
            pLocator = NULL;
            
            /* Reset, Skip, and check the second element again*/
            checkResult(pEnum->Reset());
            checkResult(pEnum->Skip(1));
            checkResult(pEnum->NextOne(&pLocator));
            checkResult(pLocator->GetPath (testname, sizeof(testname)));
            checkExpression(wcscmp(testname, locator2) == 0, AAFRESULT_TEST_FAILED);
            pLocator->Release();
            pLocator = NULL;

            /* Reset, and read both elements */
            checkResult(pEnum->Reset());
            checkResult(pEnum->Next (2, (IAAFLocator **)&pArray, &resultCount));
            checkExpression (resultCount == 2, AAFRESULT_TEST_FAILED);
            checkResult(pArrayPoint[0]->GetPath (testname, sizeof(testname)));
            checkExpression(wcscmp(testname, locator1) == 0, AAFRESULT_TEST_FAILED);
            pArrayPoint[0]->Release();
            pArrayPoint[0] = NULL;
            
            checkResult(pArrayPoint[1]->GetPath (testname, sizeof(testname)));
            checkExpression(wcscmp(testname, locator2) == 0, AAFRESULT_TEST_FAILED);
            pArrayPoint[1]->Release();
            pArrayPoint[1] = NULL;
            
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CEnumAAFLocatorsTest.cpp

示例2: ReadAAFFile

static HRESULT ReadAAFFile(aafWChar * pFileName)
{
    IAAFFile*				pFile = NULL;
    IAAFHeader*				pHeader = NULL;
    IEnumAAFMobs*			pMobIter = NULL;
    IAAFMob*				pMob = NULL;
    IAAFSourceMob*			pSourceMob = NULL;
    IAAFEssenceDescriptor*	pEssDesc = NULL;
    IAAFTIFFDescriptor*		pTIFFDesc = NULL;
    aafNumSlots_t			numMobs = 0;
    HRESULT					hr = AAFRESULT_SUCCESS;
    aafBool					isContiguous, isUniform;
    aafInt32				leadingLines, trailingLines;
    aafUInt32				size;
    aafUInt8				summary[512];

    try
    {
        // 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));
        
        checkResult(pEssDesc->QueryInterface(IID_IAAFTIFFDescriptor, (void **)&pTIFFDesc));
        checkResult(pTIFFDesc->GetIsContiguous(&isContiguous));
        checkResult(pTIFFDesc->GetIsUniform(&isUniform));
        checkResult(pTIFFDesc->GetLeadingLines(&leadingLines));
        checkResult(pTIFFDesc->GetTrailingLines(&trailingLines));
        checkResult(pTIFFDesc->GetSummaryBufferSize(&size));
        checkExpression(size == 34, AAFRESULT_TEST_FAILED);
        checkResult(pTIFFDesc->GetSummary(size, summary));
        checkExpression(isContiguous == kAAFTrue, AAFRESULT_TEST_FAILED);
        checkExpression(isUniform == kAAFFalse, AAFRESULT_TEST_FAILED);
        checkExpression(leadingLines == 10, AAFRESULT_TEST_FAILED);
        checkExpression(trailingLines == 20, AAFRESULT_TEST_FAILED);
// The next statement is not true when doing cross-platform tests
//#if defined( OS_WINDOWS )
//		checkExpression(memcmp(summary, "II", 2) == 0, AAFRESULT_TEST_FAILED);
//#else
//		checkExpression(memcmp(summary, "MM", 2) == 0, AAFRESULT_TEST_FAILED);
//#endif

    // NOTE: The elements in the summary structure need to be byte swapped
        //       on Big Endian system (i.e. the MAC).
    }
    catch (HRESULT& rResult)
    {
        hr = rResult;
    }
    
  
    // Cleanup and return
    if (pEssDesc)
        pEssDesc->Release();

    if (pTIFFDesc)
        pTIFFDesc->Release();

    if (pMob)
        pMob->Release();

    if (pSourceMob)
        pSourceMob->Release();

    if (pHeader)
        pHeader->Release();

    if (pMobIter)
        pMobIter->Release();

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

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

示例3: ReadAAFFile

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

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

        checkResult( pFile->GetHeader(&pHeader));
        // Get the AAF Dictionary so that we can create a fake RIFFChunk to test RemoveUnknownBWFChunks.
        checkResult(pHeader->GetDictionary(&pDictionary));
        CAAFBuiltinDefs defs (pDictionary);
        checkResult(defs.cdRIFFChunk()->CreateInstance(IID_IAAFRIFFChunk, 
                             (IUnknown **)&pRIFFChunkTest));
        
        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->GetFileSecurityReport(&testNum));
            checkExpression(testNum==TEST_FileSecurityReport, AAFRESULT_TEST_FAILED);
            checkResult(pBWFImportDesc->GetFileSecurityWave(&testNum));
            checkExpression(testNum==TEST_FileSecurityWave, AAFRESULT_TEST_FAILED);
            checkResult(pBWFImportDesc->GetCodingHistory(testString, sizeof(testString)));
            checkExpression(wcscmp(testString, TEST_CodingHistory) == 0, AAFRESULT_TEST_FAILED);
            checkResult(pBWFImportDesc->GetBasicData(testString, sizeof(testString)));
            checkExpression(wcscmp(testString, TEST_BasicData) == 0, AAFRESULT_TEST_FAILED);
            checkResult(pBWFImportDesc->GetStartOfModulation(testString, sizeof(testString)));
            checkExpression(wcscmp(testString, TEST_StartOfModulation) == 0, AAFRESULT_TEST_FAILED);
            checkResult(pBWFImportDesc->GetQualityEvent(testString, sizeof(testString)));
            checkExpression(wcscmp(testString, TEST_QualityEvent) == 0, AAFRESULT_TEST_FAILED);
            checkResult(pBWFImportDesc->GetEndOfModulation(testString, sizeof(testString)));
            checkExpression(wcscmp(testString, TEST_EndOfModulation) == 0, AAFRESULT_TEST_FAILED);
            checkResult(pBWFImportDesc->GetQualityParameter(testString, sizeof(testString)));	
            checkExpression(wcscmp(testString, TEST_QualityParameter) == 0, AAFRESULT_TEST_FAILED);
            checkResult(pBWFImportDesc->GetOperatorComment(testString, sizeof(testString)));
            checkExpression(wcscmp(testString, TEST_OperatorComment) == 0, AAFRESULT_TEST_FAILED);
            checkResult(pBWFImportDesc->GetCueSheet(testString, sizeof(testString)));
            checkExpression(wcscmp(testString, TEST_CueSheet) == 0, AAFRESULT_TEST_FAILED);
            
            checkResult(pBWFImportDesc->CountUnknownBWFChunks(&numData));
            checkExpression(2 == numData, AAFRESULT_TEST_FAILED);
            checkResult(pBWFImportDesc->GetUnknownBWFChunks(&pEnum));

            for(com = 0; com < numData; com++)
            {	
                checkResult(pEnum->NextOne(&pRIFFChunk));	
                pRIFFChunk->GetLength(&testRIFFLen);
                checkExpression(testRIFFLen!=chunkLength /*huh?*/, AAFRESULT_TEST_FAILED);
                checkResult(pRIFFChunk->GetLength(&testRIFFLen));
                pRIFFChunk->GetChunkID(&testNum);
                
                if (testNum==1){
                    checkExpression(sizeof(RIFFChunksmiley) == testRIFFLen, AAFRESULT_TEST_FAILED);
                    checkResult(pRIFFChunk->Read( sizeof(Value), (unsigned char *)Value, &bytesRead));
                    checkExpression(memcmp(Value, RIFFChunksmiley, sizeof(RIFFChunksmiley)) == 0, AAFRESULT_TEST_FAILED);						
                }
                else if (testNum==2){
                    checkExpression(sizeof(RIFFChunkfrowney) == testRIFFLen, AAFRESULT_TEST_FAILED);
                    checkResult(pRIFFChunk->Read( sizeof(Value2), (unsigned char *)Value2, &bytesRead));
                    checkExpression(memcmp(Value2, RIFFChunkfrowney, sizeof(RIFFChunkfrowney)) == 0, AAFRESULT_TEST_FAILED);
                }
                pRIFFChunk->Release();
                pRIFFChunk = NULL;
                
            }
            checkResult(pEnum->Reset());
          	checkResult(pEnum->NextOne(&pRIFFChunk));
            checkExpression((pBWFImportDesc->RemoveUnknownBWFChunkAt(2))==AAFRESULT_BADINDEX, AAFRESULT_TEST_FAILED);
            checkResult(pBWFImportDesc->RemoveUnknownBWFChunkAt(0));
            checkResult(pBWFImportDesc->CountUnknownBWFChunks(&numData));
            checkExpression(1 == numData, AAFRESULT_TEST_FAILED);
        
            pRIFFChunk->Release();
            pRIFFChunk = NULL;
            pEnum->Release();
            pEnum = NULL;
            pBWFImportDesc->Release();
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CAAFBWFImportDescriptorTest.cpp

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

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

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

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

示例8: 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;
    IAAFSequence			*pSequence = NULL;
    HRESULT						hr = S_OK;


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


    // Create the file.
        checkResult(CreateTestFile( pFileName, fileKind, rawStorageType, productID, &pFile ));
      bFileOpen = true;
  
      // We can't really do anthing in AAF without the header.
      checkResult(pFile->GetHeader(&pHeader));

      // Get the number of mobs to force creation of the content storage.
      // This is temporary as the content storage should be created by
      // the call to OpenNewModify above.
      aafNumSlots_t n;
      checkResult(pHeader->CountMobs(kAAFAllMob, &n));

      // Get the AAF Dictionary so that we can create valid AAF objects.
      checkResult(pHeader->GetDictionary(&pDictionary));
 
      // Create a sequence withou attaching it to the file.
      checkResult(CreateAAFSequence(pDictionary, &pSequence));
    
      // Test the enumeration methods.
      checkResult(TestEnumerator(pSequence));
    }
    catch (HRESULT& rResult)
    {
      hr = rResult;
    }


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

    if (pDictionary)
      pDictionary->Release();

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

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

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

示例10: CreateAAFFile


//.........这里部分代码省略.........
            taggedVal = NULL;
        }		

        enumTaggedVal->Release();
        enumTaggedVal = NULL;
        

  	  // Check the Mob2 attribute and usage code implementations.
 	  // Need IAAFMob2 for that;
     checkResult( pMobInterface2->AppendAttribute( AttributeNames[0], AttributeValues[0] ) );
     checkResult( pMobInterface2->AppendAttribute( AttributeNames[1], AttributeValues[1] ) );
     checkResult( pMobInterface2->SetUsageCode( kAAFUsage_SubClip ) );

      // Add the mob to the file.
      checkResult(pHeader->AddMob(pMob));

      // Test changing the mob id after the mob is attached to the
      // content store.  Change it, then reset to the original id.
      checkResult(pMob->SetMobID(MOBTestID2));
      checkResult(pMob->SetMobID(MOBTestID));
      
      // Create another Mob, check mob count, then delete and recheck count
      checkResult(defs.cdMasterMob()->
                  CreateInstance(IID_IAAFMob, 
                                 (IUnknown **)&pMob2));

      checkResult(pMob2->SetMobID(MOBTestID2));
      checkResult(pMob2->SetName(mobName));
      
      checkResult(pMob2->SetCreateTime(creationTimeStamp));
      checkResult(pMob2->SetModTime(modificationTimeStamp));
      // Add the mob to the file.
      checkResult(pHeader->AddMob(pMob2));
      checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
      checkExpression(numMobs == 2, AAFRESULT_TEST_FAILED);
      checkResult(pHeader->RemoveMob(pMob2));
      checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
      checkExpression(numMobs == 1, AAFRESULT_TEST_FAILED);

      //try Copy()
      const aafCharacter *copy_name = L"Name of Copied Mob";
      IAAFMobSP spCopiedMob;
      checkResult(pMob->Copy(copy_name, &spCopiedMob));
      checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
      checkExpression(numMobs == 2, AAFRESULT_TEST_FAILED);
      checkResult(pHeader->RemoveMob(spCopiedMob));
      checkResult(pHeader->CountMobs(kAAFAllMob, &numMobs));
      checkExpression(numMobs == 1, AAFRESULT_TEST_FAILED);

      //try CloneExternal
      IAAFMobSP spClonedMob;
      IAAFFileSP spDestFile;
      aafCharacter dest_filename[128];
      wcscpy(dest_filename, pFileName);
      wcscat(dest_filename, L"_clone");


      // Remove the previous test file if any.
      RemoveTestFile(dest_filename);
      checkResult(CreateTestFile( dest_filename, fileKind, rawStorageType, productID, &spDestFile ));
      checkResult(pMob->CloneExternal(kAAFNoFollowDepend, kAAFNoIncludeMedia, spDestFile, &spClonedMob));
      checkResult(spDestFile->Save());	  	
      checkResult(spDestFile->Close());	  	
    }
  catch (HRESULT& rResult)
    {
开发者ID:mcanthony,项目名称:aaf,代码行数:67,代码来源: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;
    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

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

示例13: 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;
    IAAFDescriptiveClip*				pDescClip = 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));
                checkResult(pSegment->QueryInterface(IID_IAAFDescriptiveClip, (void **) &pDescClip));
                
                // Get, and test, the described slots from the marker.
                aafUInt32 getDescribedSlotIDsVector[TestDescribedSlotIDsVectorSize];
                aafUInt32 getDescribedSlotIDsVectorSize = 0;
            
                checkResult( pDescClip->CountDescribedSlotIDs( &getDescribedSlotIDsVectorSize ) );
                checkExpression( TestDescribedSlotIDsVectorSize == getDescribedSlotIDsVectorSize, AAFRESULT_TEST_FAILED );
            
                checkExpression( AAFRESULT_SMALLBUF ==
                           pDescClip->GetDescribedSlotIDs( getDescribedSlotIDsVectorSize-1, getDescribedSlotIDsVector ),
                         AAFRESULT_TEST_FAILED );
            
                checkResult( pDescClip->GetDescribedSlotIDs( getDescribedSlotIDsVectorSize, getDescribedSlotIDsVector ) );
                checkExpression( 0 == memcmp( getDescribedSlotIDsVector, TestDescribedSlotIDsVector, sizeof(TestDescribedSlotIDsVector) ),
                         AAFRESULT_TEST_FAILED );
            
                
                
                pSlot->Release();
                pSlot = NULL;
            }

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

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

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

    if (pDescClip)
        pDescClip->Release();

    if (pSegment)
        pSegment->Release();

    if (pSlot)
        pSlot->Release();

    if (pSlotIter)
        pSlotIter->Release();

    if (pMob)
        pMob->Release();

    if (pMobIter)
        pMobIter->Release();

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

示例14: ReadAAFFile

static HRESULT ReadAAFFile(aafWChar * pFileName)
{
    // IAAFSession *				pSession = NULL;
    IAAFFile *					pFile = NULL;
    IAAFHeader *				pHeader = NULL;
    IAAFEssenceDescriptor		*pEdesc = NULL;
    IAAFSourceMob				*pSourceMob = NULL;
    IEnumAAFLocators *			pEnum = NULL;
    IAAFLocator	*				pLocator = NULL;
    IEnumAAFMobs *mobIter = NULL;
    IAAFMob			*aMob = NULL;
    aafUInt32					numLocators;
    aafUInt32					readLen;
    aafNumSlots_t	numMobs, n;
    HRESULT						hr = AAFRESULT_SUCCESS;
    aafWChar					readBuf[1024];
    bool bFileOpen = false;


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

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

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


    //!!!	aafSearchCrit_t		criteria;
    //!!!	criteria.searchTag = kAAFNoSearch;

        checkResult(pHeader->GetMobs (NULL, &mobIter));
        for(n = 0; n < numMobs; n++)
        {
            aafWChar		name[500];
            aafMobID_t		mobID;

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

            checkResult(aMob->QueryInterface (IID_IAAFSourceMob, (void **)&pSourceMob));
            checkResult(pSourceMob->GetEssenceDescriptor (&pEdesc));

            // Verify that there is now one locator
            checkResult(pEdesc->CountLocators(&numLocators));
            if (1 != numLocators)
                checkResult(AAFRESULT_TEST_FAILED);
        
            checkResult(pEdesc->GetLocators(&pEnum));

            // This should read the one real locator
            checkResult(pEnum->NextOne(&pLocator));

            checkResult(pLocator->GetPathBufLen (&readLen));
    //		if(readLen != strlen(TEST_PATH))
                
            checkResult(pLocator->GetPath (readBuf, readLen));

        // This should run off the end
            pLocator->Release();
            pLocator = NULL;
            hr = pEnum->NextOne(&pLocator);
            if (AAFRESULT_NO_MORE_OBJECTS != hr)
                checkResult(hr);
            else
                hr = AAFRESULT_SUCCESS; // reset result
        }


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

    
    // Cleanup...
    if (pLocator)
        pLocator->Release();

    if (pEnum)
        pEnum->Release();

    if (pEdesc)
        pEdesc->Release();

    if (pSourceMob)
        pSourceMob->Release();

    if (aMob)
        aMob->Release();

    if (mobIter)
        mobIter->Release();

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

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


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