mf/tests: Add some tests for video processor MFT.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-06-03 13:11:34 +03:00 committed by Alexandre Julliard
parent d9cd07fd4e
commit 9175a5f993
5 changed files with 193 additions and 1 deletions

View File

@ -30,6 +30,8 @@
#include "ole2.h" #include "ole2.h"
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
DEFINE_GUID(MFVideoFormat_P208, 0x38303250, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
DEFINE_GUID(MFVideoFormat_ABGR32, 0x00000020, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
#undef INITGUID #undef INITGUID
#include <guiddef.h> #include <guiddef.h>
@ -2021,6 +2023,158 @@ todo_wine
ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr); ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
} }
static BOOL is_supported_video_type(const GUID *guid)
{
return IsEqualGUID(guid, &MFVideoFormat_L8)
|| IsEqualGUID(guid, &MFVideoFormat_L16)
|| IsEqualGUID(guid, &MFVideoFormat_D16)
|| IsEqualGUID(guid, &MFVideoFormat_IYUV)
|| IsEqualGUID(guid, &MFVideoFormat_YV12)
|| IsEqualGUID(guid, &MFVideoFormat_NV12)
|| IsEqualGUID(guid, &MFVideoFormat_420O)
|| IsEqualGUID(guid, &MFVideoFormat_P010)
|| IsEqualGUID(guid, &MFVideoFormat_P016)
|| IsEqualGUID(guid, &MFVideoFormat_UYVY)
|| IsEqualGUID(guid, &MFVideoFormat_YUY2)
|| IsEqualGUID(guid, &MFVideoFormat_P208)
|| IsEqualGUID(guid, &MFVideoFormat_NV11)
|| IsEqualGUID(guid, &MFVideoFormat_AYUV)
|| IsEqualGUID(guid, &MFVideoFormat_ARGB32)
|| IsEqualGUID(guid, &MFVideoFormat_RGB32)
|| IsEqualGUID(guid, &MFVideoFormat_A2R10G10B10)
|| IsEqualGUID(guid, &MFVideoFormat_A16B16G16R16F)
|| IsEqualGUID(guid, &MFVideoFormat_RGB24)
|| IsEqualGUID(guid, &MFVideoFormat_I420)
|| IsEqualGUID(guid, &MFVideoFormat_YVYU)
|| IsEqualGUID(guid, &MFVideoFormat_RGB555)
|| IsEqualGUID(guid, &MFVideoFormat_RGB565)
|| IsEqualGUID(guid, &MFVideoFormat_RGB8)
|| IsEqualGUID(guid, &MFVideoFormat_Y216)
|| IsEqualGUID(guid, &MFVideoFormat_v410)
|| IsEqualGUID(guid, &MFVideoFormat_Y41P)
|| IsEqualGUID(guid, &MFVideoFormat_Y41T)
|| IsEqualGUID(guid, &MFVideoFormat_Y42T)
|| IsEqualGUID(guid, &MFVideoFormat_ABGR32);
}
static void test_video_processor(void)
{
DWORD input_count, output_count, input_id, output_id, flags;
DWORD input_min, input_max, output_min, output_max, i, count;
IMFAttributes *attributes, *attributes2;
IMFMediaType *media_type;
IMFTransform *transform;
HRESULT hr;
GUID guid;
hr = CoInitialize(NULL);
ok(hr == S_OK, "Failed to initialize, hr %#x.\n", hr);
hr = CoCreateInstance(&CLSID_VideoProcessorMFT, NULL, CLSCTX_INPROC_SERVER, &IID_IMFTransform,
(void **)&transform);
todo_wine
ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG), "Failed to create video processor transform, hr %#x.\n", hr);
if (FAILED(hr))
goto failed;
/* Transform global attributes. */
hr = IMFTransform_GetAttributes(transform, &attributes);
ok(hr == S_OK, "Failed to get attributes, hr %#x.\n", hr);
hr = IMFTransform_GetAttributes(transform, &attributes2);
ok(hr == S_OK, "Failed to get attributes, hr %#x.\n", hr);
ok(attributes == attributes2, "Unexpected instance.\n");
IMFAttributes_Release(attributes);
IMFAttributes_Release(attributes2);
hr = IMFTransform_GetStreamLimits(transform, &input_min, &input_max, &output_min, &output_max);
ok(hr == S_OK, "Failed to get stream limits, hr %#x.\n", hr);
ok(input_min == input_max && input_min == 1 && output_min == output_max && output_min == 1,
"Unexpected stream limits.\n");
hr = IMFTransform_GetStreamCount(transform, &input_count, &output_count);
ok(hr == S_OK, "Failed to get stream count, hr %#x.\n", hr);
ok(input_count == 1 && output_count == 1, "Unexpected stream count %u, %u.\n", input_count, output_count);
hr = IMFTransform_GetStreamIDs(transform, 1, &input_id, 1, &output_id);
ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
input_id = 100;
hr = IMFTransform_AddInputStreams(transform, 1, &input_id);
ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_DeleteInputStream(transform, 0);
ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_GetInputStatus(transform, 0, &flags);
ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_GetInputStreamAttributes(transform, 0, &attributes);
ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_GetOutputStatus(transform, &flags);
ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_GetOutputStreamAttributes(transform, 0, &attributes);
ok(hr == S_OK, "Failed to get output attributes, hr %#x.\n", hr);
hr = IMFTransform_GetOutputStreamAttributes(transform, 0, &attributes2);
ok(hr == S_OK, "Failed to get output attributes, hr %#x.\n", hr);
ok(attributes == attributes2, "Unexpected instance.\n");
IMFAttributes_Release(attributes);
IMFAttributes_Release(attributes2);
for (i = 0;;++i)
{
hr = IMFTransform_GetInputAvailableType(transform, 0, i, &media_type);
if (hr == MF_E_NO_MORE_TYPES)
break;
ok(hr == S_OK, "Failed to get supported input type, hr %#x.\n", hr);
hr = IMFMediaType_GetMajorType(media_type, &guid);
ok(hr == S_OK, "Failed to get major type, hr %#x.\n", hr);
ok(IsEqualGUID(&guid, &MFMediaType_Video), "Unexpected major type.\n");
IMFMediaType_Release(media_type);
}
hr = IMFTransform_GetOutputAvailableType(transform, 0, 0, &media_type);
ok(hr == MF_E_NO_MORE_TYPES, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type);
ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_GetInputCurrentType(transform, 1, &media_type);
ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type);
ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_GetOutputCurrentType(transform, 1, &media_type);
ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#x.\n", hr);
/* Configure stream types. */
for (i = 0;;++i)
{
if (FAILED(hr = IMFTransform_GetInputAvailableType(transform, 0, i, &media_type)))
break;
hr = IMFMediaType_GetCount(media_type, &count);
ok(hr == S_OK, "Failed to get attributes count, hr %#x.\n", hr);
ok(count == 2, "Unexpected count %u.\n", count);
hr = IMFMediaType_GetGUID(media_type, &MF_MT_SUBTYPE, &guid);
ok(hr == S_OK, "Failed to get subtype, hr %#x.\n", hr);
ok(is_supported_video_type(&guid), "Unexpected media type %s.\n", wine_dbgstr_guid(&guid));
IMFMediaType_Release(media_type);
}
IMFTransform_Release(transform);
failed:
CoUninitialize();
}
START_TEST(mf) START_TEST(mf)
{ {
test_topology(); test_topology();
@ -2031,4 +2185,5 @@ START_TEST(mf)
test_MFShutdownObject(); test_MFShutdownObject();
test_presentation_clock(); test_presentation_clock();
test_sample_grabber(); test_sample_grabber();
test_video_processor();
} }

