qcap: Directly pass AM_MEDIA_TYPE and VIDEOINFOHEADER pointers to the get_caps() operation.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-11-25 17:43:36 -06:00 committed by Alexandre Julliard
parent 14088498ec
commit fa0ff00e57
3 changed files with 31 additions and 9 deletions

View File

@ -48,7 +48,8 @@ struct video_capture_funcs
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);
HRESULT (*get_caps)(struct video_capture_device *device, LONG index, AM_MEDIA_TYPE *mt,
VIDEOINFOHEADER *format, 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,
LONG *min, LONG *max, LONG *step, LONG *default_value, LONG *flags);

View File

@ -374,17 +374,14 @@ static void fill_caps(__u32 pixelformat, __u32 width, __u32 height,
}
static HRESULT v4l_device_get_caps(struct video_capture_device *device, LONG index,
AM_MEDIA_TYPE **type, VIDEO_STREAM_CONFIG_CAPS *vscc)
AM_MEDIA_TYPE *type, VIDEOINFOHEADER *format, 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));
*vscc = device->caps[index].config;
*type = device->caps[index].media_type;
*format = device->caps[index].video_info;
return S_OK;
}

View File

@ -375,10 +375,34 @@ static HRESULT WINAPI AMStreamConfig_GetStreamCaps(IAMStreamConfig *iface,
int index, AM_MEDIA_TYPE **pmt, BYTE *vscc)
{
struct vfw_capture *filter = impl_from_IAMStreamConfig(iface);
VIDEOINFOHEADER *format;
AM_MEDIA_TYPE *mt;
HRESULT hr;
TRACE("filter %p, index %d, pmt %p, vscc %p.\n", filter, index, pmt, vscc);
return capture_funcs->get_caps(filter->device, index, pmt, (VIDEO_STREAM_CONFIG_CAPS *)vscc);
if (!(mt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))))
return E_OUTOFMEMORY;
if (!(format = CoTaskMemAlloc(sizeof(VIDEOINFOHEADER))))
{
CoTaskMemFree(mt);
return E_OUTOFMEMORY;
}
if ((hr = capture_funcs->get_caps(filter->device, index, mt,
format, (VIDEO_STREAM_CONFIG_CAPS *)vscc)) == S_OK)
{
mt->cbFormat = sizeof(VIDEOINFOHEADER);
mt->pbFormat = (BYTE *)format;
*pmt = mt;
}
else
{
CoTaskMemFree(format);
CoTaskMemFree(mt);
}
return hr;
}
static const IAMStreamConfigVtbl IAMStreamConfig_VTable =