locked
Is it possible to create a define and use a custom EVR inside the same app (rather than an external DLL). RRS feed

  • Question

  • Hi I'm very new and unfamiliar with Windows API. I looked at the basicPlayer demo and the customEVR example. I want to use them but I don't want to have the custom EVR as a separate dll because it requires to register the dll and it's not very convenient. I was wondering if it is possible to define and use it in the same app I'm running the player. I basically imported all the custom EVR demo code in the basicPlayer example and tried (in the player demo) : 

     

       hr = MFCreateVideoRendererActivate(hwndVideo, &pRendererActivate);
      IMFActivate *pEVRPresenterActivation = NULL;
      hr = CoCreateInstance(CLSID_CustomEVRPresenter, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pEVRPresenterActivation));
      if (FAILED(hr))
      {
       //"FAILURE TO CREATE CUSTOM EVR";
      }
      pRendererActivate->SetUnknown(MF_ACTIVATE_CUSTOM_VIDEO_PRESENTER_ACTIVATE, pEVRPresenterActivation);

     

    It always fails to create the custom evr. I'm wondering what is needed to register it or is there a better way to pass it directly. 

    Thanks for the answer.


    Friday, July 8, 2011 2:08 PM

All replies

  • It is not necessary to register your custom presenter if you are just using it in-process (as opposed to out of process in the MF protected media path).  Instead of having a CLSID and calling CoCreateInstance, just create your custom presenter activate directly; something like this:

    // Somewhere, we have defined and implemented
    // class MyPresenterActivate
    //   : public IMFActivate
    IMFActivate* pEVRPresenterActivation = new MyPresenterActivate();
    if(pEVRPresenterActivate)
    {
      // SetUnknown will add a reference to pEVRPresenterActivation
      hr = pRendererActivate->SetUnknown(MF_ACTIVATE_CUSTOM_VIDEO_PRESENTER_ACTIVATE, pEVRPresenterActivation)
    }
    else
    {
      hr = E_OUTOFMEMORY
    }
    
    
    

    Tuesday, August 2, 2011 7:33 PM