qcap: Directly pass a VIDEOINFOHEADER pointer to the get_format() 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:38 -06:00 committed by Alexandre Julliard
parent d00c6af248
commit 82abcec541
3 changed files with 26 additions and 5 deletions

View file

@ -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);

View file

@ -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,

View file

@ -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;
}