From: Brendan McGrath <bmcgrath@codeweavers.com> --- dlls/quartz/colorconv.c | 52 +++++++++++++++++++++++++++++++++++ dlls/quartz/tests/colorconv.c | 2 -- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/dlls/quartz/colorconv.c b/dlls/quartz/colorconv.c index f91a6eb9f0b..e60f34fa5a4 100644 --- a/dlls/quartz/colorconv.c +++ b/dlls/quartz/colorconv.c @@ -152,9 +152,61 @@ static HRESULT color_source_query_interface(struct strmbase_pin *iface, REFIID i return S_OK; } +static HRESULT color_source_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt) +{ + struct color_converter *filter = impl_from_strmbase_filter(iface->filter); + const VIDEOINFOHEADER *sink_format; + const struct subtype *subtype; + VIDEOINFO *format; + + if (!filter->sink.pin.peer || index >= ARRAY_SIZE(subtypes)) + return VFW_S_NO_MORE_ITEMS; + + subtype = subtypes + index; + sink_format = (VIDEOINFOHEADER *)filter->sink.pin.mt.pbFormat; + + memset(mt, 0, sizeof(AM_MEDIA_TYPE)); + + if (!(format = CoTaskMemAlloc(mt->cbFormat = subtype->cbFormat))) + return E_OUTOFMEMORY; + + memset(format, 0, mt->cbFormat); + + format->rcSource = sink_format->rcSource; + format->rcTarget = sink_format->rcTarget; + format->dwBitRate = sink_format->dwBitRate; + format->dwBitErrorRate = sink_format->dwBitErrorRate; + format->AvgTimePerFrame = sink_format->AvgTimePerFrame; + + format->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + format->bmiHeader.biWidth = sink_format->bmiHeader.biWidth; + format->bmiHeader.biHeight = sink_format->bmiHeader.biHeight; + format->bmiHeader.biPlanes = sink_format->bmiHeader.biPlanes; + format->bmiHeader.biBitCount = subtype->bitcount; + format->bmiHeader.biCompression = subtype->compression; + format->bmiHeader.biSizeImage = format->bmiHeader.biHeight * format->bmiHeader.biWidth * (subtype->bitcount / 8); + + if (IsEqualGUID(subtype->guid, &MEDIASUBTYPE_RGB565)) + { + format->dwBitMasks[iRED] = 0xf800; + format->dwBitMasks[iGREEN] = 0x07e0; + format->dwBitMasks[iBLUE] = 0x001f; + } + + mt->majortype = MEDIATYPE_Video; + mt->subtype = *subtype->guid; + mt->bFixedSizeSamples = TRUE; + mt->lSampleSize = format->bmiHeader.biSizeImage; + mt->formattype = FORMAT_VideoInfo; + mt->pbFormat = (BYTE *)format; + + return S_OK; +} + static const struct strmbase_source_ops source_ops = { .base.pin_query_interface = color_source_query_interface, + .base.pin_get_media_type = color_source_get_media_type, .pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection, .pfnDecideAllocator = BaseOutputPinImpl_DecideAllocator, .pfnDecideBufferSize = color_source_DecideBufferSize, diff --git a/dlls/quartz/tests/colorconv.c b/dlls/quartz/tests/colorconv.c index 97ff64713a3..7dd01b9313f 100644 --- a/dlls/quartz/tests/colorconv.c +++ b/dlls/quartz/tests/colorconv.c @@ -1352,9 +1352,7 @@ static void test_media_types(void) ok(hr == S_OK, "Got hr %#lx.\n", hr); hr = IEnumMediaTypes_Next(enum_types, ARRAY_SIZE(subtypes), media_types, &num_types); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(num_types == 6, "Got num_types %lu.\n", num_types); mt = req_mt; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11679