[PATCH v2 3/8] qedit: Implement IMediaDet::GetSampleGrabber.

Gabriel Ivăncescu gabrielopcode at gmail.com
Fri Oct 23 10:18:53 CDT 2020


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/qedit/mediadet.c       | 13 ++++++++++---
 dlls/qedit/tests/mediadet.c |  8 +++-----
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/dlls/qedit/mediadet.c b/dlls/qedit/mediadet.c
index 5eb6aef..6a9b000 100644
--- a/dlls/qedit/mediadet.c
+++ b/dlls/qedit/mediadet.c
@@ -729,9 +729,16 @@ static HRESULT WINAPI MediaDet_get_StreamMediaType(IMediaDet* iface,
 static HRESULT WINAPI MediaDet_GetSampleGrabber(IMediaDet* iface,
                                                 ISampleGrabber **ppVal)
 {
-    MediaDetImpl *This = impl_from_IMediaDet(iface);
-    FIXME("(%p)->(%p): not implemented!\n", This, ppVal);
-    return E_NOTIMPL;
+    MediaDetImpl *detector = impl_from_IMediaDet(iface);
+
+    TRACE("(%p)->(%p)\n", detector, ppVal);
+
+    if (!detector->grabber)
+        return E_NOINTERFACE;
+
+    *ppVal = detector->grabber;
+    ISampleGrabber_AddRef(*ppVal);
+    return S_OK;
 }
 
 static HRESULT WINAPI MediaDet_get_FrameRate(IMediaDet* iface, double *pVal)
diff --git a/dlls/qedit/tests/mediadet.c b/dlls/qedit/tests/mediadet.c
index 71d4a4b..18a4412 100644
--- a/dlls/qedit/tests/mediadet.c
+++ b/dlls/qedit/tests/mediadet.c
@@ -1328,7 +1328,7 @@ static void test_bitmap_grab_mode(void)
     hr = IMediaDet_EnterBitmapGrabMode(detector, 0.0);
     ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
     hr = IMediaDet_GetSampleGrabber(detector, &sg);
-    todo_wine ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
 
     /* EnterBitmapGrabMode only works with Video major type */
     testfilter_init(&testfilter);
@@ -1442,8 +1442,7 @@ static void test_bitmap_grab_mode(void)
 
     /* Check the SampleGrabber */
     hr = IMediaDet_GetSampleGrabber(detector, &sg);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
-    if (hr != S_OK) goto no_grabber;
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
     hr = ISampleGrabber_GetConnectedMediaType(sg, &mt);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     ok(IsEqualGUID(&mt.majortype, &MEDIATYPE_Video), "Got major type %s.\n", debugstr_guid(&mt.majortype));
@@ -1494,13 +1493,12 @@ static void test_bitmap_grab_mode(void)
     ok(clock == NULL, "Got non-NULL clock.\n");
     IMediaFilter_Release(mf);
 
-no_grabber:
     /* Changing filter resets bitmap grab mode */
     testfilter.bitmap_grab_mode = FALSE;
     hr = IMediaDet_put_Filter(detector, &testfilter.filter.IUnknown_inner);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     hr = IMediaDet_GetSampleGrabber(detector, &sg);
-    todo_wine ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
     hr = IMediaDet_get_OutputStreams(detector, &count);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     ok(count == 1, "Got %d streams.\n", count);
-- 
2.21.0




More information about the wine-devel mailing list