Signed-off-by: Jactry Zeng jzeng@codeweavers.com --- dlls/qcap/capture.h | 1 + dlls/qcap/tests/videocapture.c | 22 ++++++++++++++++++++++ dlls/qcap/v4l.c | 19 +++++++++++++++++++ dlls/qcap/vfwcapture.c | 11 +++++++---- 4 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/dlls/qcap/capture.h b/dlls/qcap/capture.h index e34c33fb0f..f67936d15b 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; +HRESULT qcap_driver_get_caps(Capture *device,LONG index,AM_MEDIA_TYPE **pmt,BYTE *vscc) 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; diff --git a/dlls/qcap/tests/videocapture.c b/dlls/qcap/tests/videocapture.c index ab9e19b461..448136791b 100644 --- a/dlls/qcap/tests/videocapture.c +++ b/dlls/qcap/tests/videocapture.c @@ -64,6 +64,7 @@ static void test_stream_config(IPin *pin) { VIDEOINFOHEADER *video_info, *video_info2; AM_MEDIA_TYPE *format, *format2; + VIDEO_STREAM_CONFIG_CAPS vscc; IAMStreamConfig *stream_config; LONG depth, compression; LONG count, size; @@ -127,6 +128,12 @@ static void test_stream_config(IPin *pin)
hr = IAMStreamConfig_GetNumberOfCapabilities(stream_config, NULL, &size); ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + hr = IAMStreamConfig_GetStreamCaps(stream_config, 0, NULL, (BYTE *)&vscc); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + hr = IAMStreamConfig_GetStreamCaps(stream_config, 0, &format, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); }
hr = IAMStreamConfig_GetNumberOfCapabilities(stream_config, &count, &size); @@ -134,6 +141,21 @@ static void test_stream_config(IPin *pin) ok(count != 0xdeadbeef, "Got wrong count: %d.\n", count); ok(size == sizeof(VIDEO_STREAM_CONFIG_CAPS), "Got wrong size: %d.\n", size);
+ hr = IAMStreamConfig_GetStreamCaps(stream_config, 100000, NULL, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IAMStreamConfig_GetStreamCaps(stream_config, 100000, &format, (BYTE *)&vscc); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IAMStreamConfig_GetStreamCaps(stream_config, 0, &format, (BYTE *)&vscc); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&format->majortype, &MEDIATYPE_Video), "Got wrong majortype: %s.\n", + debugstr_guid(&MEDIATYPE_Video)); + ok(IsEqualGUID(&vscc.guid, &FORMAT_VideoInfo) + || IsEqualGUID(&vscc.guid, &FORMAT_VideoInfo2), "Got wrong guid: %s.\n", + debugstr_guid(&vscc.guid)); + FreeMediaType(format); + IAMStreamConfig_Release(stream_config); }
diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c index 33e05dd545..6af456aae7 100644 --- a/dlls/qcap/v4l.c +++ b/dlls/qcap/v4l.c @@ -625,6 +625,20 @@ error: return NULL; }
+HRESULT qcap_driver_get_caps(Capture *device, LONG index, AM_MEDIA_TYPE **type, BYTE *vscc) +{ + if (index >= device->caps_count) + return S_FALSE; + + *type = CreateMediaType(&device->caps[index].media_type); + if (!*type) + return E_OUTOFMEMORY; + + if (vscc) + memcpy(vscc, &device->caps[index].config, sizeof(VIDEO_STREAM_CONFIG_CAPS)); + return S_OK; +} + LONG qcap_driver_get_caps_count(Capture *device) { return device->caps_count; @@ -704,6 +718,11 @@ void qcap_driver_cleanup_stream(Capture *device) ERR("v4l absent: shouldn't be called\n"); }
+HRESULT qcap_driver_get_caps(Capture *device, LONG index, AM_MEDIA_TYPE **type, BYTE *vscc) +{ + FAIL_WITH_ERR; +} + LONG qcap_driver_get_caps_count(Capture *device) { ERR("v4l absent: shouldn't be called\n"); diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c index 652b213ccc..967bdba22e 100644 --- a/dlls/qcap/vfwcapture.c +++ b/dlls/qcap/vfwcapture.c @@ -259,11 +259,14 @@ AMStreamConfig_GetNumberOfCapabilities(IAMStreamConfig *iface, int *count, int * }
static HRESULT WINAPI -AMStreamConfig_GetStreamCaps( IAMStreamConfig *iface, int iIndex, - AM_MEDIA_TYPE **pmt, BYTE *pSCC ) +AMStreamConfig_GetStreamCaps(IAMStreamConfig *iface, int index, + AM_MEDIA_TYPE **pmt, BYTE *vscc) { - FIXME("%p: %d %p %p - stub, intentional\n", iface, iIndex, pmt, pSCC); - return E_NOTIMPL; /* Not implemented for this interface */ + VfwCapture *This = impl_from_IAMStreamConfig(iface); + + TRACE("(%p, %d, %p, %p).\n", iface, index, pmt, vscc); + + return qcap_driver_get_caps(This->driver_info, index, pmt, vscc); }
static const IAMStreamConfigVtbl IAMStreamConfig_VTable =