コード例 #1
0
void EnumEssenceDataTest::openEssenceData()
{
  assert(_pFile && _pHeader);
  assert(NULL == _pEnumEssenceData);
  assert(NULL == _pEssenceData);
  assert(NULL == _pSourceMob);

  aafUInt32 essenceDataCount = 0;
  check(_pHeader->CountEssenceData(&essenceDataCount));
  if (_maxMobCount != essenceDataCount)
    check(AAFRESULT_TEST_FAILED);
 
  check(_pHeader->EnumEssenceData(&_pEnumEssenceData));
  for (aafUInt32 item = 0; item < essenceDataCount; ++item)
  {
    check(_pEnumEssenceData->NextOne(&_pEssenceData));

    // Make sure that the essence data still references
    // a valid mob.
    check(_pEssenceData->GetFileMob(&_pSourceMob));

    _pSourceMob->Release();
    _pSourceMob = NULL;

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


  _pEnumEssenceData->Release();
  _pEnumEssenceData = NULL;
}
コード例 #2
0
ファイル: CAAFEssenceDataTest.cpp プロジェクト: mcanthony/aaf
void EssenceDataTest::openEssenceData()
{
  assert(_pFile && _pHeader);
  assert(NULL == _pEnumEssenceData);
  assert(NULL == _pEssenceData);
  assert(NULL == _pSourceMob);

  
  check(_pHeader->EnumEssenceData(&_pEnumEssenceData));
  IAAFEssenceData* pNextEssenceData = NULL;
  while (AAFRESULT_SUCCESS == (_hr = _pEnumEssenceData->NextOne(&pNextEssenceData)))
  {
    IAAFEssenceData2* pEssenceData2 = NULL;
    check(pNextEssenceData->QueryInterface(IID_IAAFEssenceData2, (void**)&pEssenceData2));
    check(pEssenceData2->GetPlainEssenceData(0, &_pEssenceData));

    // Validate essence element key
    IAAFKLVEssenceDataParameters* pParameters = NULL;
    check(_pEssenceData->QueryInterface(IID_IAAFKLVEssenceDataParameters, (void **)&pParameters));
    aafUID_t key;
    AAFRESULT hr = pParameters->GetEssenceElementKey(&key);
    checkExpression(AAFRESULT_SUCCEEDED(hr) || hr == AAFRESULT_OPERATION_NOT_PERMITTED,
                    AAFRESULT_TEST_FAILED);
    checkExpression(AAFRESULT_FAILED(hr) || key == _essenceElementKey,
                    AAFRESULT_TEST_FAILED);

    // Validate the essence.
    // Validate the current essence size.
    aafLength_t essenceSize = 0;
    aafLength_t expectedEssenceSize = sizeof(_smiley) + sizeof(_frowney);
    check(_pEssenceData->GetSize(&essenceSize));
    checkExpression(essenceSize == expectedEssenceSize, AAFRESULT_TEST_FAILED);

    // Validate that the correct data can be read back.
    readEssenceData(_pEssenceData, (aafDataBuffer_t)_smiley, sizeof(_smiley));
    readEssenceData(_pEssenceData, (aafDataBuffer_t)_frowney, sizeof(_frowney));

    // Make sure that the essence data still references
    // a valid mob.
    check(_pEssenceData->GetFileMob(&_pSourceMob));

    _pSourceMob->Release();
    _pSourceMob = NULL;

    pParameters->Release();
    pParameters = NULL;

    _pEssenceData->Release();
    _pEssenceData = NULL;

    pEssenceData2->Release();
    pEssenceData2 = NULL;

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

  // It is ok to run out of objects.
  checkExpression (AAFRESULT_NO_MORE_OBJECTS == _hr, _hr);
  _hr = AAFRESULT_SUCCESS;

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