Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/evr.c | 39 +++++++++++++++++++++++++++++++-------- dlls/mf/tests/mf.c | 4 ++++ 2 files changed, 35 insertions(+), 8 deletions(-)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index 79e2f57f9c5..8b4a9c03b5f 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -591,19 +591,14 @@ static ULONG WINAPI video_stream_get_service_Release(IMFGetService *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;
- TRACE("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj); - if (IsEqualGUID(service, &MR_VIDEO_ACCELERATION_SERVICE)) { if (IsEqualIID(riid, &IID_IMFVideoSampleAllocator)) { - EnterCriticalSection(&stream->cs); - if (!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)) hr = IMFVideoSampleAllocator_QueryInterface(stream->allocator, riid, obj);
- LeaveCriticalSection(&stream->cs); - return hr; } + else if (IsEqualIID(riid, &IID_IDirect3DDeviceManager9) && stream->parent->device_manager) + { + return IUnknown_QueryInterface(stream->parent->device_manager, riid, obj); + }
return E_NOINTERFACE; } @@ -626,6 +623,23 @@ static HRESULT WINAPI video_stream_get_service_GetService(IMFGetService *iface, 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 = { 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);
+ EnterCriticalSection(&renderer->cs); + if (IsEqualGUID(service, &MR_VIDEO_MIXER_SERVICE)) { 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); } + 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 { FIXME("Unsupported service %s.\n", debugstr_guid(service)); }
+ LeaveCriticalSection(&renderer->cs); + if (gs) { hr = IMFGetService_GetService(gs, service, riid, obj); diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index b990b4614da..39b9d64e729 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -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_RENDER_SERVICE, &IID_IMFVideoDisplayControl, 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, (void **)&display_control); @@ -4415,6 +4416,9 @@ static void test_evr(void) IMFMediaTypeHandler_Release(type_handler);
/* 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, (void **)&allocator); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);