From: zhineng cao <czn0601@qq.com> --- dlls/qcap/tests/videocapture.c | 22 ++++++++++++++++++++++ dlls/qcap/v4l.c | 2 ++ 2 files changed, 24 insertions(+) diff --git a/dlls/qcap/tests/videocapture.c b/dlls/qcap/tests/videocapture.c index 13fd45b618c..7902d406e46 100644 --- a/dlls/qcap/tests/videocapture.c +++ b/dlls/qcap/tests/videocapture.c @@ -23,6 +23,7 @@ #include "dshow.h" #include "wine/test.h" #include "wine/strmbase.h" +#include <dvdmedia.h> static BOOL compare_media_types(const AM_MEDIA_TYPE *a, const AM_MEDIA_TYPE *b) { @@ -30,6 +31,22 @@ static BOOL compare_media_types(const AM_MEDIA_TYPE *a, const AM_MEDIA_TYPE *b) && !memcmp(a->pbFormat, b->pbFormat, a->cbFormat); } +static void check_stream_media_type(const AM_MEDIA_TYPE *format) +{ + ok(!format->pUnk, "Expected NULL pUnk, got %p.\n", format->pUnk); + + if (IsEqualGUID(&format->formattype, &FORMAT_VideoInfo)) + { + ok(format->cbFormat >= sizeof(VIDEOINFOHEADER), "Got cbFormat %lu.\n", format->cbFormat); + ok(!!format->pbFormat, "Expected format block.\n"); + } + else if (IsEqualGUID(&format->formattype, &FORMAT_VideoInfo2)) + { + ok(format->cbFormat == sizeof(VIDEOINFOHEADER2), "Got cbFormat %lu.\n", format->cbFormat); + ok(!!format->pbFormat, "Expected format block.\n"); + } +} + #define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) { @@ -117,6 +134,7 @@ static void test_stream_config(IPin *pin) hr = IAMStreamConfig_GetFormat(stream_config, &format); ok(hr == S_OK, "Got hr %#lx.\n", hr); + check_stream_media_type(format); ok(IsEqualGUID(&format->majortype, &MEDIATYPE_Video), "Got wrong majortype: %s.\n", debugstr_guid(&format->majortype)); @@ -155,6 +173,7 @@ static void test_stream_config(IPin *pin) hr = IAMStreamConfig_GetFormat(stream_config, &format2); ok(hr == S_OK, "Got hr %#lx.\n", hr); + check_stream_media_type(format2); ok(IsEqualGUID(&format2->majortype, &MEDIATYPE_Video), "Got wrong majortype: %s.\n", debugstr_guid(&format2->majortype)); video_info2 = (VIDEOINFOHEADER *)format2->pbFormat; @@ -203,6 +222,7 @@ static void test_stream_config(IPin *pin) { hr = IAMStreamConfig_GetStreamCaps(stream_config, i, &format, (BYTE *)&vscc); ok(hr == S_OK, "Got hr %#lx.\n", hr); + check_stream_media_type(format); for (unsigned int j = 0; j < ARRAY_SIZE(formats); ++j) { @@ -217,6 +237,7 @@ static void test_stream_config(IPin *pin) { hr = IAMStreamConfig_GetStreamCaps(stream_config, i, &format, (BYTE *)&vscc); ok(hr == S_OK, "Got hr %#lx.\n", hr); + check_stream_media_type(format); ok(IsEqualGUID(&format->majortype, &MEDIATYPE_Video), "Got wrong majortype: %s.\n", debugstr_guid(&MEDIATYPE_Video)); ok(IsEqualGUID(&vscc.guid, &FORMAT_VideoInfo) @@ -228,6 +249,7 @@ static void test_stream_config(IPin *pin) hr = IAMStreamConfig_GetFormat(stream_config, &format2); ok(hr == S_OK, "Got hr %#lx.\n", hr); + check_stream_media_type(format2); ok(compare_media_types(format, format2), "Media types didn't match.\n"); DeleteMediaType(format2); diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c index a963372b7bf..04f61b8babb 100644 --- a/dlls/qcap/v4l.c +++ b/dlls/qcap/v4l.c @@ -698,6 +698,8 @@ static void put_media_type( const AM_MEDIA_TYPE *mt, struct am_media_type32 *mt3 mt32->bTemporalCompression = mt->bTemporalCompression; mt32->lSampleSize = mt->lSampleSize; mt32->formattype = mt->formattype; + mt32->pUnk = 0; + mt32->cbFormat = mt->cbFormat; } static NTSTATUS wow64_v4l_device_create( void *args ) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10269