From: Ziqing Hui zhui@codeweavers.com
--- dlls/mf/tests/transform.c | 90 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 87 insertions(+), 3 deletions(-)
diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index 53c0914c98c..702411e07de 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -1077,8 +1077,69 @@ DWORD check_mf_sample_collection_(const char *file, int line, IMFCollection *sam return ctx.diff / count; }
+#define check_video_info_header(a, b) check_video_info_header_(__LINE__, a, b) +static void check_video_info_header_(int line, VIDEOINFOHEADER *info, const VIDEOINFOHEADER *expected) +{ + ok_(__FILE__, line)(info->rcSource.left == expected->rcSource.left + && info->rcSource.top == expected->rcSource.top + && info->rcSource.right == expected->rcSource.right + && info->rcSource.bottom == expected->rcSource.bottom, + "Got unexpected rcSource {%ld, %ld, %ld, %ld}, expected {%ld, %ld, %ld, %ld}.\n", + info->rcSource.left, info->rcSource.top, info->rcSource.right, info->rcSource.bottom, + expected->rcSource.left, expected->rcSource.top, expected->rcSource.right, expected->rcSource.bottom); + ok_(__FILE__, line)(info->rcTarget.left == expected->rcTarget.left + && info->rcTarget.top == expected->rcTarget.top + && info->rcTarget.right == expected->rcTarget.right + && info->rcTarget.bottom == expected->rcTarget.bottom, + "Got unexpected rcTarget {%ld, %ld, %ld, %ld}, expected {%ld, %ld, %ld, %ld}.\n", + info->rcTarget.left, info->rcTarget.top, info->rcTarget.right, info->rcTarget.bottom, + expected->rcTarget.left, expected->rcTarget.top, expected->rcTarget.right, expected->rcTarget.bottom); + ok_(__FILE__, line)(info->dwBitRate == expected->dwBitRate, + "Got unexpected dwBitRate %lu, expected %lu.\n", + info->dwBitRate, expected->dwBitRate); + ok_(__FILE__, line)(info->dwBitErrorRate == expected->dwBitErrorRate, + "Got unexpected dwBitErrorRate %lu, expected %lu.\n", + info->dwBitErrorRate, expected->dwBitErrorRate); + ok_(__FILE__, line)(info->AvgTimePerFrame == expected->AvgTimePerFrame, + "Got unexpected AvgTimePerFrame %I64d, expected %I64d.\n", + info->AvgTimePerFrame, expected->AvgTimePerFrame); + ok_(__FILE__, line)(info->bmiHeader.biSize == expected->bmiHeader.biSize, + "Got unexpected bmiHeader.biSize %lu, expected %lu.\n", + info->bmiHeader.biSize, expected->bmiHeader.biSize); + ok_(__FILE__, line)(info->bmiHeader.biWidth == expected->bmiHeader.biWidth, + "Got unexpected bmiHeader.biWidth %ld, expected %ld.\n", + info->bmiHeader.biWidth, expected->bmiHeader.biWidth); + ok_(__FILE__, line)(info->bmiHeader.biHeight == expected->bmiHeader.biHeight, + "Got unexpected bmiHeader.biHeight %ld, expected %ld.\n", + info->bmiHeader.biHeight, expected->bmiHeader.biHeight); + ok_(__FILE__, line)(info->bmiHeader.biPlanes == expected->bmiHeader.biPlanes, + "Got unexpected bmiHeader.biPlanes %u, expected %u.\n", + info->bmiHeader.biPlanes, expected->bmiHeader.biPlanes); + ok_(__FILE__, line)(info->bmiHeader.biBitCount == expected->bmiHeader.biBitCount, + "Got unexpected bmiHeader.biBitCount %u, expected %u.\n", + info->bmiHeader.biBitCount, expected->bmiHeader.biBitCount); + ok_(__FILE__, line)(info->bmiHeader.biCompression == expected->bmiHeader.biCompression, + "Got unexpected bmiHeader.biCompression %#lx, expected %#lx.\n", + info->bmiHeader.biCompression, expected->bmiHeader.biCompression); + ok_(__FILE__, line)(info->bmiHeader.biSizeImage == expected->bmiHeader.biSizeImage, + "Got unexpected bmiHeader.biSizeImage %lu, expected %lu.\n", + info->bmiHeader.biSizeImage, expected->bmiHeader.biSizeImage); + ok_(__FILE__, line)(info->bmiHeader.biXPelsPerMeter == expected->bmiHeader.biXPelsPerMeter, + "Got unexpected bmiHeader.biXPelsPerMeter %ld, expected %ld.\n", + info->bmiHeader.biXPelsPerMeter, expected->bmiHeader.biXPelsPerMeter); + ok_(__FILE__, line)(info->bmiHeader.biYPelsPerMeter == expected->bmiHeader.biYPelsPerMeter, + "Got unexpected bmiHeader.xxxxxx %ld, expected %ld.\n", + info->bmiHeader.biYPelsPerMeter, expected->bmiHeader.biYPelsPerMeter); + ok_(__FILE__, line)(info->bmiHeader.biClrUsed == expected->bmiHeader.biClrUsed, + "Got unexpected bmiHeader.biClrUsed %lu, expected %lu.\n", + info->bmiHeader.biClrUsed, expected->bmiHeader.biClrUsed); + ok_(__FILE__, line)(info->bmiHeader.biClrImportant == expected->bmiHeader.biClrImportant, + "Got unexpected bmiHeader.biClrImportant %lu, expected %lu.\n", + info->bmiHeader.biClrImportant, expected->bmiHeader.biClrImportant); +} + static void check_media_object_get_type(IMediaObject *media_object, - FUNC_TYPE type, const DMO_MEDIA_TYPE *expected_type, ULONG count) + FUNC_TYPE type, const DMO_MEDIA_TYPE *expected_type, const void *expected_info, ULONG count) { HRESULT (*get_type)(IMediaObject* media_object, DWORD stream_index, DWORD type_index, DMO_MEDIA_TYPE *media_type); DMO_MEDIA_TYPE media_type; @@ -1147,6 +1208,12 @@ static void check_media_object_get_type(IMediaObject *media_object, "Got unexpected cbFormat %lu, expected %lu.\n", media_type.cbFormat, expected->cbFormat);
+ if (expected_info && media_type.cbFormat) + { + if (IsEqualGUID(&expected_type->majortype, &MEDIATYPE_Video)) + check_video_info_header((VIDEOINFOHEADER *)media_type.pbFormat, (VIDEOINFOHEADER *)expected_info + i); + } + MoFreeMediaType(&media_type); winetest_pop_context(); } @@ -4616,6 +4683,22 @@ static void test_wmv_decoder_media_object(void) {MFMediaType_Video, MEDIASUBTYPE_RGB555, TRUE, FALSE, 512, FORMAT_VideoInfo, NULL, 88}, {MFMediaType_Video, MEDIASUBTYPE_RGB8, TRUE, FALSE, 256, FORMAT_VideoInfo, NULL, 1112}, }; + const VIDEOINFOHEADER expected_output_info[] = + { + {{0, 0, 16, 16}, {0, 0, 16, 16}, 0, 0, 0, {40, 16, 16, 1, 12, MAKEFOURCC('N', 'V', '1', '2'), 384, 0, 0, 0, 0}}, + {{0, 0, 16, 16}, {0, 0, 16, 16}, 0, 0, 0, {40, 16, 16, 1, 12, MAKEFOURCC('Y', 'V', '1', '2'), 384, 0, 0, 0, 0}}, + {{0, 0, 16, 16}, {0, 0, 16, 16}, 0, 0, 0, {40, 16, 16, 1, 12, MAKEFOURCC('I', 'Y', 'U', 'V'), 384, 0, 0, 0, 0}}, + {{0, 0, 16, 16}, {0, 0, 16, 16}, 0, 0, 0, {40, 16, 16, 1, 12, MAKEFOURCC('I', '4', '2', '0'), 384, 0, 0, 0, 0}}, + {{0, 0, 16, 16}, {0, 0, 16, 16}, 0, 0, 0, {40, 16, 16, 1, 16, MAKEFOURCC('Y', 'U', 'Y', '2'), 512, 0, 0, 0, 0}}, + {{0, 0, 16, 16}, {0, 0, 16, 16}, 0, 0, 0, {40, 16, 16, 1, 16, MAKEFOURCC('U', 'Y', 'V', 'Y'), 512, 0, 0, 0, 0}}, + {{0, 0, 16, 16}, {0, 0, 16, 16}, 0, 0, 0, {40, 16, 16, 1, 16, MAKEFOURCC('Y', 'V', 'Y', 'U'), 512, 0, 0, 0, 0}}, + {{0, 0, 16, 16}, {0, 0, 16, 16}, 0, 0, 0, {40, 16, 16, 1, 12, MAKEFOURCC('N', 'V', '1', '1'), 384, 0, 0, 0, 0}}, + {{0, 0, 16, 16}, {0, 0, 16, 16}, 0, 0, 0, {40, 16, 16, 1, 32, BI_RGB, 1024, 0, 0, 0, 0}}, + {{0, 0, 16, 16}, {0, 0, 16, 16}, 0, 0, 0, {40, 16, 16, 1, 24, BI_RGB, 768, 0, 0, 0, 0}}, + {{0, 0, 16, 16}, {0, 0, 16, 16}, 0, 0, 0, {40, 16, 16, 1, 16, BI_BITFIELDS, 512, 0, 0, 0, 0}}, + {{0, 0, 16, 16}, {0, 0, 16, 16}, 0, 0, 0, {40, 16, 16, 1, 16, BI_RGB, 512, 0, 0, 0, 0}}, + {{0, 0, 16, 16}, {0, 0, 16, 16}, 0, 0, 0, {40, 16, 16, 1, 8, BI_RGB, 256, 0, 0, 226, 226}}, + }; const struct set_type_arg { DWORD stream_index; @@ -4697,7 +4780,7 @@ static void test_wmv_decoder_media_object(void) ok(in_count == 0xdeadbeef, "Got unexpected in_count %lu.\n", in_count);
/* Test GetInputType. */ - check_media_object_get_type(media_object, INPUT_FUNC, expected_input_types, ARRAY_SIZE(expected_input_types)); + check_media_object_get_type(media_object, INPUT_FUNC, expected_input_types, NULL, ARRAY_SIZE(expected_input_types));
/* Test SetInputType. */ input_type = (DMO_MEDIA_TYPE *)buffer; @@ -4884,7 +4967,8 @@ static void test_wmv_decoder_media_object(void) ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
todo_wine - check_media_object_get_type(media_object, OUTPUT_FUNC, expected_output_types, ARRAY_SIZE(expected_output_types)); + check_media_object_get_type(media_object, OUTPUT_FUNC, + expected_output_types, expected_output_info, ARRAY_SIZE(expected_output_types));
winetest_pop_context(); }