[PATCH 3/6] qcap/videocapture: Implement IAMStreamConfig_GetNumberOfCapabilities().
Jactry Zeng
jzeng at codeweavers.com
Thu Apr 23 00:28:52 CDT 2020
Though MSDN mentions that capture pin only implemented {Get, Set}Format(),
these tests expose that GetNumberOfCapabilities() and GetStreamCaps() were
implemented, too.
Tests passed on Windows 7 and Windows 10.
BTW, Wine only implemented an output pin for video capture filter currently.
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
---
dlls/qcap/capture.h | 1 +
dlls/qcap/tests/videocapture.c | 18 ++++++++++++++++++
dlls/qcap/v4l.c | 11 +++++++++++
dlls/qcap/vfwcapture.c | 19 +++++++++++++------
4 files changed, 43 insertions(+), 6 deletions(-)
diff --git a/dlls/qcap/capture.h b/dlls/qcap/capture.h
index d3cf193e7f..75edf2221d 100644
--- a/dlls/qcap/capture.h
+++ b/dlls/qcap/capture.h
@@ -27,6 +27,7 @@ Capture *qcap_driver_init(struct strmbase_source *,USHORT) DECLSPEC_HIDDEN;
HRESULT qcap_driver_destroy(Capture*) DECLSPEC_HIDDEN;
HRESULT qcap_driver_check_format(Capture* device,const AM_MEDIA_TYPE *mt,LONG *index) DECLSPEC_HIDDEN;
HRESULT qcap_driver_set_format(Capture*,AM_MEDIA_TYPE*) DECLSPEC_HIDDEN;
+LONG qcap_driver_get_caps_count(Capture *device) DECLSPEC_HIDDEN;
HRESULT qcap_driver_get_format(const Capture*,AM_MEDIA_TYPE**) DECLSPEC_HIDDEN;
HRESULT qcap_driver_get_prop_range(Capture*,VideoProcAmpProperty,LONG*,LONG*,LONG*,LONG*,LONG*) DECLSPEC_HIDDEN;
HRESULT qcap_driver_get_prop(Capture*,VideoProcAmpProperty,LONG*,LONG*) DECLSPEC_HIDDEN;
diff --git a/dlls/qcap/tests/videocapture.c b/dlls/qcap/tests/videocapture.c
index a43875101c..ef4923e8fa 100644
--- a/dlls/qcap/tests/videocapture.c
+++ b/dlls/qcap/tests/videocapture.c
@@ -65,6 +65,7 @@ static void test_stream_config(IPin *pin)
IAMStreamConfig *stream_config;
VIDEOINFOHEADER *video_info;
AM_MEDIA_TYPE *format;
+ LONG count, size;
HRESULT hr;
hr = IPin_QueryInterface(pin, &IID_IAMStreamConfig, (void **)&stream_config);
@@ -95,6 +96,23 @@ static void test_stream_config(IPin *pin)
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
FreeMediaType(format);
+ count = 0xdeadbeef;
+ size = 0xdeadbeef;
+ /* Crash on Windows */
+ if (0)
+ {
+ hr = IAMStreamConfig_GetNumberOfCapabilities(stream_config, &count, NULL);
+ ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+
+ hr = IAMStreamConfig_GetNumberOfCapabilities(stream_config, NULL, &size);
+ ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+ }
+
+ hr = IAMStreamConfig_GetNumberOfCapabilities(stream_config, &count, &size);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(count != 0xdeadbeef, "Got wrong count: %d.\n", count);
+ ok(size == sizeof(VIDEO_STREAM_CONFIG_CAPS), "Got wrong size: %d.\n", size);
+
IAMStreamConfig_Release(stream_config);
}
diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c
index db9117d593..d6c627e7fd 100644
--- a/dlls/qcap/v4l.c
+++ b/dlls/qcap/v4l.c
@@ -702,6 +702,11 @@ error:
return NULL;
}
+LONG qcap_driver_get_caps_count(Capture *device)
+{
+ return device->caps_count;
+}
+
#else
Capture *qcap_driver_init(struct strmbase_source *pin, USHORT card)
@@ -776,4 +781,10 @@ void qcap_driver_cleanup_stream(Capture *device)
ERR("v4l absent: shouldn't be called\n");
}
+LONG qcap_driver_get_caps_count(Capture *device)
+{
+ ERR("v4l absent: shouldn't be called\n");
+ return 0;
+}
+
#endif /* defined(VIDIOCMCAPTURE) */
diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c
index ab323845bf..e9c1034ae0 100644
--- a/dlls/qcap/vfwcapture.c
+++ b/dlls/qcap/vfwcapture.c
@@ -167,7 +167,7 @@ static const struct strmbase_filter_ops filter_ops =
.filter_cleanup_stream = vfw_capture_cleanup_stream,
};
-/* AMStreamConfig interface, we only need to implement {G,S}etFormat */
+/* AMStreamConfig interface */
static HRESULT WINAPI AMStreamConfig_QueryInterface(IAMStreamConfig *iface, REFIID iid, void **out)
{
VfwCapture *filter = impl_from_IAMStreamConfig(iface);
@@ -240,12 +240,19 @@ AMStreamConfig_GetFormat( IAMStreamConfig *iface, AM_MEDIA_TYPE **pmt )
}
static HRESULT WINAPI
-AMStreamConfig_GetNumberOfCapabilities( IAMStreamConfig *iface, int *piCount,
- int *piSize )
+AMStreamConfig_GetNumberOfCapabilities(IAMStreamConfig *iface, int *count, int *size)
{
- FIXME("%p: %p %p - stub, intentional\n", iface, piCount, piSize);
- *piCount = 0;
- return E_NOTIMPL; /* Not implemented for this interface */
+ VfwCapture *This = impl_from_IAMStreamConfig(iface);
+
+ TRACE("(%p, %p, %p).\n", iface, count, size);
+
+ if (!count || !size)
+ return E_POINTER;
+
+ *count = qcap_driver_get_caps_count(This->driver_info);
+ *size = sizeof(VIDEO_STREAM_CONFIG_CAPS);
+
+ return S_OK;
}
static HRESULT WINAPI
--
2.26.1
More information about the wine-devel
mailing list