Signed-off-by: Jeff Smith <whydoubt(a)gmail.com> --- dlls/qcap/qcap_private.h | 1 + dlls/qcap/tests/videocapture.c | 10 +++------- dlls/qcap/v4l.c | 8 ++++++++ dlls/qcap/vfwcapture.c | 11 +++++++++-- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/dlls/qcap/qcap_private.h b/dlls/qcap/qcap_private.h index 70a8c85ad4..006e193f3c 100644 --- a/dlls/qcap/qcap_private.h +++ b/dlls/qcap/qcap_private.h @@ -51,6 +51,7 @@ struct video_capture_device_ops HRESULT (*check_format)(struct video_capture_device *device, const AM_MEDIA_TYPE *mt); HRESULT (*set_format)(struct video_capture_device *device, const AM_MEDIA_TYPE *mt); HRESULT (*get_format)(struct video_capture_device *device, AM_MEDIA_TYPE *mt); + BOOL (*is_format_set)(struct video_capture_device *device); HRESULT (*get_caps)(struct video_capture_device *device, LONG index, AM_MEDIA_TYPE **mt, VIDEO_STREAM_CONFIG_CAPS *caps); LONG (*get_caps_count)(struct video_capture_device *device); HRESULT (*get_prop_range)(struct video_capture_device *device, VideoProcAmpProperty property, diff --git a/dlls/qcap/tests/videocapture.c b/dlls/qcap/tests/videocapture.c index c0fd30aee3..ceadf12417 100644 --- a/dlls/qcap/tests/videocapture.c +++ b/dlls/qcap/tests/videocapture.c @@ -117,8 +117,8 @@ static void test_stream_config(IPin *pin) * This persists until the filter is released. */ IPin_EnumMediaTypes(pin, &enum_media_types); hr = IEnumMediaTypes_Next(enum_media_types, 2, formats, &fetched); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); - todo_wine ok(fetched == 1, "Fetched %u.\n", fetched); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(fetched == 1, "Fetched %u.\n", fetched); DeleteMediaType(formats[0]); IEnumMediaTypes_Release(enum_media_types); @@ -210,11 +210,7 @@ static void test_stream_config(IPin *pin) ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Next(enum_media_types, 1, &format2, NULL); ok(hr == S_OK, "Got hr %#x.\n", hr); - - /* Which media types will match varies in wine depending on the attached webcam */ - todo_wine_if(compare_media_types(format, format2) == FALSE) ok(compare_media_types(format, format2), "Media types didn't match.\n"); - DeleteMediaType(format2); IEnumMediaTypes_Release(enum_media_types); @@ -401,7 +397,7 @@ START_TEST(videocapture) test_pins(filter); count_pins_media_types(filter, &pin_count, &media_type_count); - todo_wine ok(media_type_count == pin_count, + ok(media_type_count == pin_count, "Expected media type count (%d) to be equal to pin count (%d)\n", media_type_count, pin_count); diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c index c6a5e45831..10ab26276b 100644 --- a/dlls/qcap/v4l.c +++ b/dlls/qcap/v4l.c @@ -228,6 +228,13 @@ static HRESULT v4l_device_get_format(struct video_capture_device *iface, AM_MEDI return CopyMediaType(mt, &device->current_caps->media_type); } +static BOOL v4l_device_is_format_set(struct video_capture_device *iface) +{ + struct v4l_device *device = v4l_device(iface); + + return !!device->current_caps; +} + static __u32 v4l2_cid_from_qcap_property(VideoProcAmpProperty property) { switch (property) @@ -533,6 +540,7 @@ static const struct video_capture_device_ops v4l_device_ops = .check_format = v4l_device_check_format, .set_format = v4l_device_set_format, .get_format = v4l_device_get_format, + .is_format_set = v4l_device_is_format_set, .get_caps = v4l_device_get_caps, .get_caps_count = v4l_device_get_caps_count, .get_prop_range = v4l_device_get_prop_range, diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c index 17e56a7ee9..dcaa9aad4f 100644 --- a/dlls/qcap/vfwcapture.c +++ b/dlls/qcap/vfwcapture.c @@ -526,13 +526,20 @@ static HRESULT source_get_media_type(struct strmbase_pin *pin, unsigned int index, AM_MEDIA_TYPE *pmt) { VfwCapture *filter = impl_from_strmbase_pin(pin); + BOOL is_format_set; + unsigned int caps_count; AM_MEDIA_TYPE *vfw_pmt; HRESULT hr; - if (index >= filter->device->ops->get_caps_count(filter->device)) + is_format_set = filter->device->ops->is_format_set(filter->device); + + caps_count = is_format_set ? 1 : filter->device->ops->get_caps_count(filter->device); + if (index >= caps_count) return VFW_S_NO_MORE_ITEMS; - if (SUCCEEDED(hr = filter->device->ops->get_caps(filter->device, index, &vfw_pmt, NULL))) + if (is_format_set) + hr = filter->device->ops->get_format(filter->device, pmt); + else if (SUCCEEDED(hr = filter->device->ops->get_caps(filter->device, index, &vfw_pmt, NULL))) { CopyMediaType(pmt, vfw_pmt); DeleteMediaType(vfw_pmt); -- 2.23.0