Commit 55110df7 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf/evr: Reinitialize presenter on clock change.

parent 77052268
...@@ -169,18 +169,31 @@ static struct video_stream *impl_from_stream_IMFAttributes(IMFAttributes *iface) ...@@ -169,18 +169,31 @@ static struct video_stream *impl_from_stream_IMFAttributes(IMFAttributes *iface)
return CONTAINING_RECORD(iface, struct video_stream, 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; IMFTopologyServiceLookupClient *lookup_client;
HRESULT hr;
if (renderer->flags & EVR_MIXER_INITED_SERVICES && SUCCEEDED(IMFTransform_QueryInterface(renderer->mixer, if (SUCCEEDED(hr = IMFVideoPresenter_QueryInterface(renderer->presenter, &IID_IMFTopologyServiceLookupClient,
&IID_IMFTopologyServiceLookupClient, (void **)&lookup_client))) (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); 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, if (renderer->flags & EVR_PRESENTER_INITED_SERVICES && SUCCEEDED(IMFVideoPresenter_QueryInterface(renderer->presenter,
&IID_IMFTopologyServiceLookupClient, (void **)&lookup_client))) &IID_IMFTopologyServiceLookupClient, (void **)&lookup_client)))
{ {
...@@ -190,6 +203,21 @@ static void video_renderer_release_services(struct video_renderer *renderer) ...@@ -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) static HRESULT WINAPI video_stream_sink_QueryInterface(IMFStreamSink *iface, REFIID riid, void **obj)
{ {
struct video_stream *stream = impl_from_IMFStreamSink(iface); struct video_stream *stream = impl_from_IMFStreamSink(iface);
...@@ -1280,12 +1308,15 @@ static void video_renderer_set_presentation_clock(struct video_renderer *rendere ...@@ -1280,12 +1308,15 @@ static void video_renderer_set_presentation_clock(struct video_renderer *rendere
IMFPresentationClock_RemoveClockStateSink(renderer->clock, &renderer->IMFClockStateSink_iface); IMFPresentationClock_RemoveClockStateSink(renderer->clock, &renderer->IMFClockStateSink_iface);
IMFPresentationClock_Release(renderer->clock); IMFPresentationClock_Release(renderer->clock);
} }
video_renderer_release_presenter_services(renderer);
renderer->clock = clock; renderer->clock = clock;
if (renderer->clock) if (renderer->clock)
{ {
IMFPresentationClock_AddRef(renderer->clock); IMFPresentationClock_AddRef(renderer->clock);
IMFPresentationClock_AddClockStateSink(renderer->clock, &renderer->IMFClockStateSink_iface); IMFPresentationClock_AddClockStateSink(renderer->clock, &renderer->IMFClockStateSink_iface);
} }
video_renderer_init_presenter_services(renderer);
} }
static HRESULT WINAPI video_renderer_sink_SetPresentationClock(IMFMediaSink *iface, IMFPresentationClock *clock) 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) ...@@ -1579,7 +1610,6 @@ static HRESULT video_renderer_configure_mixer(struct video_renderer *renderer)
static HRESULT video_renderer_configure_presenter(struct video_renderer *renderer) static HRESULT video_renderer_configure_presenter(struct video_renderer *renderer)
{ {
IMFTopologyServiceLookupClient *lookup_client;
IMFVideoDisplayControl *control; IMFVideoDisplayControl *control;
HRESULT hr; HRESULT hr;
...@@ -1589,18 +1619,7 @@ static HRESULT video_renderer_configure_presenter(struct video_renderer *rendere ...@@ -1589,18 +1619,7 @@ static HRESULT video_renderer_configure_presenter(struct video_renderer *rendere
IMFVideoDisplayControl_Release(control); IMFVideoDisplayControl_Release(control);
} }
if (SUCCEEDED(hr = IMFVideoPresenter_QueryInterface(renderer->presenter, &IID_IMFTopologyServiceLookupClient, hr = video_renderer_init_presenter_services(renderer);
(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);
}
if (FAILED(MFGetService((IUnknown *)renderer->presenter, &MR_VIDEO_ACCELERATION_SERVICE, if (FAILED(MFGetService((IUnknown *)renderer->presenter, &MR_VIDEO_ACCELERATION_SERVICE,
&IID_IUnknown, (void **)&renderer->device_manager))) &IID_IUnknown, (void **)&renderer->device_manager)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment