Zebediah Figura : qcap: Directly pass a VIDEOINFOHEADER pointer to the get_format() operation.
Alexandre Julliard
julliard at winehq.org
Thu Nov 26 16:30:59 CST 2020
Module: wine
Branch: master
Commit: 82abcec541a5f85d1c2c798f8ebebd85837e9c22
URL: https://source.winehq.org/git/wine.git/?a=commit;h=82abcec541a5f85d1c2c798f8ebebd85837e9c22
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Wed Nov 25 17:43:38 2020 -0600
qcap: Directly pass a VIDEOINFOHEADER pointer to the get_format() 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 | 2 +-
dlls/qcap/v4l.c | 5 +++--
dlls/qcap/vfwcapture.c | 24 ++++++++++++++++++++++--
3 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/dlls/qcap/qcap_private.h b/dlls/qcap/qcap_private.h
index e2f032d2079..50bc2525f0e 100644
--- a/dlls/qcap/qcap_private.h
+++ b/dlls/qcap/qcap_private.h
@@ -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);
diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c
index e0a6593a024..dd002f7b3ea 100644
--- a/dlls/qcap/v4l.c
+++ b/dlls/qcap/v4l.c
@@ -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,
diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c
index 09cb7e36cc2..e98e97b7816 100644
--- a/dlls/qcap/vfwcapture.c
+++ b/dlls/qcap/vfwcapture.c
@@ -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;
}
More information about the wine-cvs
mailing list