Commit 82abcec5 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

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

parent d00c6af2
......@@ -46,7 +46,7 @@ struct video_capture_funcs
void (*destroy)(struct video_capture_device *device);
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);
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);
void (*get_caps)(struct video_capture_device *device, LONG index, AM_MEDIA_TYPE *mt,
VIDEOINFOHEADER *format, VIDEO_STREAM_CONFIG_CAPS *caps);
......
......@@ -209,9 +209,10 @@ static HRESULT v4l_device_set_format(struct video_capture_device *device, const
return set_caps(device, caps);
}
static HRESULT v4l_device_get_format(struct video_capture_device *device, AM_MEDIA_TYPE *mt)
static void v4l_device_get_format(struct video_capture_device *device, AM_MEDIA_TYPE *mt, VIDEOINFOHEADER *format)
{
return CopyMediaType(mt, &device->current_caps->media_type);
*mt = device->current_caps->media_type;
*format = device->current_caps->video_info;
}
static HRESULT v4l_device_get_media_type(struct video_capture_device *device,
......
......@@ -337,6 +337,7 @@ AMStreamConfig_SetFormat(IAMStreamConfig *iface, AM_MEDIA_TYPE *pmt)
static HRESULT WINAPI AMStreamConfig_GetFormat(IAMStreamConfig *iface, AM_MEDIA_TYPE **mt)
{
struct vfw_capture *filter = impl_from_IAMStreamConfig(iface);
VIDEOINFOHEADER *format;
HRESULT hr;
TRACE("filter %p, mt %p.\n", filter, mt);
......@@ -347,11 +348,30 @@ static HRESULT WINAPI AMStreamConfig_GetFormat(IAMStreamConfig *iface, AM_MEDIA_
EnterCriticalSection(&filter->filter.csFilter);
if (filter->source.pin.peer)
{
hr = CopyMediaType(*mt, &filter->source.pin.mt);
else if (SUCCEEDED(hr = capture_funcs->get_format(filter->device, *mt)))
strmbase_dump_media_type(*mt);
}
else
{
if ((format = CoTaskMemAlloc(sizeof(VIDEOINFOHEADER))))
{
capture_funcs->get_format(filter->device, *mt, format);
(*mt)->cbFormat = sizeof(VIDEOINFOHEADER);
(*mt)->pbFormat = (BYTE *)format;
hr = S_OK;
}
else
{
hr = E_OUTOFMEMORY;
}
}
LeaveCriticalSection(&filter->filter.csFilter);
if (SUCCEEDED(hr))
strmbase_dump_media_type(*mt);
else
CoTaskMemFree(*mt);
return hr;
}
......
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