[PATCH v2 3/4] qcap: Pass a single AM_MEDIA_TYPE pointer to get_format().
Zebediah Figura
z.figura12 at gmail.com
Mon Jun 29 10:26:17 CDT 2020
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/qcap/qcap_private.h | 2 +-
dlls/qcap/v4l.c | 8 ++------
dlls/qcap/vfwcapture.c | 12 +++++++-----
3 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/dlls/qcap/qcap_private.h b/dlls/qcap/qcap_private.h
index 823f8fed93..70a8c85ad4 100644
--- a/dlls/qcap/qcap_private.h
+++ b/dlls/qcap/qcap_private.h
@@ -50,7 +50,7 @@ struct video_capture_device_ops
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);
+ HRESULT (*get_format)(struct video_capture_device *device, AM_MEDIA_TYPE *mt);
HRESULT (*get_caps)(struct video_capture_device *device, LONG index, AM_MEDIA_TYPE **mt, 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,
diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c
index 5c2de2e3d6..2cf50b0c28 100644
--- a/dlls/qcap/v4l.c
+++ b/dlls/qcap/v4l.c
@@ -212,15 +212,11 @@ static HRESULT v4l_device_set_format(struct video_capture_device *iface, const A
return S_OK;
}
-static HRESULT v4l_device_get_format(struct video_capture_device *iface, AM_MEDIA_TYPE **mt)
+static HRESULT v4l_device_get_format(struct video_capture_device *iface, AM_MEDIA_TYPE *mt)
{
struct v4l_device *device = v4l_device(iface);
- *mt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
- if (!*mt)
- return E_OUTOFMEMORY;
-
- return CopyMediaType(*mt, &device->current_caps->media_type);
+ return CopyMediaType(mt, &device->current_caps->media_type);
}
static __u32 v4l2_cid_from_qcap_property(VideoProcAmpProperty property)
diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c
index 9f4b859863..7d82a01109 100644
--- a/dlls/qcap/vfwcapture.c
+++ b/dlls/qcap/vfwcapture.c
@@ -223,16 +223,18 @@ AMStreamConfig_SetFormat(IAMStreamConfig *iface, AM_MEDIA_TYPE *pmt)
return hr;
}
-static HRESULT WINAPI AMStreamConfig_GetFormat(IAMStreamConfig *iface, AM_MEDIA_TYPE **pmt)
+static HRESULT WINAPI AMStreamConfig_GetFormat(IAMStreamConfig *iface, AM_MEDIA_TYPE **mt)
{
VfwCapture *filter = impl_from_IAMStreamConfig(iface);
HRESULT hr;
- TRACE("filter %p, mt %p.\n", filter, pmt);
+ TRACE("filter %p, mt %p.\n", filter, mt);
- hr = filter->device->ops->get_format(filter->device, pmt);
- if (SUCCEEDED(hr))
- strmbase_dump_media_type(*pmt);
+ if (!(*mt = CoTaskMemAlloc(sizeof(**mt))))
+ return E_OUTOFMEMORY;
+
+ if (SUCCEEDED(hr = filter->device->ops->get_format(filter->device, *mt)))
+ strmbase_dump_media_type(*mt);
return hr;
}
--
2.27.0
More information about the wine-devel
mailing list