Commit 6de7c227 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

qcap: Directly pass a VIDEOINFOHEADER pointer to the get_media_type() operation.

parent 82abcec5
......@@ -47,7 +47,8 @@ struct video_capture_funcs
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);
void (*get_format)(struct video_capture_device *device, AM_MEDIA_TYPE *mt, VIDEOINFOHEADER *format);
HRESULT (*get_media_type)(struct video_capture_device *device, unsigned int index, AM_MEDIA_TYPE *mt);
HRESULT (*get_media_type)(struct video_capture_device *device,
unsigned int index, AM_MEDIA_TYPE *mt, VIDEOINFOHEADER *format);
void (*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);
......
......@@ -216,7 +216,7 @@ static void v4l_device_get_format(struct video_capture_device *device, AM_MEDIA_
}
static HRESULT v4l_device_get_media_type(struct video_capture_device *device,
unsigned int index, AM_MEDIA_TYPE *mt)
unsigned int index, AM_MEDIA_TYPE *mt, VIDEOINFOHEADER *format)
{
unsigned int caps_count = (device->current_caps) ? 1 : device->caps_count;
......@@ -224,9 +224,16 @@ static HRESULT v4l_device_get_media_type(struct video_capture_device *device,
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);
{
*mt = device->current_caps->media_type;
*format = device->current_caps->video_info;
}
else
{
*mt = device->caps[index].media_type;
*format = device->caps[index].video_info;
}
return S_OK;
}
static __u32 v4l2_cid_from_qcap_property(VideoProcAmpProperty property)
......
......@@ -658,7 +658,20 @@ static HRESULT source_get_media_type(struct strmbase_pin *pin,
unsigned int index, AM_MEDIA_TYPE *mt)
{
struct vfw_capture *filter = impl_from_strmbase_pin(pin);
return capture_funcs->get_media_type(filter->device, index, mt);
VIDEOINFOHEADER *format;
HRESULT hr;
if (!(format = CoTaskMemAlloc(sizeof(*format))))
return E_OUTOFMEMORY;
if ((hr = capture_funcs->get_media_type(filter->device, index, mt, format)) != S_OK)
{
CoTaskMemFree(format);
return hr;
}
mt->cbFormat = sizeof(VIDEOINFOHEADER);
mt->pbFormat = (BYTE *)format;
return S_OK;
}
static HRESULT source_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment