Ejemplo n.º 1
0
HRESULT STDMETHODCALLTYPE
    CAAFSourceClip::GetFade (aafLength_t *  pFadeInLen,
        aafFadeType_t *  pFadeInType,
        aafBoolean_t *  pFadeInPresent,
        aafLength_t *  pFadeOutLen,
        aafFadeType_t *  pFadeOutType,
        aafBoolean_t *  pFadeOutPresent)
{
  HRESULT hr;

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


  try
    {
      hr = ptr->GetFade
       (pFadeInLen,
        pFadeInType,
        pFadeInPresent,
        pFadeOutLen,
        pFadeOutType,
        pFadeOutPresent);
    }
  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;
}