Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/evr.c | 55 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 18 deletions(-)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index 3479bade251..6c71741436b 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -169,18 +169,31 @@ static struct video_stream *impl_from_stream_IMFAttributes(IMFAttributes *iface) return CONTAINING_RECORD(iface, struct video_stream, IMFAttributes_iface); }
-static void video_renderer_release_services(struct video_renderer *renderer) +static HRESULT video_renderer_init_presenter_services(struct video_renderer *renderer) { IMFTopologyServiceLookupClient *lookup_client; + HRESULT hr;
- if (renderer->flags & EVR_MIXER_INITED_SERVICES && SUCCEEDED(IMFTransform_QueryInterface(renderer->mixer, - &IID_IMFTopologyServiceLookupClient, (void **)&lookup_client))) + if (SUCCEEDED(hr = IMFVideoPresenter_QueryInterface(renderer->presenter, &IID_IMFTopologyServiceLookupClient, + (void **)&lookup_client))) { - IMFTopologyServiceLookupClient_ReleaseServicePointers(lookup_client); + renderer->flags |= EVR_INIT_SERVICES; + if (SUCCEEDED(hr = IMFTopologyServiceLookupClient_InitServicePointers(lookup_client, + &renderer->IMFTopologyServiceLookup_iface))) + { + renderer->flags |= EVR_PRESENTER_INITED_SERVICES; + } + renderer->flags &= ~EVR_INIT_SERVICES; IMFTopologyServiceLookupClient_Release(lookup_client); - renderer->flags &= ~EVR_MIXER_INITED_SERVICES; }
+ return hr; +} + +static void video_renderer_release_presenter_services(struct video_renderer *renderer) +{ + IMFTopologyServiceLookupClient *lookup_client; + if (renderer->flags & EVR_PRESENTER_INITED_SERVICES && SUCCEEDED(IMFVideoPresenter_QueryInterface(renderer->presenter, &IID_IMFTopologyServiceLookupClient, (void **)&lookup_client))) { @@ -190,6 +203,21 @@ static void video_renderer_release_services(struct video_renderer *renderer) } }
+static void video_renderer_release_services(struct video_renderer *renderer) +{ + IMFTopologyServiceLookupClient *lookup_client; + + if (renderer->flags & EVR_MIXER_INITED_SERVICES && SUCCEEDED(IMFTransform_QueryInterface(renderer->mixer, + &IID_IMFTopologyServiceLookupClient, (void **)&lookup_client))) + { + IMFTopologyServiceLookupClient_ReleaseServicePointers(lookup_client); + IMFTopologyServiceLookupClient_Release(lookup_client); + renderer->flags &= ~EVR_MIXER_INITED_SERVICES; + } + + video_renderer_release_presenter_services(renderer); +} + static HRESULT WINAPI video_stream_sink_QueryInterface(IMFStreamSink *iface, REFIID riid, void **obj) { struct video_stream *stream = impl_from_IMFStreamSink(iface); @@ -1280,12 +1308,15 @@ static void video_renderer_set_presentation_clock(struct video_renderer *rendere IMFPresentationClock_RemoveClockStateSink(renderer->clock, &renderer->IMFClockStateSink_iface); IMFPresentationClock_Release(renderer->clock); } + video_renderer_release_presenter_services(renderer); + renderer->clock = clock; if (renderer->clock) { IMFPresentationClock_AddRef(renderer->clock); IMFPresentationClock_AddClockStateSink(renderer->clock, &renderer->IMFClockStateSink_iface); } + video_renderer_init_presenter_services(renderer); }
static HRESULT WINAPI video_renderer_sink_SetPresentationClock(IMFMediaSink *iface, IMFPresentationClock *clock) @@ -1579,7 +1610,6 @@ static HRESULT video_renderer_configure_mixer(struct video_renderer *renderer)
static HRESULT video_renderer_configure_presenter(struct video_renderer *renderer) { - IMFTopologyServiceLookupClient *lookup_client; IMFVideoDisplayControl *control; HRESULT hr;
@@ -1589,18 +1619,7 @@ static HRESULT video_renderer_configure_presenter(struct video_renderer *rendere IMFVideoDisplayControl_Release(control); }
- if (SUCCEEDED(hr = IMFVideoPresenter_QueryInterface(renderer->presenter, &IID_IMFTopologyServiceLookupClient, - (void **)&lookup_client))) - { - renderer->flags |= EVR_INIT_SERVICES; - if (SUCCEEDED(hr = IMFTopologyServiceLookupClient_InitServicePointers(lookup_client, - &renderer->IMFTopologyServiceLookup_iface))) - { - renderer->flags |= EVR_PRESENTER_INITED_SERVICES; - } - renderer->flags &= ~EVR_INIT_SERVICES; - IMFTopologyServiceLookupClient_Release(lookup_client); - } + hr = video_renderer_init_presenter_services(renderer);
if (FAILED(MFGetService((IUnknown *)renderer->presenter, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IUnknown, (void **)&renderer->device_manager)))