evr: Added MFIsFormatYUV().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-08-02 13:00:08 +03:00 committed by Alexandre Julliard
parent 8c47f02cb5
commit 68d75bbded
4 changed files with 70 additions and 1 deletions

View File

@ -25,4 +25,4 @@
@ stub MFGetUncompressedVideoFormat
@ stub MFInitVideoFormat
@ stdcall -import MFInitVideoFormat_RGB(ptr long long long)
@ stub MFIsFormatYUV
@ stdcall MFIsFormatYUV(long)

View File

@ -25,6 +25,7 @@
#include "ole2.h"
#include "rpcproxy.h"
#include "d3d9.h"
#include "evr_private.h"
@ -206,3 +207,28 @@ HRESULT WINAPI MFCreateVideoMixerAndPresenter(IUnknown *mixer_outer, IUnknown *p
return hr;
}
/***********************************************************************
* MFIsFormatYUV (evr.@)
*/
BOOL WINAPI MFIsFormatYUV(DWORD format)
{
TRACE("%s.\n", debugstr_an((char *)&format, 4));
switch (format)
{
case D3DFMT_UYVY:
case D3DFMT_YUY2:
case MAKEFOURCC('A','Y','U','V'):
case MAKEFOURCC('I','M','C','1'):
case MAKEFOURCC('I','M','C','2'):
case MAKEFOURCC('Y','V','1','2'):
case MAKEFOURCC('N','V','1','1'):
case MAKEFOURCC('N','V','1','2'):
case MAKEFOURCC('Y','2','1','0'):
case MAKEFOURCC('Y','2','1','6'):
return TRUE;
default:
return FALSE;
}
}

View File

@ -2722,6 +2722,47 @@ done:
DestroyWindow(window);
}
static void test_MFIsFormatYUV(void)
{
static const DWORD formats[] =
{
D3DFMT_UYVY,
D3DFMT_YUY2,
MAKEFOURCC('A','Y','U','V'),
MAKEFOURCC('I','M','C','1'),
MAKEFOURCC('I','M','C','2'),
MAKEFOURCC('Y','V','1','2'),
MAKEFOURCC('N','V','1','1'),
MAKEFOURCC('N','V','1','2'),
MAKEFOURCC('Y','2','1','0'),
MAKEFOURCC('Y','2','1','6'),
};
static const DWORD unsupported_formats[] =
{
D3DFMT_A8R8G8B8,
MAKEFOURCC('I','Y','U','V'),
MAKEFOURCC('I','4','2','0'),
MAKEFOURCC('Y','V','Y','U'),
MAKEFOURCC('Y','V','U','9'),
MAKEFOURCC('Y','4','1','0'),
MAKEFOURCC('Y','4','1','6'),
};
unsigned int i;
BOOL ret;
for (i = 0; i < ARRAY_SIZE(formats); ++i)
{
ret = MFIsFormatYUV(formats[i]);
ok(ret, "Unexpected ret %d, format %s.\n", ret, debugstr_an((char *)&formats[i], 4));
}
for (i = 0; i < ARRAY_SIZE(unsupported_formats); ++i)
{
ret = MFIsFormatYUV(unsupported_formats[i]);
ok(!ret, "Unexpected ret %d, format %s.\n", ret, debugstr_an((char *)&unsupported_formats[i], 4));
}
}
START_TEST(evr)
{
CoInitialize(NULL);
@ -2746,6 +2787,7 @@ START_TEST(evr)
test_mixer_output_rectangle();
test_mixer_zorder();
test_mixer_samples();
test_MFIsFormatYUV();
CoUninitialize();
}

View File

@ -558,6 +558,7 @@ HRESULT WINAPI MFTEnum2(GUID category, UINT32 flags, const MFT_REGISTER_TYPE_INF
HRESULT WINAPI MFTEnumEx(GUID category, UINT32 flags, const MFT_REGISTER_TYPE_INFO *input_type,
const MFT_REGISTER_TYPE_INFO *output_type, IMFActivate ***activate,
UINT32 *pcount);
BOOL WINAPI MFIsFormatYUV(DWORD format);
HRESULT WINAPI MFInitAttributesFromBlob(IMFAttributes *attributes, const UINT8 *buffer, UINT size);
HRESULT WINAPI MFInitMediaTypeFromWaveFormatEx(IMFMediaType *mediatype, const WAVEFORMATEX *format, UINT32 size);
HRESULT WINAPI MFInitVideoFormat_RGB(MFVIDEOFORMAT *format, DWORD width, DWORD height, DWORD d3dformat);