Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/evr.spec | 2 +- dlls/evr/main.c | 26 ++++++++++++++++++++++++++ dlls/evr/tests/evr.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/mfapi.h | 1 + 4 files changed, 70 insertions(+), 1 deletion(-)
diff --git a/dlls/evr/evr.spec b/dlls/evr/evr.spec index 8aea0a607a8..fd96781e903 100644 --- a/dlls/evr/evr.spec +++ b/dlls/evr/evr.spec @@ -25,4 +25,4 @@ @ stub MFGetUncompressedVideoFormat @ stub MFInitVideoFormat @ stdcall -import MFInitVideoFormat_RGB(ptr long long long) -@ stub MFIsFormatYUV +@ stdcall MFIsFormatYUV(long) diff --git a/dlls/evr/main.c b/dlls/evr/main.c index e843f15c04f..b5bab74c4f6 100644 --- a/dlls/evr/main.c +++ b/dlls/evr/main.c @@ -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; + } +} diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index d240ebe4456..01edda7bc9b 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -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(); } diff --git a/include/mfapi.h b/include/mfapi.h index 382210ad9e2..bcb5d26121e 100644 --- a/include/mfapi.h +++ b/include/mfapi.h @@ -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);