qcap/videocapture: Implement IAMStreamConfig::GetStreamCaps().

Signed-off-by: Jactry Zeng <jzeng@codeweavers.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jactry Zeng 2020-04-28 11:55:20 -05:00 committed by Alexandre Julliard
parent d8fd16f139
commit c8b1b993ad
4 changed files with 52 additions and 5 deletions

View File

@ -27,6 +27,8 @@ 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,
VIDEO_STREAM_CONFIG_CAPS *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;

View File

@ -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);
}

View File

@ -624,6 +624,21 @@ error:
return NULL;
}
HRESULT qcap_driver_get_caps(Capture *device, LONG index, AM_MEDIA_TYPE **type,
VIDEO_STREAM_CONFIG_CAPS *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;
@ -703,6 +718,12 @@ 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,
VIDEO_STREAM_CONFIG_CAPS *vscc)
{
FAIL_WITH_ERR;
}
LONG qcap_driver_get_caps_count(Capture *device)
{
ERR("v4l absent: shouldn't be called\n");

View File

@ -257,12 +257,14 @@ static HRESULT WINAPI AMStreamConfig_GetNumberOfCapabilities(IAMStreamConfig *if
return S_OK;
}
static HRESULT WINAPI
AMStreamConfig_GetStreamCaps( IAMStreamConfig *iface, int iIndex,
AM_MEDIA_TYPE **pmt, BYTE *pSCC )
static HRESULT WINAPI 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 *filter = impl_from_IAMStreamConfig(iface);
TRACE("filter %p, index %d, pmt %p, vscc %p.\n", filter, index, pmt, vscc);
return qcap_driver_get_caps(filter->driver_info, index, pmt, (VIDEO_STREAM_CONFIG_CAPS *)vscc);
}
static const IAMStreamConfigVtbl IAMStreamConfig_VTable =