Zebediah Figura : qcap: Directly pass AM_MEDIA_TYPE and VIDEOINFOHEADER pointers to the get_caps() operation.
Alexandre Julliard
julliard at winehq.org
Thu Nov 26 16:30:59 CST 2020
Module: wine
Branch: master
Commit: fa0ff00e57f2523200ae6bd3f8f0d1ec9e8e81f7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=fa0ff00e57f2523200ae6bd3f8f0d1ec9e8e81f7
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Wed Nov 25 17:43:36 2020 -0600
qcap: Directly pass AM_MEDIA_TYPE and VIDEOINFOHEADER pointers to the get_caps() operation.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/qcap/qcap_private.h | 3 ++-
dlls/qcap/v4l.c | 11 ++++-------
dlls/qcap/vfwcapture.c | 26 +++++++++++++++++++++++++-
3 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/dlls/qcap/qcap_private.h b/dlls/qcap/qcap_private.h
index 1d2b49d7394..834994d8cac 100644
--- a/dlls/qcap/qcap_private.h
+++ b/dlls/qcap/qcap_private.h
@@ -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);
diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c
index d525989172a..db838f1efe4 100644
--- a/dlls/qcap/v4l.c
+++ b/dlls/qcap/v4l.c
@@ -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;
}
diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c
index 5c1ce9af980..62d692226c5 100644
--- a/dlls/qcap/vfwcapture.c
+++ b/dlls/qcap/vfwcapture.c
@@ -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 =
More information about the wine-cvs
mailing list