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


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

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


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

示例1: CAAFCachePageAllocator_test

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

  (void)RemoveTestFile(pFileName );

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

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

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

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


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