(Media Foundation) MediaEngineClassFactory does not start MediaEngine

2

I'm trying to play a video for a DirectX texture via Media Foundation by searching I did not find much about it except for this example of #

  • later test and adapt to other situations (instead of playing direct audio, processing audio, and playing with Direct Sound)

    The problem is in the following code, still starting the Media Engine , sets the attributes of it, starts the factory , but when it finally starts MediaEngine , return HRESULT , is 0xc00d3e85 , which has no documentation on the MSDN , relative to the function), and the MediaEngine pointer is zeroed:

    //Globais:IMFDXGIDeviceManager* m_spDXGIManager = 0,IMFMediaEngine* m_spMediaEngine = 0
    
    //Parametros:HWND hwnd, DXGI_FORMAT formato = DXGI_FORMAT_B8G8R8A8_UNORM
    MediaEngineNotify* spNotify = 0;
    IMFMediaEngineClassFactory* spFactory = 0;
    IMFAttributes* spAttributes = 0;
    spNotify = new MediaEngineNotify(hwnd);
    if (spNotify == nullptr) goto FIM_INIT;
    spNotify->MediaEngineNotifyCallback(this);
    
    h = CoCreateInstance(CLSID_MFMediaEngineClassFactory, nullptr, CLSCTX_INPROC_SERVER,IID_PPV_ARGS(&spFactory));
    if (FAILED(h)) goto FIM;
    
    h = MFCreateAttributes(&spAttributes, 1);
    if (FAILED(h)) goto FIM;
    
    h = spAttributes->SetUnknown(MF_MEDIA_ENGINE_DXGI_MANAGER, (IUnknown*)m_spDXGIManager);
    if (FAILED(h)) goto FIM;
    
    h = spAttributes->SetUnknown(MF_MEDIA_ENGINE_CALLBACK, (IUnknown*)spNotify);
    if (FAILED(h)) goto FIM;
    
    h = spAttributes->SetUINT32(MF_MEDIA_ENGINE_VIDEO_OUTPUT_FORMAT, formato);
    if (FAILED(h)) goto FIM;
    

    Walk this is the error ...

    h = spFactory->CreateInstance(MF_MEDIA_ENGINE_WAITFORSTABLE_STATE, spAttributes, &m_spMediaEngine);
    if (FAILED(h)) goto FIM;
    

    What am I doing wrong? how does the code in the example wheel work in the same way, just because it uses CLI (does not it make sense)?

        
  • asked by anonymous 26.10.2017 / 17:20

    0 answers