Nikolay Sivov : evr/sample: Implement GetService() for surface buffers.

Alexandre Julliard julliard at winehq.org
Wed Oct 14 15:37:21 CDT 2020


Module: wine
Branch: master
Commit: 0ff8a57257c4c9138f8ecf71f45cd41edbcd7671
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0ff8a57257c4c9138f8ecf71f45cd41edbcd7671

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Oct 14 16:03:12 2020 +0300

evr/sample: Implement GetService() for surface buffers.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/evr/sample.c    |  9 +++++++--
 dlls/evr/tests/evr.c | 12 +++++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/dlls/evr/sample.c b/dlls/evr/sample.c
index 668e675da2..cd6cef001a 100644
--- a/dlls/evr/sample.c
+++ b/dlls/evr/sample.c
@@ -1075,9 +1075,14 @@ static ULONG WINAPI surface_buffer_gs_Release(IMFGetService *iface)
 
 static HRESULT WINAPI surface_buffer_gs_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj)
 {
-    FIXME("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj);
+    struct surface_buffer *buffer = impl_from_IMFGetService(iface);
 
-    return E_NOTIMPL;
+    TRACE("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj);
+
+    if (IsEqualGUID(service, &MR_BUFFER_SERVICE))
+        return IUnknown_QueryInterface(buffer->surface, riid, obj);
+
+    return E_NOINTERFACE;
 }
 
 static const IMFGetServiceVtbl surface_buffer_gs_vtbl =
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c
index 69ee2d3d96..d0e39cb47c 100644
--- a/dlls/evr/tests/evr.c
+++ b/dlls/evr/tests/evr.c
@@ -718,7 +718,7 @@ todo_wine
 
 static void test_surface_sample(void)
 {
-    IDirect3DSurface9 *backbuffer = NULL;
+    IDirect3DSurface9 *backbuffer = NULL, *surface;
     IMFDesiredSample *desired_sample;
     IMFMediaBuffer *buffer, *buffer2;
     LONGLONG duration, time1, time2;
@@ -870,6 +870,16 @@ static void test_surface_sample(void)
     ok(hr == S_OK, "Failed to get buffer count, hr %#x.\n", hr);
     ok(!count, "Unexpected attribute count.\n");
 
+    hr = MFGetService((IUnknown *)buffer, &MR_BUFFER_SERVICE, &IID_IDirect3DSurface9, (void **)&surface);
+    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(surface == backbuffer, "Unexpected instance.\n");
+    IDirect3DSurface9_Release(surface);
+
+    hr = MFGetService((IUnknown *)buffer, &MR_BUFFER_SERVICE, &IID_IUnknown, (void **)&surface);
+    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(surface == backbuffer, "Unexpected instance.\n");
+    IDirect3DSurface9_Release(surface);
+
     IMFMediaBuffer_Release(buffer);
 
     hr = IMFSample_GetSampleFlags(sample, &flags);




More information about the wine-cvs mailing list