1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-08 20:06:18 +00:00

qcap: Enumerate one media type if pin format has been set.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jeff Smith 2020-09-08 11:15:10 -05:00 committed by Alexandre Julliard
parent 3757956e8f
commit 7712a48c89
4 changed files with 21 additions and 18 deletions

View File

@ -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);
HRESULT (*get_media_type)(struct video_capture_device *device, unsigned int index, AM_MEDIA_TYPE *mt);
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,

View File

@ -109,7 +109,7 @@ static void test_stream_config(IPin *pin)
ok(hr == S_OK, "Got hr %#x.\n", hr);
DeleteMediaType(format2);
hr = IEnumMediaTypes_Next(enum_media_types, 1, &format2, NULL);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
IEnumMediaTypes_Release(enum_media_types);
format->majortype = MEDIATYPE_Audio;
@ -200,10 +200,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);
todo_wine_if (!compare_media_types(format, format2))
ok(compare_media_types(format, format2), "Media types didn't match.\n");
ok(compare_media_types(format, format2), "Media types didn't match.\n");
DeleteMediaType(format2);
IEnumMediaTypes_Release(enum_media_types);

View File

@ -227,6 +227,21 @@ static HRESULT v4l_device_get_format(struct video_capture_device *iface, AM_MEDI
return CopyMediaType(mt, &device->current_caps->media_type);
}
static HRESULT v4l_device_get_media_type(struct video_capture_device *iface,
unsigned int index, AM_MEDIA_TYPE *mt)
{
struct v4l_device *device = v4l_device(iface);
unsigned int caps_count = (device->current_caps) ? 1 : device->caps_count;
if (index >= caps_count)
return VFW_S_NO_MORE_ITEMS;
if (device->current_caps)
return CopyMediaType(mt, &device->current_caps->media_type);
return CopyMediaType(mt, &device->caps[index].media_type);
}
static __u32 v4l2_cid_from_qcap_property(VideoProcAmpProperty property)
{
switch (property)
@ -515,6 +530,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,
.get_media_type = v4l_device_get_media_type,
.get_caps = v4l_device_get_caps,
.get_caps_count = v4l_device_get_caps_count,
.get_prop_range = v4l_device_get_prop_range,

View File

@ -521,21 +521,10 @@ static HRESULT source_query_accept(struct strmbase_pin *pin, const AM_MEDIA_TYPE
}
static HRESULT source_get_media_type(struct strmbase_pin *pin,
unsigned int index, AM_MEDIA_TYPE *pmt)
unsigned int index, AM_MEDIA_TYPE *mt)
{
VfwCapture *filter = impl_from_strmbase_pin(pin);
AM_MEDIA_TYPE *vfw_pmt;
HRESULT hr;
if (index >= filter->device->ops->get_caps_count(filter->device))
return VFW_S_NO_MORE_ITEMS;
if (SUCCEEDED(hr = filter->device->ops->get_caps(filter->device, index, &vfw_pmt, NULL)))
{
CopyMediaType(pmt, vfw_pmt);
DeleteMediaType(vfw_pmt);
}
return hr;
return filter->device->ops->get_media_type(filter->device, index, mt);
}
static HRESULT source_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)