Jactry Zeng : qcap/videocapture: Implement IAMStreamConfig::GetNumberOfCapabilities().
Alexandre Julliard
julliard at winehq.org
Tue Apr 28 16:32:22 CDT 2020
Module: wine
Branch: master
Commit: d8fd16f139292ec8e097a25476b60013c28fd255
URL: https://source.winehq.org/git/wine.git/?a=commit;h=d8fd16f139292ec8e097a25476b60013c28fd255
Author: Jactry Zeng <jzeng at codeweavers.com>
Date: Tue Apr 28 11:55:19 2020 -0500
qcap/videocapture: Implement IAMStreamConfig::GetNumberOfCapabilities().
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/qcap/capture.h | 1 +
dlls/qcap/tests/videocapture.c | 18 ++++++++++++++++++
dlls/qcap/v4l.c | 11 +++++++++++
dlls/qcap/vfwcapture.c | 20 +++++++++++++-------
4 files changed, 43 insertions(+), 7 deletions(-)
diff --git a/dlls/qcap/capture.h b/dlls/qcap/capture.h
index fa48324dd6..e34c33fb0f 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*,const AM_MEDIA_TYPE*) 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 39535adece..ab9e19b461 100644
--- a/dlls/qcap/tests/videocapture.c
+++ b/dlls/qcap/tests/videocapture.c
@@ -66,6 +66,7 @@ static void test_stream_config(IPin *pin)
AM_MEDIA_TYPE *format, *format2;
IAMStreamConfig *stream_config;
LONG depth, compression;
+ LONG count, size;
HRESULT hr;
hr = IPin_QueryInterface(pin, &IID_IAMStreamConfig, (void **)&stream_config);
@@ -116,6 +117,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 ea4fe6b115..112c57e89b 100644
--- a/dlls/qcap/v4l.c
+++ b/dlls/qcap/v4l.c
@@ -624,6 +624,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)
@@ -698,4 +703,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 6c9cc3ce51..8fb0c0d7bd 100644
--- a/dlls/qcap/vfwcapture.c
+++ b/dlls/qcap/vfwcapture.c
@@ -167,7 +167,6 @@ 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 */
static HRESULT WINAPI AMStreamConfig_QueryInterface(IAMStreamConfig *iface, REFIID iid, void **out)
{
VfwCapture *filter = impl_from_IAMStreamConfig(iface);
@@ -242,13 +241,20 @@ AMStreamConfig_GetFormat( IAMStreamConfig *iface, AM_MEDIA_TYPE **pmt )
return hr;
}
-static HRESULT WINAPI
-AMStreamConfig_GetNumberOfCapabilities( IAMStreamConfig *iface, int *piCount,
- int *piSize )
+static HRESULT WINAPI 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 *filter = impl_from_IAMStreamConfig(iface);
+
+ TRACE("filter %p, count %p, size %p.\n", filter, count, size);
+
+ if (!count || !size)
+ return E_POINTER;
+
+ *count = qcap_driver_get_caps_count(filter->driver_info);
+ *size = sizeof(VIDEO_STREAM_CONFIG_CAPS);
+
+ return S_OK;
}
static HRESULT WINAPI
More information about the wine-cvs
mailing list