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 75edf2221d..aa93240aaf 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; +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 ef4923e8fa..7f66a8bc3b 100644 --- a/dlls/qcap/tests/videocapture.c +++ b/dlls/qcap/tests/videocapture.c @@ -63,6 +63,7 @@ static void test_media_types(IPin *pin) static void test_stream_config(IPin *pin) { IAMStreamConfig *stream_config; + VIDEO_STREAM_CONFIG_CAPS vscc; VIDEOINFOHEADER *video_info; AM_MEDIA_TYPE *format; LONG count, size; @@ -106,6 +107,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); @@ -113,6 +120,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 d6c627e7fd..b264203bcc 100644 --- a/dlls/qcap/v4l.c +++ b/dlls/qcap/v4l.c @@ -702,6 +702,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; @@ -781,6 +795,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 e9c1034ae0..85d765415b 100644 --- a/dlls/qcap/vfwcapture.c +++ b/dlls/qcap/vfwcapture.c @@ -256,11 +256,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 =