From c1c4856205c78a9c8c153cbec2907e8b392b9838 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 7 Sep 2020 12:43:34 +0300 Subject: [PATCH] mf/evr: Actually use custom mixer when available. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mf/evr.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index 8a4aa3c350d..fe73f6a4a0c 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -734,7 +734,7 @@ static HRESULT video_renderer_create_mixer(struct video_renderer *renderer, IMFA CLSID clsid; HRESULT hr; - if (SUCCEEDED(IMFAttributes_GetUnknown(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_MIXER_ACTIVATE, + if (SUCCEEDED(hr = IMFAttributes_GetUnknown(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_MIXER_ACTIVATE, &IID_IMFActivate, (void **)&activate))) { IMFAttributes_GetUINT32(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_MIXER_FLAGS, &flags); @@ -744,23 +744,31 @@ static HRESULT video_renderer_create_mixer(struct video_renderer *renderer, IMFA return hr; } - if (FAILED(IMFAttributes_GetGUID(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_MIXER_CLSID, &clsid))) - memcpy(&clsid, &CLSID_MFVideoMixer9, sizeof(clsid)); - - if (SUCCEEDED(hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IMFTransform, (void **)out))) + /* Activation object failed, use class activation. */ + if (FAILED(hr)) { - if (SUCCEEDED(hr = IMFTransform_QueryInterface(*out, &IID_IMFTopologyServiceLookupClient, - (void **)&lookup_client))) + if (FAILED(IMFAttributes_GetGUID(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_MIXER_CLSID, &clsid))) + memcpy(&clsid, &CLSID_MFVideoMixer9, sizeof(clsid)); + hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IMFTransform, (void **)out); + } + + if (FAILED(hr)) + { + WARN("Failed to create a mixer object, hr %#x.\n", hr); + return hr; + } + + if (SUCCEEDED(hr = IMFTransform_QueryInterface(*out, &IID_IMFTopologyServiceLookupClient, + (void **)&lookup_client))) + { + renderer->flags |= EVR_INIT_SERVICES; + if (SUCCEEDED(hr = IMFTopologyServiceLookupClient_InitServicePointers(lookup_client, + &renderer->IMFTopologyServiceLookup_iface))) { - renderer->flags |= EVR_INIT_SERVICES; - if (SUCCEEDED(hr = IMFTopologyServiceLookupClient_InitServicePointers(lookup_client, - &renderer->IMFTopologyServiceLookup_iface))) - { - renderer->flags |= EVR_MIXER_INITED_SERVICES; - } - renderer->flags &= ~EVR_INIT_SERVICES; - IMFTopologyServiceLookupClient_Release(lookup_client); + renderer->flags |= EVR_MIXER_INITED_SERVICES; } + renderer->flags &= ~EVR_INIT_SERVICES; + IMFTopologyServiceLookupClient_Release(lookup_client); } return hr;