mf/evr: Reinitialize presenter on clock change.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7705226802
commit
55110df7eb
|
@ -169,6 +169,40 @@ 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 HRESULT video_renderer_init_presenter_services(struct video_renderer *renderer)
|
||||||
|
{
|
||||||
|
IMFTopologyServiceLookupClient *lookup_client;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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)))
|
||||||
|
{
|
||||||
|
IMFTopologyServiceLookupClient_ReleaseServicePointers(lookup_client);
|
||||||
|
IMFTopologyServiceLookupClient_Release(lookup_client);
|
||||||
|
renderer->flags &= ~EVR_PRESENTER_INITED_SERVICES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void video_renderer_release_services(struct video_renderer *renderer)
|
static void video_renderer_release_services(struct video_renderer *renderer)
|
||||||
{
|
{
|
||||||
IMFTopologyServiceLookupClient *lookup_client;
|
IMFTopologyServiceLookupClient *lookup_client;
|
||||||
|
@ -181,13 +215,7 @@ static void video_renderer_release_services(struct video_renderer *renderer)
|
||||||
renderer->flags &= ~EVR_MIXER_INITED_SERVICES;
|
renderer->flags &= ~EVR_MIXER_INITED_SERVICES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderer->flags & EVR_PRESENTER_INITED_SERVICES && SUCCEEDED(IMFVideoPresenter_QueryInterface(renderer->presenter,
|
video_renderer_release_presenter_services(renderer);
|
||||||
&IID_IMFTopologyServiceLookupClient, (void **)&lookup_client)))
|
|
||||||
{
|
|
||||||
IMFTopologyServiceLookupClient_ReleaseServicePointers(lookup_client);
|
|
||||||
IMFTopologyServiceLookupClient_Release(lookup_client);
|
|
||||||
renderer->flags &= ~EVR_PRESENTER_INITED_SERVICES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
@ -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)
|
||||||
|
|
||||||
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
|
||||||
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)))
|
||||||
|
|
Loading…
Reference in New Issue