[PATCH 2/5] amstream: Implement AMDirectDrawStream::SetFormat.
Zebediah Figura
z.figura12 at gmail.com
Sat Aug 29 15:30:51 CDT 2020
On 8/29/20 8:51 AM, Anton Baskanov wrote:
> Signed-off-by: Anton Baskanov <baskanov at gmail.com>
> ---
> dlls/amstream/ddrawstream.c | 69 ++++++-
> dlls/amstream/tests/amstream.c | 347 +++++++++++++++++++++++++++++++++
> 2 files changed, 413 insertions(+), 3 deletions(-)
>
> diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c
> index 0a291f37214..a713b80be45 100644
> --- a/dlls/amstream/ddrawstream.c
> +++ b/dlls/amstream/ddrawstream.c
> @@ -401,11 +401,74 @@ static HRESULT WINAPI ddraw_IDirectDrawMediaStream_GetFormat(IDirectDrawMediaStr
> }
>
> static HRESULT WINAPI ddraw_IDirectDrawMediaStream_SetFormat(IDirectDrawMediaStream *iface,
> - const DDSURFACEDESC *pDDSurfaceDesc, IDirectDrawPalette *pDirectDrawPalette)
> + const DDSURFACEDESC *format, IDirectDrawPalette *palette)
> {
> - FIXME("(%p)->(%p,%p) stub!\n", iface, pDDSurfaceDesc, pDirectDrawPalette);
> + struct ddraw_stream *stream = impl_from_IDirectDrawMediaStream(iface);
>
> - return E_NOTIMPL;
> + TRACE("stream %p, format %p, palette %p.\n", stream, format, palette);
> +
> + if (!format)
> + return E_POINTER;
> +
> + if (format->dwSize != sizeof(DDSURFACEDESC))
> + return E_INVALIDARG;
> +
> + if (format->dwFlags & DDSD_PIXELFORMAT)
> + {
> + if (format->ddpfPixelFormat.dwSize != sizeof(DDPIXELFORMAT))
> + return DDERR_INVALIDSURFACETYPE;
> +
> + if (format->ddpfPixelFormat.dwFlags & (DDPF_YUV | DDPF_PALETTEINDEXED1 |
> + DDPF_PALETTEINDEXED2 | DDPF_PALETTEINDEXED4 | DDPF_PALETTEINDEXEDTO8))
> + return DDERR_INVALIDSURFACETYPE;
> +
> + if (!(format->ddpfPixelFormat.dwFlags & DDPF_RGB))
> + return DDERR_INVALIDSURFACETYPE;
> +
> + switch (format->ddpfPixelFormat.u1.dwRGBBitCount)
> + {
> + case 8:
> + if (!(format->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8))
> + return DDERR_INVALIDSURFACETYPE;
> + break;
> + case 16:
> + if (format->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8)
> + return DDERR_INVALIDSURFACETYPE;
> + if ((format->ddpfPixelFormat.u2.dwRBitMask != 0x7c00 ||
> + format->ddpfPixelFormat.u3.dwGBitMask != 0x03e0 ||
> + format->ddpfPixelFormat.u4.dwBBitMask != 0x001f) &&
> + (format->ddpfPixelFormat.u2.dwRBitMask != 0xf800 ||
> + format->ddpfPixelFormat.u3.dwGBitMask != 0x07e0 ||
> + format->ddpfPixelFormat.u4.dwBBitMask != 0x001f))
> + return DDERR_INVALIDSURFACETYPE;
> + break;
> + case 24:
> + case 32:
> + if (format->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8)
> + return DDERR_INVALIDSURFACETYPE;
> + if (format->ddpfPixelFormat.u2.dwRBitMask != 0xff0000 ||
> + format->ddpfPixelFormat.u3.dwGBitMask != 0x00ff00 ||
> + format->ddpfPixelFormat.u4.dwBBitMask != 0x0000ff)
> + return DDERR_INVALIDSURFACETYPE;
> + break;
> + default:
> + return DDERR_INVALIDSURFACETYPE;
> + }
> + }
> +
> + EnterCriticalSection(&stream->cs);
> +
> + stream->format.dwFlags = DDSD_CAPS | (format->dwFlags & (DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT));
> + if (format->dwFlags & DDSD_WIDTH)
> + stream->format.dwWidth = format->dwWidth;
> + if (format->dwFlags & DDSD_HEIGHT)
> + stream->format.dwHeight = format->dwHeight;
Adding a brief test for omitted width/height seems like a good idea.
I also notice that this function would ignore modified caps; is that
right? That could use a test or two as well.
> + if (format->dwFlags & DDSD_PIXELFORMAT)
> + stream->format.ddpfPixelFormat = format->ddpfPixelFormat;
> +
> + LeaveCriticalSection(&stream->cs);
> +
> + return S_OK;
> }
>
> static HRESULT WINAPI ddraw_IDirectDrawMediaStream_GetDirectDraw(IDirectDrawMediaStream *iface,
> diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
> index 934639258d6..2ce72d4f1c1 100644
> --- a/dlls/amstream/tests/amstream.c
> +++ b/dlls/amstream/tests/amstream.c
> @@ -51,6 +51,47 @@ static const AM_MEDIA_TYPE audio_mt =
> .pbFormat = (BYTE *)&audio_format,
> };
>
> +static const VIDEOINFO rgb8_video_info =
> +{
> + .bmiHeader.biSize = sizeof(BITMAPINFOHEADER),
> + .bmiHeader.biWidth = 333,
> + .bmiHeader.biHeight = -444,
> + .bmiHeader.biPlanes = 1,
> + .bmiHeader.biBitCount = 8,
> + .bmiHeader.biCompression = BI_RGB,
> +};
> +
> +static const VIDEOINFO rgb555_video_info =
> +{
> + .bmiHeader.biSize = sizeof(BITMAPINFOHEADER),
> + .bmiHeader.biWidth = 333,
> + .bmiHeader.biHeight = -444,
> + .bmiHeader.biPlanes = 1,
> + .bmiHeader.biBitCount = 16,
> + .bmiHeader.biCompression = BI_RGB,
> +};
> +
> +static const VIDEOINFO rgb565_video_info =
> +{
> + .bmiHeader.biSize = sizeof(BITMAPINFOHEADER),
> + .bmiHeader.biWidth = 333,
> + .bmiHeader.biHeight = -444,
> + .bmiHeader.biPlanes = 1,
> + .bmiHeader.biBitCount = 16,
> + .bmiHeader.biCompression = BI_BITFIELDS,
> + .dwBitMasks = {0xff0000, 0x00ff00, 0x0000ff},
> +};
> +
> +static const VIDEOINFO rgb24_video_info =
> +{
> + .bmiHeader.biSize = sizeof(BITMAPINFOHEADER),
> + .bmiHeader.biWidth = 333,
> + .bmiHeader.biHeight = -444,
> + .bmiHeader.biPlanes = 1,
> + .bmiHeader.biBitCount = 24,
> + .bmiHeader.biCompression = BI_RGB,
> +};
> +
> static const VIDEOINFO rgb32_video_info =
> {
> .bmiHeader.biSize = sizeof(BITMAPINFOHEADER),
> @@ -61,6 +102,46 @@ static const VIDEOINFO rgb32_video_info =
> .bmiHeader.biCompression = BI_RGB,
> };
>
> +static const AM_MEDIA_TYPE rgb8_mt =
> +{
> + /* MEDIATYPE_Video, MEDIASUBTYPE_RGB8, FORMAT_VideoInfo */
> + .majortype = {0x73646976, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
> + .subtype = {0xe436eb7a, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}},
> + .formattype = {0x05589f80, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}},
> + .cbFormat = sizeof(VIDEOINFO),
> + .pbFormat = (BYTE *)&rgb8_video_info,
> +};
> +
> +static const AM_MEDIA_TYPE rgb555_mt =
> +{
> + /* MEDIATYPE_Video, MEDIASUBTYPE_RGB555, FORMAT_VideoInfo */
> + .majortype = {0x73646976, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
> + .subtype = {0xe436eb7c, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}},
> + .formattype = {0x05589f80, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}},
> + .cbFormat = sizeof(VIDEOINFO),
> + .pbFormat = (BYTE *)&rgb555_video_info,
> +};
> +
> +static const AM_MEDIA_TYPE rgb565_mt =
> +{
> + /* MEDIATYPE_Video, MEDIASUBTYPE_RGB565, FORMAT_VideoInfo */
> + .majortype = {0x73646976, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
> + .subtype = {0xe436eb7b, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}},
> + .formattype = {0x05589f80, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}},
> + .cbFormat = sizeof(VIDEOINFO),
> + .pbFormat = (BYTE *)&rgb565_video_info,
> +};
> +
> +static const AM_MEDIA_TYPE rgb24_mt =
> +{
> + /* MEDIATYPE_Video, MEDIASUBTYPE_RGB24, FORMAT_VideoInfo */
> + .majortype = {0x73646976, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
> + .subtype = {0xe436eb7d, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}},
> + .formattype = {0x05589f80, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}},
> + .cbFormat = sizeof(VIDEOINFO),
> + .pbFormat = (BYTE *)&rgb24_video_info,
> +};
> +
> static const AM_MEDIA_TYPE rgb32_mt =
> {
> /* MEDIATYPE_Video, MEDIASUBTYPE_RGB32, FORMAT_VideoInfo */
> @@ -71,6 +152,63 @@ static const AM_MEDIA_TYPE rgb32_mt =
> .pbFormat = (BYTE *)&rgb32_video_info,
> };
>
> +static const DDSURFACEDESC rgb8_format =
> +{
> + .dwSize = sizeof(DDSURFACEDESC),
> + .dwFlags = DDSD_PIXELFORMAT,
> + .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT),
> + .ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED8,
> + .ddpfPixelFormat.dwRGBBitCount = 8,
> +};
> +
> +static const DDSURFACEDESC rgb555_format =
> +{
> + .dwSize = sizeof(DDSURFACEDESC),
> + .dwFlags = DDSD_PIXELFORMAT,
> + .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT),
> + .ddpfPixelFormat.dwFlags = DDPF_RGB,
> + .ddpfPixelFormat.dwRGBBitCount = 16,
> + .ddpfPixelFormat.dwRBitMask = 0x7c00,
> + .ddpfPixelFormat.dwGBitMask = 0x03e0,
> + .ddpfPixelFormat.dwBBitMask = 0x001f,
> +};
> +
> +static const DDSURFACEDESC rgb565_format =
> +{
> + .dwSize = sizeof(DDSURFACEDESC),
> + .dwFlags = DDSD_PIXELFORMAT,
> + .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT),
> + .ddpfPixelFormat.dwFlags = DDPF_RGB,
> + .ddpfPixelFormat.dwRGBBitCount = 16,
> + .ddpfPixelFormat.dwRBitMask = 0xf800,
> + .ddpfPixelFormat.dwGBitMask = 0x07e0,
> + .ddpfPixelFormat.dwBBitMask = 0x001f,
> +};
> +
> +static const DDSURFACEDESC rgb24_format =
> +{
> + .dwSize = sizeof(DDSURFACEDESC),
> + .dwFlags = DDSD_PIXELFORMAT,
> + .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT),
> + .ddpfPixelFormat.dwFlags = DDPF_RGB,
> + .ddpfPixelFormat.dwRGBBitCount = 24,
> + .ddpfPixelFormat.dwRBitMask = 0xff0000,
> + .ddpfPixelFormat.dwGBitMask = 0x00ff00,
> + .ddpfPixelFormat.dwBBitMask = 0x0000ff,
> +};
> +
> +static const DDSURFACEDESC rgb32_format =
> +{
> + .dwSize = sizeof(DDSURFACEDESC),
> + .dwFlags = DDSD_PIXELFORMAT,
> + .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT),
> + .ddpfPixelFormat.dwFlags = DDPF_RGB,
> + .ddpfPixelFormat.dwRGBBitCount = 32,
> + .ddpfPixelFormat.dwRBitMask = 0xff0000,
> + .ddpfPixelFormat.dwGBitMask = 0x00ff00,
> + .ddpfPixelFormat.dwBBitMask = 0x0000ff,
> +};
> +
> static const WCHAR primary_video_sink_id[] = L"I{A35FF56A-9FDA-11D0-8FDF-00C04FD9189D}";
> static const WCHAR primary_audio_sink_id[] = L"I{A35FF56B-9FDA-11D0-8FDF-00C04FD9189D}";
>
> @@ -4608,6 +4746,214 @@ static void test_ddrawstream_get_format(void)
> ok(!ref, "Got outstanding refcount %d.\n", ref);
> }
>
> +static void check_ddrawstream_set_format(IDirectDrawMediaStream *stream,
> + const DDSURFACEDESC *format, const AM_MEDIA_TYPE *mt, HRESULT expected_hr)
It would probably be a good idea to add a __LINE__ parameter to this,
though as far as I'm concerned it's not strictly necessary.
> +{
> + struct testfilter source;
> + FILTER_INFO filter_info;
> + PIN_INFO pin_info;
> + HRESULT hr;
> + IPin *pin;
> +
> + hr = IDirectDrawMediaStream_QueryInterface(stream, &IID_IPin, (void **)&pin);
> + ok(hr == S_OK, "Got hr %#x.\n", hr);
> + hr = IPin_QueryPinInfo(pin, &pin_info);
> + ok(hr == S_OK, "Got hr %#x.\n", hr);
> + hr = IBaseFilter_QueryFilterInfo(pin_info.pFilter, &filter_info);
> + ok(hr == S_OK, "Got hr %#x.\n", hr);
> +
> + testfilter_init(&source);
> +
> + hr = IFilterGraph_AddFilter(filter_info.pGraph, &source.filter.IBaseFilter_iface, L"source");
> + ok(hr == S_OK, "Got hr %#x.\n", hr);
> +
> + hr = IDirectDrawMediaStream_SetFormat(stream, format, NULL);
> + ok(hr == expected_hr, "Got hr %#x.\n", hr);
> +
> + if (mt)
> + {
> + DDSURFACEDESC current_format;
> + DDSURFACEDESC desired_format;
> + DWORD flags;
> +
> + hr = IFilterGraph_ConnectDirect(filter_info.pGraph, &source.source.pin.IPin_iface, pin, mt);
> + ok(hr == S_OK, "Got hr %#x.\n", hr);
> +
> + memset(¤t_format, 0xcc, sizeof(current_format));
> + memset(&desired_format, 0xcc, sizeof(desired_format));
> + flags = 0xdeadbeef;
> + current_format.dwSize = sizeof(current_format);
> + desired_format.dwSize = sizeof(desired_format);
> + hr = IDirectDrawMediaStream_GetFormat(stream, ¤t_format, NULL, &desired_format, &flags);
> + ok(hr == S_OK, "Got hr %#x.\n", hr);
> + if (format->dwFlags & DDSD_PIXELFORMAT)
> + {
> + ok(current_format.dwFlags == (DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_PIXELFORMAT),
> + "Got flags %#x.\n", current_format.dwFlags);
> + ok(memcmp(¤t_format.ddpfPixelFormat, &format->ddpfPixelFormat, sizeof(DDPIXELFORMAT)) == 0,
> + "Pixel format didn't match.\n");
> + }
> + else
> + {
> + ok(current_format.dwFlags == (DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS),
> + "Got flags %#x.\n", current_format.dwFlags);
> + }
> + ok(desired_format.dwFlags == (DDSD_WIDTH | DDSD_HEIGHT),
> + "Got flags %#x.\n", desired_format.dwFlags);
> + ok(flags == 0, "Got flags %#x.\n", flags);
> +
> + hr = IFilterGraph_Disconnect(filter_info.pGraph, &source.source.pin.IPin_iface);
> + ok(hr == S_OK, "Got hr %#x.\n", hr);
> + hr = IFilterGraph_Disconnect(filter_info.pGraph, pin);
> + ok(hr == S_OK, "Got hr %#x.\n", hr);
> + }
> +
> + hr = IFilterGraph_RemoveFilter(filter_info.pGraph, &source.filter.IBaseFilter_iface);
> + ok(hr == S_OK, "Got hr %#x.\n", hr);
> +
> + IFilterGraph_Release(filter_info.pGraph);
> + IBaseFilter_Release(pin_info.pFilter);
> + IPin_Release(pin);
> +}
> +
> +static void test_ddrawstream_set_format(void)
> +{
> + static const DDSURFACEDESC rgb1_format =
> + {
> + .dwSize = sizeof(DDSURFACEDESC),
> + .dwFlags = DDSD_PIXELFORMAT,
> + .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT),
> + .ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED1,
> + .ddpfPixelFormat.dwRGBBitCount = 1,
> + };
> + static const DDSURFACEDESC rgb2_format =
> + {
> + .dwSize = sizeof(DDSURFACEDESC),
> + .dwFlags = DDSD_PIXELFORMAT,
> + .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT),
> + .ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED2,
> + .ddpfPixelFormat.dwRGBBitCount = 2,
> + };
> + static const DDSURFACEDESC rgb4_format =
> + {
> + .dwSize = sizeof(DDSURFACEDESC),
> + .dwFlags = DDSD_PIXELFORMAT,
> + .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT),
> + .ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED4,
> + .ddpfPixelFormat.dwRGBBitCount = 4,
> + };
> + static const DDSURFACEDESC rgb4to8_format =
> + {
> + .dwSize = sizeof(DDSURFACEDESC),
> + .dwFlags = DDSD_PIXELFORMAT,
> + .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT),
> + .ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXEDTO8,
> + .ddpfPixelFormat.dwRGBBitCount = 4,
> + };
> + static const DDSURFACEDESC rgb332_format =
> + {
> + .dwSize = sizeof(DDSURFACEDESC),
> + .dwFlags = DDSD_PIXELFORMAT,
> + .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT),
> + .ddpfPixelFormat.dwFlags = DDPF_RGB,
> + .ddpfPixelFormat.dwRGBBitCount = 8,
> + .ddpfPixelFormat.dwRBitMask = 0xe0,
> + .ddpfPixelFormat.dwGBitMask = 0x1c,
> + .ddpfPixelFormat.dwBBitMask = 0x03,
> + };
> + static const DDSURFACEDESC yuv32_format =
> + {
> + .dwSize = sizeof(DDSURFACEDESC),
> + .dwFlags = DDSD_PIXELFORMAT,
> + .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT),
> + .ddpfPixelFormat.dwFlags = DDPF_YUV,
> + .ddpfPixelFormat.dwYUVBitCount = 32,
> + .ddpfPixelFormat.dwYBitMask = 0xff0000,
> + .ddpfPixelFormat.dwUBitMask = 0x00ff00,
> + .ddpfPixelFormat.dwVBitMask = 0x0000ff,
> + };
This isn't exactly an interesting YUV test, though. (I'm not even sure
if I've seen such a YUV format.) You probably want to test with things
like YUY2, UYVY, AYUV.
[I'm not immediately sure how planar formats interact with the "mask"
parameters, or if DirectDraw even supports planar formats, but if so,
I'd also test at least NV12 and YV12.]
While we're here, I'd be kind of curious to see if ARGB32 is recognized.
> +
> + IDirectDrawMediaStream *ddraw_stream;
> + IAMMultiMediaStream *mmstream;
> + DDSURFACEDESC format;
> + IMediaStream *stream;
> + HRESULT hr;
> + ULONG ref;
> +
> + mmstream = create_ammultimediastream();
> +
> + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &stream);
> + ok(hr == S_OK, "Got hr %#x.\n", hr);
> + hr = IMediaStream_QueryInterface(stream, &IID_IDirectDrawMediaStream, (void **)&ddraw_stream);
> + ok(hr == S_OK, "Got hr %#x.\n", hr);
> +
> + check_ddrawstream_set_format(ddraw_stream, &rgb8_format, &rgb8_mt, S_OK);
> + check_ddrawstream_set_format(ddraw_stream, &rgb555_format, &rgb555_mt, S_OK);
> + check_ddrawstream_set_format(ddraw_stream, &rgb565_format, &rgb565_mt, S_OK);
> + check_ddrawstream_set_format(ddraw_stream, &rgb24_format, &rgb24_mt, S_OK);
> + check_ddrawstream_set_format(ddraw_stream, &rgb32_format, &rgb32_mt, S_OK);
> +
> + format = rgb32_format;
> + format.ddpfPixelFormat.dwFlags |= DDPF_ALPHAPIXELS | DDPF_ALPHA | DDPF_FOURCC
> + | DDPF_COMPRESSED | DDPF_RGBTOYUV | DDPF_ZBUFFER | DDPF_ZPIXELS | DDPF_STENCILBUFFER
> + | DDPF_ALPHAPREMULT | DDPF_LUMINANCE | DDPF_BUMPLUMINANCE | DDPF_BUMPDUDV;
> + check_ddrawstream_set_format(ddraw_stream, &format, &rgb32_mt, S_OK);
> +
> + format = rgb8_format;
> + format.dwFlags = 0;
> + check_ddrawstream_set_format(ddraw_stream, &format, &rgb32_mt, S_OK);
> +
> + check_ddrawstream_set_format(ddraw_stream, &rgb1_format, NULL, DDERR_INVALIDSURFACETYPE);
> + check_ddrawstream_set_format(ddraw_stream, &rgb2_format, NULL, DDERR_INVALIDSURFACETYPE);
> + check_ddrawstream_set_format(ddraw_stream, &rgb4_format, NULL, DDERR_INVALIDSURFACETYPE);
> + check_ddrawstream_set_format(ddraw_stream, &rgb4to8_format, NULL, DDERR_INVALIDSURFACETYPE);
> + check_ddrawstream_set_format(ddraw_stream, &rgb332_format, NULL, DDERR_INVALIDSURFACETYPE);
> + check_ddrawstream_set_format(ddraw_stream, &yuv32_format, NULL, DDERR_INVALIDSURFACETYPE);
> +
> + format = rgb8_format;
> + format.ddpfPixelFormat.dwFlags &= ~DDPF_RGB;
> + check_ddrawstream_set_format(ddraw_stream, &format, NULL, DDERR_INVALIDSURFACETYPE);
> +
> + format = rgb8_format;
> + format.ddpfPixelFormat.dwFlags |= DDPF_PALETTEINDEXED1;
> + check_ddrawstream_set_format(ddraw_stream, &format, NULL, DDERR_INVALIDSURFACETYPE);
> +
> + format = rgb32_format;
> + format.ddpfPixelFormat.dwFlags |= DDPF_PALETTEINDEXED8;
> + check_ddrawstream_set_format(ddraw_stream, &format, NULL, DDERR_INVALIDSURFACETYPE);
> +
> + format = rgb32_format;
> + format.ddpfPixelFormat.dwFlags |= DDPF_YUV;
> + check_ddrawstream_set_format(ddraw_stream, &format, NULL, DDERR_INVALIDSURFACETYPE);
> +
> + format = rgb565_format;
> + format.ddpfPixelFormat.dwRBitMask = 0x001f;
> + format.ddpfPixelFormat.dwGBitMask = 0x07e0;
> + format.ddpfPixelFormat.dwBBitMask = 0xf800;
> + check_ddrawstream_set_format(ddraw_stream, &format, NULL, DDERR_INVALIDSURFACETYPE);
> +
> + format = rgb32_format;
> + format.ddpfPixelFormat.dwRBitMask = 0x00ff00;
> + format.ddpfPixelFormat.dwGBitMask = 0x0000ff;
> + format.ddpfPixelFormat.dwBBitMask = 0xff0000;
> + check_ddrawstream_set_format(ddraw_stream, &format, NULL, DDERR_INVALIDSURFACETYPE);
> +
> + format = rgb32_format;
> + format.dwSize = sizeof(DDSURFACEDESC) + 1;
> + check_ddrawstream_set_format(ddraw_stream, &format, NULL, E_INVALIDARG);
> +
> + format = rgb32_format;
> + format.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT) + 1;
> + check_ddrawstream_set_format(ddraw_stream, &format, NULL, DDERR_INVALIDSURFACETYPE);
> +
> + ref = IAMMultiMediaStream_Release(mmstream);
> + ok(!ref, "Got outstanding refcount %d.\n", ref);
> + IDirectDrawMediaStream_Release(ddraw_stream);
> + ref = IMediaStream_Release(stream);
> + ok(!ref, "Got outstanding refcount %d.\n", ref);
> +
> +}
> +
> static void check_ammediastream_join_am_multi_media_stream(const CLSID *clsid)
> {
> IAMMultiMediaStream *mmstream = create_ammultimediastream();
> @@ -6071,6 +6417,7 @@ START_TEST(amstream)
> test_ddrawstream_receive_connection();
> test_ddrawstream_create_sample();
> test_ddrawstream_get_format();
> + test_ddrawstream_set_format();
>
> test_ddrawstreamsample_get_media_stream();
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20200829/f83ef21d/attachment-0001.sig>
More information about the wine-devel
mailing list