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

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>
feature/deterministic
Jactry Zeng 2020-04-28 11:55:19 -05:00 committed by Alexandre Julliard
parent 5df9f7b352
commit d8fd16f139
4 changed files with 43 additions and 7 deletions

View File

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

View File

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

View File

@ -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) */

View File

@ -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