コード例 #1
0
ファイル: ImplAAFSourceMob.cpp プロジェクト: mcanthony/aaf
//****************
// GetMobKind()
//
AAFRESULT STDMETHODCALLTYPE
    ImplAAFSourceMob::GetMobKind (aafMobKind_t *pMobKind)
{
	ImplAAFEssenceDescriptor	*edesc = NULL;
	
	if(pMobKind == NULL)
		return(AAFRESULT_NULL_PARAM);
	XPROTECT()
	{
		CHECK(GetEssenceDescriptor (&edesc));
		if(edesc != NULL)
		{
			CHECK(edesc->GetOwningMobKind(pMobKind));
			edesc->ReleaseReference();
			edesc = 0;
		}
		else
			*pMobKind = kAAFAllMob;
	}
	XEXCEPT
	{
		if(edesc != NULL)
		  edesc->ReleaseReference();
		edesc = 0;
	}
	XEND;

	return AAFRESULT_SUCCESS;
}
コード例 #2
0
ファイル: ImplAAFSourceMob.cpp プロジェクト: mcanthony/aaf
ImplAAFSourceMob::~ImplAAFSourceMob ()
{
	ImplAAFEssenceDescriptor *essenceDesc = _essenceDesc.clearValue();
	if (essenceDesc)
	{
	  essenceDesc->ReleaseReference();
	  essenceDesc = 0;
	}
}
コード例 #3
0
HRESULT STDMETHODCALLTYPE
    CAAFEssenceDescriptor::CountLocators (aafUInt32 *  pResult)
{
  HRESULT hr;

  ImplAAFEssenceDescriptor * ptr;
  ImplAAFRoot * pO;
  pO = GetRepObject ();
  assert (pO);
  ptr = static_cast<ImplAAFEssenceDescriptor*> (pO);
  assert (ptr);


  try
    {
      hr = ptr->CountLocators
       (pResult);
    }
  catch (OMException& e)
    {
      // OMExceptions should be handled by the impl code. However, if an
      // unhandled OMException occurs, control reaches here. We must not
      // allow the unhandled exception to reach the client code, so we
      // turn it into a failure status code.
      //
      // If the OMException contains an HRESULT, it is returned to the
      // client, if not, AAFRESULT_UHANDLED_EXCEPTION is returned.
      //
      hr = OMExceptionToResult(e, AAFRESULT_UNHANDLED_EXCEPTION);
    }
  catch (OMAssertionViolation &)
    {
      // Control reaches here if there is a programming error in the
      // impl code that was detected by an assertion violation.
      // We must not allow the assertion to reach the client code so
      // here we turn it into a failure status code.
      //
      hr = AAFRESULT_ASSERTION_VIOLATION;
    }
  catch (...)
    {
      // We CANNOT throw an exception out of a COM interface method!
      // Return a reasonable exception code.
      //
      hr = AAFRESULT_UNEXPECTED_EXCEPTION;
    }

  return hr;
}
コード例 #4
0
ファイル: ImplAAFSourceMob.cpp プロジェクト: mcanthony/aaf
//****************
// SetEssenceDescriptor()
//
AAFRESULT STDMETHODCALLTYPE
    ImplAAFSourceMob::SetEssenceDescriptor (ImplAAFEssenceDescriptor *pEdes)
{
	if (pEdes == NULL)
		return AAFRESULT_NULL_PARAM;

	if (pEdes->attached())
		return AAFRESULT_OBJECT_ALREADY_ATTACHED;

	ImplAAFEssenceDescriptor *pOldEdes = _essenceDesc.setValue(pEdes);

	if (pOldEdes)
	  pOldEdes->ReleaseReference();

	if (pEdes)
		pEdes->AcquireReference();

	return AAFRESULT_SUCCESS;
}
コード例 #5
0
HRESULT STDMETHODCALLTYPE
    CAAFEssenceDescriptor::GetLocators (IEnumAAFLocators ** ppEnum)
{
  HRESULT hr;

  ImplAAFEssenceDescriptor * ptr;
  ImplAAFRoot * pO;
  pO = GetRepObject ();
  assert (pO);
  ptr = static_cast<ImplAAFEssenceDescriptor*> (pO);
  assert (ptr);

  //
  // set up for ppEnum
  //
  ImplEnumAAFLocators * internalppEnum = NULL;
  ImplEnumAAFLocators ** pinternalppEnum = NULL;
  if (ppEnum)
    {
      pinternalppEnum = &internalppEnum;
    }

  try
    {
      hr = ptr->GetLocators
       (pinternalppEnum);
    }
  catch (OMException& e)
    {
      // OMExceptions should be handled by the impl code. However, if an
      // unhandled OMException occurs, control reaches here. We must not
      // allow the unhandled exception to reach the client code, so we
      // turn it into a failure status code.
      //
      // If the OMException contains an HRESULT, it is returned to the
      // client, if not, AAFRESULT_UHANDLED_EXCEPTION is returned.
      //
      hr = OMExceptionToResult(e, AAFRESULT_UNHANDLED_EXCEPTION);
    }
  catch (OMAssertionViolation &)
    {
      // Control reaches here if there is a programming error in the
      // impl code that was detected by an assertion violation.
      // We must not allow the assertion to reach the client code so
      // here we turn it into a failure status code.
      //
      hr = AAFRESULT_ASSERTION_VIOLATION;
    }
  catch (...)
    {
      // We CANNOT throw an exception out of a COM interface method!
      // Return a reasonable exception code.
      //
      hr = AAFRESULT_UNEXPECTED_EXCEPTION;
    }

  //
  // cleanup for ppEnum
  //
  if (SUCCEEDED(hr))
    {
      IUnknown *pUnknown;
      HRESULT hStat;

      if (internalppEnum)
        {
          pUnknown = static_cast<IUnknown *> (internalppEnum->GetContainer());
          hStat = pUnknown->QueryInterface(IID_IEnumAAFLocators, (void **)ppEnum);
          assert (SUCCEEDED (hStat));
          //pUnknown->Release();
          internalppEnum->ReleaseReference(); // We are through with this pointer.
        }
    }
  return hr;
}
コード例 #6
0
HRESULT STDMETHODCALLTYPE
    CAAFEssenceDescriptor::InsertLocatorAt (aafUInt32  index,
        IAAFLocator * pLocator)
{
  HRESULT hr;

  ImplAAFEssenceDescriptor * ptr;
  ImplAAFRoot * pO;
  pO = GetRepObject ();
  assert (pO);
  ptr = static_cast<ImplAAFEssenceDescriptor*> (pO);
  assert (ptr);

  //
  // set up for pLocator
  //
  ImplAAFLocator * internalpLocator = NULL;
  if (pLocator)
    {
      HRESULT hStat;
      IAAFRoot * iObj;
      ImplAAFRoot *arg;
      hStat = pLocator->QueryInterface (IID_IAAFRoot, (void **)&iObj);
      assert (SUCCEEDED (hStat));
      assert (iObj);
      hStat = iObj->GetImplRep((void **)&arg);
      assert (SUCCEEDED (hStat));
      iObj->Release(); // we are through with this interface pointer.
      internalpLocator = static_cast<ImplAAFLocator*>(arg);
      assert (internalpLocator);
    }

  try
    {
      hr = ptr->InsertLocatorAt
       (index,
        internalpLocator);
    }
  catch (OMException& e)
    {
      // OMExceptions should be handled by the impl code. However, if an
      // unhandled OMException occurs, control reaches here. We must not
      // allow the unhandled exception to reach the client code, so we
      // turn it into a failure status code.
      //
      // If the OMException contains an HRESULT, it is returned to the
      // client, if not, AAFRESULT_UHANDLED_EXCEPTION is returned.
      //
      hr = OMExceptionToResult(e, AAFRESULT_UNHANDLED_EXCEPTION);
    }
  catch (OMAssertionViolation &)
    {
      // Control reaches here if there is a programming error in the
      // impl code that was detected by an assertion violation.
      // We must not allow the assertion to reach the client code so
      // here we turn it into a failure status code.
      //
      hr = AAFRESULT_ASSERTION_VIOLATION;
    }
  catch (...)
    {
      // We CANNOT throw an exception out of a COM interface method!
      // Return a reasonable exception code.
      //
      hr = AAFRESULT_UNEXPECTED_EXCEPTION;
    }

  //
  // no cleanup necessary for pLocator
  //
  return hr;
}
コード例 #7
0
ファイル: ImplAAFEssenceData.cpp プロジェクト: UIKit0/aaf
AAFRESULT STDMETHODCALLTYPE
    ImplAAFEssenceData::GetFileMob (ImplAAFSourceMob ** ppFileMob)
{
  AAFRESULT result = AAFRESULT_SUCCESS;
  ImplAAFMob *pMob = NULL;
  ImplAAFSourceMob *pSourceMob = NULL;
  ImplAAFEssenceDescriptor *pEssenceDescriptor = NULL;
  ImplAAFHeader *pHeader = NULL;
  aafMobID_t mobID;

  if(NULL == ppFileMob)
    return(AAFRESULT_NULL_PARAM);

  XPROTECT()
  {
    CHECK(GetFileMobID(&mobID));

    // Does a mob with the ID already exist?  If not, return error.
    // NOTE: Will return AAFRESULT_OBJECT_NOT_PERSISTENT if this object has
    // not been appended to to the file.
    CHECK(MyHeadObject(&pHeader));
    CHECK(pHeader->LookupMob(mobID, &pMob));

    // This should be a valid file mob which is a file mob.
    pSourceMob = dynamic_cast<ImplAAFSourceMob *>(pMob);
    if (NULL == pSourceMob)
      RAISE(AAFRESULT_NOT_FILEMOB);

    // Does the source mob contain a file descriptor?
    CHECK(pSourceMob->GetEssenceDescriptor(&pEssenceDescriptor));
    if (dynamic_cast<ImplAAFFileDescriptor *>(pEssenceDescriptor))
    {
      (*ppFileMob) = pSourceMob;
      pSourceMob->AcquireReference();
    }

  } /* XPROTECT */
  XEXCEPT
  {  // save the error code.
    result = (XCODE());
	NO_PROPAGATE();
  }
  XEND;

  // cleanup
  // Note: pMob and pSourceMob are temp and should not be released.
  if (pEssenceDescriptor)
  {
    pEssenceDescriptor->ReleaseReference();
    pEssenceDescriptor = NULL;
  }
  if (pMob)
  {
    pMob->ReleaseReference();
    pMob = NULL;
  }
  if (pHeader)
  {
    pHeader->ReleaseReference();
    pHeader = NULL;
  }
  return(result);

}
コード例 #8
0
ファイル: ImplAAFEssenceData.cpp プロジェクト: UIKit0/aaf
AAFRESULT STDMETHODCALLTYPE
    ImplAAFEssenceData::SetFileMob (ImplAAFSourceMob * pFileMob)
{
  AAFRESULT result = AAFRESULT_SUCCESS;
  ImplAAFMob *pMob = NULL;
  ImplAAFSourceMob *pSourceMob = NULL;
  ImplAAFEssenceDescriptor *pEssenceDescriptor = NULL;
  ImplAAFFileDescriptor *pFileDescriptor = NULL;
  ImplAAFHeader *pHeader = NULL;
  aafMobID_t mobID;

  if(NULL == pFileMob)
    return(AAFRESULT_NULL_PARAM);

  XPROTECT()
  {
    CHECK(pFileMob->GetMobID(&mobID));

 // move to ImplAAFContentStorage::AppendEssenceData().
    // Does a mob with the ID already exist?  If not, return error
    CHECK(pFileMob->MyHeadObject(&pHeader));
    CHECK(pHeader->LookupMob(mobID, &pMob));


    // Make sure the mob is a valid File source mob???
    pSourceMob = dynamic_cast<ImplAAFSourceMob *>(pMob);
    if (NULL == pSourceMob)
      RAISE(AAFRESULT_INVALID_FILE_MOB);
    // Must       
    result = pSourceMob->GetEssenceDescriptor(&pEssenceDescriptor);
    if (AAFRESULT_SUCCESS != result)
      RAISE(AAFRESULT_INVALID_FILE_MOB);

    pFileDescriptor = dynamic_cast<ImplAAFFileDescriptor *>(pEssenceDescriptor);
    if (NULL == pFileDescriptor)
      RAISE(AAFRESULT_INVALID_FILE_MOB);

    // The mob id refers to a valid file source mob so we can save
    // the id.
    _fileMobID = mobID;
  } /* XPROTECT */
  XEXCEPT
  {  // save the error code.
    result = (XCODE());
	NO_PROPAGATE();
  }
  XEND;

  // cleanup
  if (pEssenceDescriptor)
  {
    pEssenceDescriptor->ReleaseReference();
    pEssenceDescriptor = NULL;
  }
  if (pMob)
  {
    pMob->ReleaseReference();
    pMob = NULL;
  }
  if (pHeader)
  {
    pHeader->ReleaseReference();
    pHeader = NULL;
  }
  return(result);
}