mf/evr: Return current device manager as a service.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e7f60e39f6
commit
b0118c7c7d
|
@ -591,19 +591,14 @@ static ULONG WINAPI video_stream_get_service_Release(IMFGetService *iface)
|
||||||
return IMFStreamSink_Release(&stream->IMFStreamSink_iface);
|
return IMFStreamSink_Release(&stream->IMFStreamSink_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI video_stream_get_service_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj)
|
static HRESULT WINAPI video_stream_get_service(struct video_stream *stream, REFGUID service, REFIID riid, void **obj)
|
||||||
{
|
{
|
||||||
struct video_stream *stream = impl_from_stream_IMFGetService(iface);
|
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
TRACE("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj);
|
|
||||||
|
|
||||||
if (IsEqualGUID(service, &MR_VIDEO_ACCELERATION_SERVICE))
|
if (IsEqualGUID(service, &MR_VIDEO_ACCELERATION_SERVICE))
|
||||||
{
|
{
|
||||||
if (IsEqualIID(riid, &IID_IMFVideoSampleAllocator))
|
if (IsEqualIID(riid, &IID_IMFVideoSampleAllocator))
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&stream->cs);
|
|
||||||
|
|
||||||
if (!stream->allocator)
|
if (!stream->allocator)
|
||||||
{
|
{
|
||||||
hr = MFCreateVideoSampleAllocator(&IID_IMFVideoSampleAllocator, (void **)&stream->allocator);
|
hr = MFCreateVideoSampleAllocator(&IID_IMFVideoSampleAllocator, (void **)&stream->allocator);
|
||||||
|
@ -613,10 +608,12 @@ static HRESULT WINAPI video_stream_get_service_GetService(IMFGetService *iface,
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
hr = IMFVideoSampleAllocator_QueryInterface(stream->allocator, riid, obj);
|
hr = IMFVideoSampleAllocator_QueryInterface(stream->allocator, riid, obj);
|
||||||
|
|
||||||
LeaveCriticalSection(&stream->cs);
|
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
else if (IsEqualIID(riid, &IID_IDirect3DDeviceManager9) && stream->parent->device_manager)
|
||||||
|
{
|
||||||
|
return IUnknown_QueryInterface(stream->parent->device_manager, riid, obj);
|
||||||
|
}
|
||||||
|
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
@ -626,6 +623,23 @@ static HRESULT WINAPI video_stream_get_service_GetService(IMFGetService *iface,
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI video_stream_get_service_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj)
|
||||||
|
{
|
||||||
|
struct video_stream *stream = impl_from_stream_IMFGetService(iface);
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
TRACE("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj);
|
||||||
|
|
||||||
|
EnterCriticalSection(&stream->cs);
|
||||||
|
if (!stream->parent)
|
||||||
|
hr = MF_E_STREAMSINK_REMOVED;
|
||||||
|
else
|
||||||
|
hr = video_stream_get_service(stream, service, riid, obj);
|
||||||
|
LeaveCriticalSection(&stream->cs);
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
static const IMFGetServiceVtbl video_stream_get_service_vtbl =
|
static const IMFGetServiceVtbl video_stream_get_service_vtbl =
|
||||||
{
|
{
|
||||||
video_stream_get_service_QueryInterface,
|
video_stream_get_service_QueryInterface,
|
||||||
|
@ -1992,6 +2006,8 @@ static HRESULT WINAPI video_renderer_get_service_GetService(IMFGetService *iface
|
||||||
|
|
||||||
TRACE("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj);
|
TRACE("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj);
|
||||||
|
|
||||||
|
EnterCriticalSection(&renderer->cs);
|
||||||
|
|
||||||
if (IsEqualGUID(service, &MR_VIDEO_MIXER_SERVICE))
|
if (IsEqualGUID(service, &MR_VIDEO_MIXER_SERVICE))
|
||||||
{
|
{
|
||||||
hr = IMFTransform_QueryInterface(renderer->mixer, &IID_IMFGetService, (void **)&gs);
|
hr = IMFTransform_QueryInterface(renderer->mixer, &IID_IMFGetService, (void **)&gs);
|
||||||
|
@ -2000,11 +2016,18 @@ static HRESULT WINAPI video_renderer_get_service_GetService(IMFGetService *iface
|
||||||
{
|
{
|
||||||
hr = IMFVideoPresenter_QueryInterface(renderer->presenter, &IID_IMFGetService, (void **)&gs);
|
hr = IMFVideoPresenter_QueryInterface(renderer->presenter, &IID_IMFGetService, (void **)&gs);
|
||||||
}
|
}
|
||||||
|
else if (IsEqualGUID(service, &MR_VIDEO_ACCELERATION_SERVICE) && IsEqualIID(riid, &IID_IDirect3DDeviceManager9))
|
||||||
|
{
|
||||||
|
if (renderer->device_manager)
|
||||||
|
hr = IUnknown_QueryInterface(renderer->device_manager, riid, obj);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FIXME("Unsupported service %s.\n", debugstr_guid(service));
|
FIXME("Unsupported service %s.\n", debugstr_guid(service));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LeaveCriticalSection(&renderer->cs);
|
||||||
|
|
||||||
if (gs)
|
if (gs)
|
||||||
{
|
{
|
||||||
hr = IMFGetService_GetService(gs, service, riid, obj);
|
hr = IMFGetService_GetService(gs, service, riid, obj);
|
||||||
|
|
|
@ -4269,6 +4269,7 @@ static void test_evr(void)
|
||||||
check_service_interface(sink, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerControl2, TRUE);
|
check_service_interface(sink, &MR_VIDEO_MIXER_SERVICE, &IID_IMFVideoMixerControl2, TRUE);
|
||||||
check_service_interface(sink, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDisplayControl, TRUE);
|
check_service_interface(sink, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDisplayControl, TRUE);
|
||||||
check_service_interface(sink, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoPositionMapper, TRUE);
|
check_service_interface(sink, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoPositionMapper, TRUE);
|
||||||
|
check_service_interface(sink, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IDirect3DDeviceManager9, TRUE);
|
||||||
|
|
||||||
hr = MFGetService((IUnknown *)sink, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDisplayControl,
|
hr = MFGetService((IUnknown *)sink, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDisplayControl,
|
||||||
(void **)&display_control);
|
(void **)&display_control);
|
||||||
|
@ -4415,6 +4416,9 @@ static void test_evr(void)
|
||||||
IMFMediaTypeHandler_Release(type_handler);
|
IMFMediaTypeHandler_Release(type_handler);
|
||||||
|
|
||||||
/* Stream uses an allocator. */
|
/* Stream uses an allocator. */
|
||||||
|
check_service_interface(stream_sink, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IMFVideoSampleAllocator, TRUE);
|
||||||
|
check_service_interface(stream_sink, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IDirect3DDeviceManager9, TRUE);
|
||||||
|
|
||||||
hr = MFGetService((IUnknown *)stream_sink, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IMFVideoSampleAllocator,
|
hr = MFGetService((IUnknown *)stream_sink, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IMFVideoSampleAllocator,
|
||||||
(void **)&allocator);
|
(void **)&allocator);
|
||||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
Loading…
Reference in New Issue