Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183 Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
v2: Fix bug URLs, support Win7 results.
dlls/mf/tests/mf.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index c4d318a9e43..add48be964a 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -6135,6 +6135,65 @@ failed: CoUninitialize(); }
+static void test_h264_decoder(void) +{ + static const media_type_desc transform_inputs[] = + { + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_H264), + }, + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_H264_ES), + }, + }; + static const media_type_desc transform_outputs[] = + { + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_NV12), + }, + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_YV12), + }, + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_IYUV), + }, + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_I420), + }, + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_YUY2), + }, + }; + + MFT_REGISTER_TYPE_INFO input_type = {MFMediaType_Video, MFVideoFormat_H264}; + MFT_REGISTER_TYPE_INFO output_type = {MFMediaType_Video, MFVideoFormat_NV12}; + IMFTransform *transform; + GUID class_id; + HRESULT hr; + ULONG ret; + + hr = CoInitialize(NULL); + ok(hr == S_OK, "Failed to initialize, hr %#x.\n", hr); + + if (!create_transform(MFT_CATEGORY_VIDEO_DECODER, &input_type, &output_type, L"Microsoft H264 Video Decoder MFT", + transform_inputs, ARRAY_SIZE(transform_inputs), transform_outputs, ARRAY_SIZE(transform_outputs), + &transform, &class_id)) + goto failed; + + ret = IMFTransform_Release(transform); + ok(ret == 0, "Release returned %u\n", ret); + +failed: + CoUninitialize(); +} + START_TEST(mf) { init_functions(); @@ -6170,4 +6229,5 @@ START_TEST(mf) test_MFRequireProtectedEnvironment(); test_wma_encoder(); test_wma_decoder(); + test_h264_decoder(); }
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mf/tests/mf.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index add48be964a..2c6585c24bf 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -105,12 +105,15 @@ struct attribute_desc const GUID *key; const char *name; PROPVARIANT value; + BOOL ratio; }; typedef struct attribute_desc media_type_desc[32];
#define ATTR_GUID(k, g) {.key = &k, .name = #k, {.vt = VT_CLSID, .puuid = (GUID *)&g}} #define ATTR_UINT32(k, v) {.key = &k, .name = #k, {.vt = VT_UI4, .ulVal = v}} #define ATTR_BLOB(k, p, n) {.key = &k, .name = #k, {.vt = VT_VECTOR | VT_UI1, .caub = {.pElems = (void *)p, .cElems = n}}} +#define ATTR_RATIO(k, n, d) {.key = &k, .name = #k, {.vt = VT_UI8, .uhVal = {.HighPart = n, .LowPart = d}}, .ratio = TRUE} +#define ATTR_UINT64(k, v) {.key = &k, .name = #k, {.vt = VT_UI8, .uhVal = {.QuadPart = v}}}
#define check_media_type(a, b, c) check_attributes_(__LINE__, (IMFAttributes *)a, b, c) #define check_attributes(a, b, c) check_attributes_(__LINE__, a, b, c) @@ -132,6 +135,12 @@ static void check_attributes_(int line, IMFAttributes *attributes, const struct default: sprintf(buffer, "??"); break; case VT_CLSID: sprintf(buffer, "%s", debugstr_guid(value.puuid)); break; case VT_UI4: sprintf(buffer, "%u", value.ulVal); break; + case VT_UI8: + if (desc[i].ratio) + sprintf(buffer, "%u:%u", value.uhVal.HighPart, value.uhVal.LowPart); + else + sprintf(buffer, "%I64u", value.uhVal.QuadPart); + break; case VT_VECTOR | VT_UI1: buf += sprintf(buf, "size %u, data {", value.caub.cElems); for (j = 0; j < 16 && j < value.caub.cElems; ++j) @@ -6174,10 +6183,11 @@ static void test_h264_decoder(void)
MFT_REGISTER_TYPE_INFO input_type = {MFMediaType_Video, MFVideoFormat_H264}; MFT_REGISTER_TYPE_INFO output_type = {MFMediaType_Video, MFVideoFormat_NV12}; + IMFMediaType *media_type; IMFTransform *transform; GUID class_id; + ULONG i, ret; HRESULT hr; - ULONG ret;
hr = CoInitialize(NULL); ok(hr == S_OK, "Failed to initialize, hr %#x.\n", hr); @@ -6187,6 +6197,23 @@ static void test_h264_decoder(void) &transform, &class_id)) goto failed;
+ /* check available input types */ + + i = -1; + while (SUCCEEDED(hr = IMFTransform_GetInputAvailableType(transform, 0, ++i, &media_type))) + { + winetest_push_context("in %u", i); + ok(hr == S_OK, "GetInputAvailableType returned %#x\n", hr); + check_media_type(media_type, transform_inputs[i], -1); + ret = IMFMediaType_Release(media_type); + ok(ret == 0, "Release returned %u\n", ret); + winetest_pop_context(); + } + todo_wine + ok(hr == MF_E_NO_MORE_TYPES, "GetInputAvailableType returned %#x\n", hr); + todo_wine + ok(i == 2 || broken(i == 1) /* Win7 */, "%u input media types\n", i); + ret = IMFTransform_Release(transform); ok(ret == 0, "Release returned %u\n", ret);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mf/tests/mf.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 2c6585c24bf..354d4582de4 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -6180,6 +6180,12 @@ static void test_h264_decoder(void) ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_YUY2), }, }; + static const struct attribute_desc input_type_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_H264), + {0}, + };
MFT_REGISTER_TYPE_INFO input_type = {MFMediaType_Video, MFVideoFormat_H264}; MFT_REGISTER_TYPE_INFO output_type = {MFMediaType_Video, MFVideoFormat_NV12}; @@ -6214,6 +6220,25 @@ static void test_h264_decoder(void) todo_wine ok(i == 2 || broken(i == 1) /* Win7 */, "%u input media types\n", i);
+ /* check required input media type attributes */ + + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "MFCreateMediaType returned %#x\n", hr); + hr = IMFTransform_SetInputType(transform, 0, media_type, 0); + todo_wine + ok(hr == E_INVALIDARG, "SetInputType returned %#x.\n", hr); + init_media_type(media_type, input_type_desc, 1); + hr = IMFTransform_SetInputType(transform, 0, media_type, 0); + todo_wine + ok(hr == MF_E_INVALIDMEDIATYPE, "SetInputType returned %#x.\n", hr); + init_media_type(media_type, input_type_desc, 2); + hr = IMFTransform_SetInputType(transform, 0, media_type, 0); + todo_wine + ok(hr == S_OK, "SetInputType returned %#x.\n", hr); + ret = IMFMediaType_Release(media_type); + todo_wine + ok(ret == 1, "Release returned %u\n", ret); + ret = IMFTransform_Release(transform); ok(ret == 0, "Release returned %u\n", ret);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mf/tests/mf.c | 131 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 354d4582de4..16cee8da55c 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -6180,6 +6180,110 @@ static void test_h264_decoder(void) ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_YUY2), }, }; + static const media_type_desc default_outputs[] = + { + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_NV12), + ATTR_RATIO(MF_MT_PIXEL_ASPECT_RATIO, 1, 1), + ATTR_RATIO(MF_MT_FRAME_RATE, 30000, 1001), + ATTR_UINT32(MF_MT_DEFAULT_STRIDE, 1920), + ATTR_UINT32(MF_MT_INTERLACE_MODE, 7), + ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 1), + ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1), + }, + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_YV12), + ATTR_RATIO(MF_MT_PIXEL_ASPECT_RATIO, 1, 1), + ATTR_RATIO(MF_MT_FRAME_RATE, 30000, 1001), + ATTR_UINT32(MF_MT_DEFAULT_STRIDE, 1920), + ATTR_UINT32(MF_MT_INTERLACE_MODE, 7), + ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 1), + ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1), + }, + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_IYUV), + ATTR_RATIO(MF_MT_PIXEL_ASPECT_RATIO, 1, 1), + ATTR_RATIO(MF_MT_FRAME_RATE, 30000, 1001), + ATTR_UINT32(MF_MT_DEFAULT_STRIDE, 1920), + ATTR_UINT32(MF_MT_INTERLACE_MODE, 7), + ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 1), + ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1), + }, + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_I420), + ATTR_RATIO(MF_MT_PIXEL_ASPECT_RATIO, 1, 1), + ATTR_RATIO(MF_MT_FRAME_RATE, 30000, 1001), + ATTR_UINT32(MF_MT_DEFAULT_STRIDE, 1920), + ATTR_UINT32(MF_MT_INTERLACE_MODE, 7), + ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 1), + ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1), + }, + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_YUY2), + ATTR_RATIO(MF_MT_PIXEL_ASPECT_RATIO, 1, 1), + ATTR_RATIO(MF_MT_FRAME_RATE, 30000, 1001), + ATTR_UINT32(MF_MT_DEFAULT_STRIDE, 3840), + ATTR_UINT32(MF_MT_INTERLACE_MODE, 7), + ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 1), + ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1), + }, + }; + static const media_type_desc default_outputs_extra[] = + { + { + ATTR_RATIO(MF_MT_FRAME_SIZE, 1920, 1080), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, 3110400), + ATTR_UINT32(MF_MT_VIDEO_ROTATION, 0), + }, + { + ATTR_RATIO(MF_MT_FRAME_SIZE, 1920, 1080), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, 3110400), + ATTR_UINT32(MF_MT_VIDEO_ROTATION, 0), + }, + { + ATTR_RATIO(MF_MT_FRAME_SIZE, 1920, 1080), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, 3110400), + ATTR_UINT32(MF_MT_VIDEO_ROTATION, 0), + }, + { + ATTR_RATIO(MF_MT_FRAME_SIZE, 1920, 1080), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, 3110400), + ATTR_UINT32(MF_MT_VIDEO_ROTATION, 0), + }, + { + ATTR_RATIO(MF_MT_FRAME_SIZE, 1920, 1080), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, 4147200), + ATTR_UINT32(MF_MT_VIDEO_ROTATION, 0), + }, + }; + static const media_type_desc default_outputs_win7[] = + { + { + ATTR_RATIO(MF_MT_FRAME_SIZE, 1920, 1088), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, 3133440), + }, + { + ATTR_RATIO(MF_MT_FRAME_SIZE, 1920, 1088), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, 3133440), + }, + { + ATTR_RATIO(MF_MT_FRAME_SIZE, 1920, 1088), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, 3133440), + }, + { + ATTR_RATIO(MF_MT_FRAME_SIZE, 1920, 1088), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, 3133440), + }, + { + ATTR_RATIO(MF_MT_FRAME_SIZE, 1920, 1088), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, 4177920), + }, + }; static const struct attribute_desc input_type_desc[] = { ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), @@ -6203,6 +6307,12 @@ static void test_h264_decoder(void) &transform, &class_id)) goto failed;
+ /* no output type is available before an input type is set */ + + hr = IMFTransform_GetOutputAvailableType(transform, 0, 0, &media_type); + todo_wine + ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetOutputAvailableType returned %#x\n", hr); + /* check available input types */
i = -1; @@ -6239,6 +6349,27 @@ static void test_h264_decoder(void) todo_wine ok(ret == 1, "Release returned %u\n", ret);
+ /* output types can now be enumerated (though they are actually the same for all input types) */ + + i = -1; + while (SUCCEEDED(hr = IMFTransform_GetOutputAvailableType(transform, 0, ++i, &media_type))) + { + winetest_push_context("out %u", i); + ok(hr == S_OK, "GetOutputAvailableType returned %#x\n", hr); + check_media_type(media_type, default_outputs[i], -1); + if (FAILED(hr = IMFMediaType_GetItem(media_type, &MF_MT_VIDEO_ROTATION, NULL))) + check_media_type(media_type, default_outputs_win7[i], -1); + else + check_media_type(media_type, default_outputs_extra[i], -1); + ret = IMFMediaType_Release(media_type); + ok(ret == 0, "Release returned %u\n", ret); + winetest_pop_context(); + } + todo_wine + ok(hr == MF_E_NO_MORE_TYPES, "GetOutputAvailableType returned %#x\n", hr); + todo_wine + ok(i == 5, "%u output media types\n", i); + ret = IMFTransform_Release(transform); ok(ret == 0, "Release returned %u\n", ret);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mf/tests/mf.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 16cee8da55c..080ec457799 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -6290,6 +6290,20 @@ static void test_h264_decoder(void) ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_H264), {0}, }; + static const struct attribute_desc output_type_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_NV12), + ATTR_RATIO(MF_MT_FRAME_SIZE, 1920, 1080), + {0}, + }; + static const struct attribute_desc output_type_desc_win7[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_NV12), + ATTR_RATIO(MF_MT_FRAME_SIZE, 1920, 1088), + {0}, + };
MFT_REGISTER_TYPE_INFO input_type = {MFMediaType_Video, MFVideoFormat_H264}; MFT_REGISTER_TYPE_INFO output_type = {MFMediaType_Video, MFVideoFormat_NV12}; @@ -6313,6 +6327,17 @@ static void test_h264_decoder(void) todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetOutputAvailableType returned %#x\n", hr);
+ /* setting output media type first doesn't work */ + + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "MFCreateMediaType returned %#x\n", hr); + init_media_type(media_type, default_outputs[0], -1); + hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); + todo_wine + ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "SetOutputType returned %#x.\n", hr); + ret = IMFMediaType_Release(media_type); + ok(ret == 0, "Release returned %u\n", ret); + /* check available input types */
i = -1; @@ -6370,6 +6395,37 @@ static void test_h264_decoder(void) todo_wine ok(i == 5, "%u output media types\n", i);
+ /* check required output media type attributes */ + + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "MFCreateMediaType returned %#x\n", hr); + hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); + todo_wine + ok(hr == E_INVALIDARG, "SetOutputType returned %#x.\n", hr); + init_media_type(media_type, output_type_desc, 1); + hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); + todo_wine + ok(hr == MF_E_INVALIDMEDIATYPE, "SetOutputType returned %#x.\n", hr); + init_media_type(media_type, output_type_desc, 2); + for (i = 2; i < ARRAY_SIZE(output_type_desc) - 1; ++i) + { + hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); + todo_wine + ok(hr == MF_E_ATTRIBUTENOTFOUND, "SetOutputType returned %#x.\n", hr); + init_media_type(media_type, output_type_desc, i + 1); + } + hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); + if (broken(hr == MF_E_INVALIDMEDIATYPE)) + { + init_media_type(media_type, output_type_desc_win7, ARRAY_SIZE(output_type_desc_win7) - 1); + hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); + } + todo_wine + ok(hr == S_OK, "SetOutputType returned %#x.\n", hr); + ret = IMFMediaType_Release(media_type); + todo_wine + ok(ret == 1, "Release returned %u\n", ret); + ret = IMFTransform_Release(transform); ok(ret == 0, "Release returned %u\n", ret);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com