View File

@ -44,8 +44,10 @@ extern "C" {
((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 )) ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
#endif #endif
#ifndef DEFINE_MEDIATYPE_GUID
#define DEFINE_MEDIATYPE_GUID(name, format) \ #define DEFINE_MEDIATYPE_GUID(name, format) \
DEFINE_GUID(name, format, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); DEFINE_GUID(name, format, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
#endif
#ifndef DIRECT3D_VERSION #ifndef DIRECT3D_VERSION
#define LOCAL_D3DFMT_DEFINES 1 #define LOCAL_D3DFMT_DEFINES 1

View File

@ -121,6 +121,34 @@
#define MF_E_TOPO_MISSING_SOURCE _HRESULT_TYPEDEF_(0xc00d521a) #define MF_E_TOPO_MISSING_SOURCE _HRESULT_TYPEDEF_(0xc00d521a)
#define MF_E_TOPO_SINK_ACTIVATES_UNSUPPORTED _HRESULT_TYPEDEF_(0xc00d521b) #define MF_E_TOPO_SINK_ACTIVATES_UNSUPPORTED _HRESULT_TYPEDEF_(0xc00d521b)
#define MF_E_TRANSFORM_TYPE_NOT_SET _HRESULT_TYPEDEF_(0xc00d6d60)
#define MF_E_TRANSFORM_STREAM_CHANGE _HRESULT_TYPEDEF_(0xc00d6d61)
#define MF_E_TRANSFORM_INPUT_REMAINING _HRESULT_TYPEDEF_(0xc00d6d62)
#define MF_E_TRANSFORM_PROFILE_MISSING _HRESULT_TYPEDEF_(0xc00d6d63)
#define MF_E_TRANSFORM_PROFILE_INVALID_OR_CORRUPT _HRESULT_TYPEDEF_(0xc00d6d64)
#define MF_E_TRANSFORM_PROFILE_TRUNCATED _HRESULT_TYPEDEF_(0xc00d6d65)
#define MF_E_TRANSFORM_PROPERTY_PID_NOT_RECOGNIZED _HRESULT_TYPEDEF_(0xc00d6d66)
#define MF_E_TRANSFORM_PROPERTY_VARIANT_TYPE_WRONG _HRESULT_TYPEDEF_(0xc00d6d67)
#define MF_E_TRANSFORM_PROPERTY_NOT_WRITEABLE _HRESULT_TYPEDEF_(0xc00d6d68)
#define MF_E_TRANSFORM_PROPERTY_ARRAY_VALUE_WRONG_NUM_DIM _HRESULT_TYPEDEF_(0xc00d6d69)
#define MF_E_TRANSFORM_PROPERTY_VALUE_SIZE_WRONG _HRESULT_TYPEDEF_(0xc00d6d6a)
#define MF_E_TRANSFORM_PROPERTY_VALUE_OUT_OF_RANGE _HRESULT_TYPEDEF_(0xc00d6d6b)
#define MF_E_TRANSFORM_PROPERTY_VALUE_INCOMPATIBLE _HRESULT_TYPEDEF_(0xc00d6d6c)
#define MF_E_TRANSFORM_NOT_POSSIBLE_FOR_CURRENT_OUTPUT_MEDIATYPE _HRESULT_TYPEDEF_(0xc00d6d6d)
#define MF_E_TRANSFORM_NOT_POSSIBLE_FOR_CURRENT_INPUT_MEDIATYPE _HRESULT_TYPEDEF_(0xc00d6d6e)
#define MF_E_TRANSFORM_NOT_POSSIBLE_FOR_CURRENT_MEDIATYPE_COMBINATION _HRESULT_TYPEDEF_(0xc00d6d6f)
#define MF_E_TRANSFORM_CONFLICTS_WITH_OTHER_CURRENTLY_ENABLED_FEATURES _HRESULT_TYPEDEF_(0xc00d6d70)
#define MF_E_TRANSFORM_NEED_MORE_INPUT _HRESULT_TYPEDEF_(0xc00d6d72)
#define MF_E_TRANSFORM_NOT_POSSIBLE_FOR_CURRENT_SPKR_CONFIG _HRESULT_TYPEDEF_(0xc00d6d73)
#define MF_E_TRANSFORM_CANNOT_CHANGE_MEDIATYPE_WHILE_PROCESSING _HRESULT_TYPEDEF_(0xc00d6d74)
#define MF_S_TRANSFORM_DO_NOT_PROPAGATE_EVENT _HRESULT_TYPEDEF_(0x000d6d75)
#define MF_E_UNSUPPORTED_D3D_TYPE _HRESULT_TYPEDEF_(0xc00d6d76)
#define MF_E_TRANSFORM_ASYNC_LOCKED _HRESULT_TYPEDEF_(0xc00d6d77)
#define MF_E_TRANSFORM_CANNOT_INITIALIZE_ACM_DRIVER _HRESULT_TYPEDEF_(0xc00d6d78)
#define MF_E_TRANSFORM_STREAM_INVALID_RESOLUTION _HRESULT_TYPEDEF_(0xc00d6d79)
#define MF_E_TRANSFORM_ASYNC_MFT_NOT_SUPPORTED _HRESULT_TYPEDEF_(0xc00d6d7a)
#define MF_E_TRANSFORM_EXATTRIBUTE_NOT_SUPPORTED _HRESULT_TYPEDEF_(0xc00d6d7c)
#define MF_E_CLOCK_NO_TIME_SOURCE _HRESULT_TYPEDEF_(0xc00d9c41) #define MF_E_CLOCK_NO_TIME_SOURCE _HRESULT_TYPEDEF_(0xc00d9c41)
#define MF_E_CLOCK_STATE_ALREADY_SET _HRESULT_TYPEDEF_(0xc00d9c42) #define MF_E_CLOCK_STATE_ALREADY_SET _HRESULT_TYPEDEF_(0xc00d9c42)

View File

@ -823,3 +823,5 @@ cpp_quote("EXTERN_GUID(MF_RATE_CONTROL_SERVICE, 0x866fa297, 0xb802, 0x4bf8, 0x9d
cpp_quote("EXTERN_GUID(MF_SAMPLEGRABBERSINK_SAMPLE_TIME_OFFSET, 0x62e3d776, 0x8100, 0x4e03, 0xa6, 0xe8, 0xbd, 0x38, 0x57, 0xac, 0x9c, 0x47);") cpp_quote("EXTERN_GUID(MF_SAMPLEGRABBERSINK_SAMPLE_TIME_OFFSET, 0x62e3d776, 0x8100, 0x4e03, 0xa6, 0xe8, 0xbd, 0x38, 0x57, 0xac, 0x9c, 0x47);")
cpp_quote("EXTERN_GUID(MF_SAMPLEGRABBERSINK_IGNORE_CLOCK, 0x0efda2c0, 0x2b69, 0x4e2e, 0xab, 0x8d, 0x46, 0xdc, 0xbf, 0xf7, 0xd2, 0x5d);") cpp_quote("EXTERN_GUID(MF_SAMPLEGRABBERSINK_IGNORE_CLOCK, 0x0efda2c0, 0x2b69, 0x4e2e, 0xab, 0x8d, 0x46, 0xdc, 0xbf, 0xf7, 0xd2, 0x5d);")
cpp_quote("EXTERN_GUID(CLSID_VideoProcessorMFT, 0x88753b26, 0x5b24, 0x49bd, 0xb2, 0xe7, 0xc, 0x44, 0x5c, 0x78, 0xc9, 0x82);")

View File

@ -42,7 +42,7 @@ typedef struct _MFT_OUTPUT_DATA_BUFFER
IMFCollection *pEvents; IMFCollection *pEvents;
} MFT_OUTPUT_DATA_BUFFER, *PMFT_OUTPUT_DATA_BUFFER; } MFT_OUTPUT_DATA_BUFFER, *PMFT_OUTPUT_DATA_BUFFER;
typedef enum _MFT_MESSAGE_TYPE typedef [v1_enum] enum _MFT_MESSAGE_TYPE
{ {
MFT_MESSAGE_COMMAND_FLUSH = 0x00000000, MFT_MESSAGE_COMMAND_FLUSH = 0x00000000,
MFT_MESSAGE_COMMAND_DRAIN = 0x00000001, MFT_MESSAGE_COMMAND_DRAIN = 0x00000001,
@ -56,6 +56,11 @@ typedef enum _MFT_MESSAGE_TYPE
MFT_MESSAGE_COMMAND_MARKER = 0x20000000 MFT_MESSAGE_COMMAND_MARKER = 0x20000000
} MFT_MESSAGE_TYPE; } MFT_MESSAGE_TYPE;
enum _MFT_SET_TYPE_FLAGS
{
MFT_SET_TYPE_TEST_ONLY = 0x00000001,
};
[ [
object, object,
uuid(bf94c121-5b05-4e6f-8000-ba598961414d) uuid(bf94c121-5b05-4e6f-8000-ba598961414d)