Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
Supersedes: 231858, 231871-231874
FWIW I'm also happy to move the tests elsewhere if it's a burden.
I now think that, though there's no guarantee the modules won't change, the transform / dmo classes and their tests should perhaps better live in the same modules where native has them. It is in theory possible that some applications load them and instantiate the classes directly, and I don't think it is likely that windows will remove these modules.
The main blocker for that is winegstreamer being a dll and the classes being registered in it. Perhaps it should be a static lib instead, or expose the unixlib interface as its PE entry points.
dlls/mf/tests/mf.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 31a84e47bc1..b2dd807dd33 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -6631,6 +6631,7 @@ static void test_h264_decoder(void) IMFMediaType *media_type; IMFTransform *transform; DWORD status, length; + BOOL is_win7 = FALSE; ULONG i, ret, flags; HANDLE output_file; IMFSample *sample; @@ -6741,10 +6742,9 @@ static void test_h264_decoder(void) winetest_push_context("out %lu", i); ok(hr == S_OK, "GetOutputAvailableType returned %#lx\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); + hr = IMFMediaType_GetItem(media_type, &MF_MT_VIDEO_ROTATION, NULL); + is_win7 = broken(FAILED(hr)); + check_media_type(media_type, is_win7 ? default_outputs_win7[i] : default_outputs_extra[i], -1); ret = IMFMediaType_Release(media_type); ok(ret == 0, "Release returned %lu\n", ret); winetest_pop_context(); @@ -6772,11 +6772,9 @@ static void test_h264_decoder(void) 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); - } + ok(hr == (is_win7 ? MF_E_INVALIDMEDIATYPE : S_OK), "SetOutputType returned %#lx.\n", hr); + init_media_type(media_type, is_win7 ? output_type_desc_win7 : output_type_desc, -1); + hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr); ret = IMFMediaType_Release(media_type); ok(ret == 1, "Release returned %lu\n", ret);
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mf/tests/mf.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index b2dd807dd33..7eb18f00b19 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -6658,6 +6658,9 @@ static void test_h264_decoder(void)
hr = IMFTransform_GetOutputAvailableType(transform, 0, 0, &media_type); ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetOutputAvailableType returned %#lx\n", hr); + hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); + todo_wine + ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetOutputCurrentType returned %#lx\n", hr);
/* setting output media type first doesn't work */
@@ -6779,6 +6782,15 @@ static void test_h264_decoder(void) ret = IMFMediaType_Release(media_type); ok(ret == 1, "Release returned %lu\n", ret);
+ hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); + todo_wine + ok(hr == S_OK, "GetOutputCurrentType returned %#lx\n", hr); + if (hr != S_OK) MFCreateMediaType(&media_type); + todo_wine + check_media_type(media_type, is_win7 ? output_type_desc_win7 : output_type_desc, -1); + ret = IMFMediaType_Release(media_type); + ok(ret == 0, "Release returned %lu\n", ret); + flags = MFT_INPUT_STREAM_WHOLE_SAMPLES | MFT_INPUT_STREAM_SINGLE_SAMPLE_PER_BUFFER | MFT_INPUT_STREAM_FIXED_SAMPLE_SIZE; memset(&input_info, 0xcd, sizeof(input_info)); hr = IMFTransform_GetInputStreamInfo(transform, 0, &input_info); @@ -6904,6 +6916,16 @@ static void test_h264_decoder(void) ok(hr == MF_E_NO_MORE_TYPES, "GetOutputAvailableType returned %#lx\n", hr); ok(i == 5, "%lu output media types\n", i);
+ /* current output type is still the one we selected */ + hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); + todo_wine + ok(hr == S_OK, "GetOutputCurrentType returned %#lx\n", hr); + if (hr != S_OK) MFCreateMediaType(&media_type); + todo_wine + check_media_type(media_type, is_win7 ? output_type_desc_win7 : output_type_desc, -1); + ret = IMFMediaType_Release(media_type); + ok(ret == 0, "Release returned %lu\n", ret); + /* and generate a new one as well in a temporary directory */ GetTempPathW(ARRAY_SIZE(output_path), output_path); lstrcatW(output_path, L"nv12frame.bin");
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mf/tests/mf.c | 8 -------- dlls/winegstreamer/h264_decoder.c | 12 +++++++++++- 2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 7eb18f00b19..a906974597e 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -6659,7 +6659,6 @@ static void test_h264_decoder(void) hr = IMFTransform_GetOutputAvailableType(transform, 0, 0, &media_type); ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetOutputAvailableType returned %#lx\n", hr); hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); - todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetOutputCurrentType returned %#lx\n", hr);
/* setting output media type first doesn't work */ @@ -6783,14 +6782,10 @@ static void test_h264_decoder(void) ok(ret == 1, "Release returned %lu\n", ret);
hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); - todo_wine ok(hr == S_OK, "GetOutputCurrentType returned %#lx\n", hr); - if (hr != S_OK) MFCreateMediaType(&media_type); - todo_wine check_media_type(media_type, is_win7 ? output_type_desc_win7 : output_type_desc, -1); ret = IMFMediaType_Release(media_type); ok(ret == 0, "Release returned %lu\n", ret); - flags = MFT_INPUT_STREAM_WHOLE_SAMPLES | MFT_INPUT_STREAM_SINGLE_SAMPLE_PER_BUFFER | MFT_INPUT_STREAM_FIXED_SAMPLE_SIZE; memset(&input_info, 0xcd, sizeof(input_info)); hr = IMFTransform_GetInputStreamInfo(transform, 0, &input_info); @@ -6918,10 +6913,7 @@ static void test_h264_decoder(void)
/* current output type is still the one we selected */ hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); - todo_wine ok(hr == S_OK, "GetOutputCurrentType returned %#lx\n", hr); - if (hr != S_OK) MFCreateMediaType(&media_type); - todo_wine check_media_type(media_type, is_win7 ? output_type_desc_win7 : output_type_desc, -1); ret = IMFMediaType_Release(media_type); ok(ret == 0, "Release returned %lu\n", ret); diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index 8bfa15529db..1c7bf391bf7 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -460,8 +460,18 @@ static HRESULT WINAPI transform_GetInputCurrentType(IMFTransform *iface, DWORD i
static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) { + struct h264_decoder *decoder = impl_from_IMFTransform(iface); + HRESULT hr; + FIXME("iface %p, id %#lx, type %p stub!\n", iface, id, type); - return E_NOTIMPL; + + if (!decoder->output_type) + return MF_E_TRANSFORM_TYPE_NOT_SET; + + if (FAILED(hr = MFCreateMediaType(type))) + return hr; + + return IMFMediaType_CopyAllItems(decoder->output_type, (IMFAttributes *)*type); }
static HRESULT WINAPI transform_GetInputStatus(IMFTransform *iface, DWORD id, DWORD *flags)
Checking that some attributes are kept while some, frame size related, are enforced by the stream properties.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mf/tests/mf.c | 128 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 119 insertions(+), 9 deletions(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index a906974597e..574b25a5a07 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -6527,11 +6527,23 @@ static void test_h264_decoder(void) ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_H264), {0}, }; + static const struct attribute_desc minimal_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[] = { ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_NV12), ATTR_RATIO(MF_MT_FRAME_SIZE, 1920, 1080), + ATTR_RATIO(MF_MT_FRAME_RATE, 60000, 1000), + ATTR_RATIO(MF_MT_PIXEL_ASPECT_RATIO, 2, 1), + ATTR_UINT32(MF_MT_DEFAULT_STRIDE, 3840), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, 3840 * 1080 * 3 / 2), + ATTR_UINT32(MF_MT_VIDEO_ROTATION, 0), {0}, }; static const struct attribute_desc output_type_desc_win7[] = @@ -6539,6 +6551,29 @@ static void test_h264_decoder(void) ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_NV12), ATTR_RATIO(MF_MT_FRAME_SIZE, 1920, 1088), + ATTR_RATIO(MF_MT_FRAME_RATE, 60000, 1000), + ATTR_RATIO(MF_MT_PIXEL_ASPECT_RATIO, 2, 1), + ATTR_UINT32(MF_MT_DEFAULT_STRIDE, 3840), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, 3840 * 1088 * 3 / 2), + ATTR_UINT32(MF_MT_VIDEO_ROTATION, 0), + {0}, + }; + static const struct attribute_desc new_output_type_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_NV12), + ATTR_RATIO(MF_MT_FRAME_SIZE, 96, 96), + ATTR_RATIO(MF_MT_FRAME_RATE, 1, 1), + ATTR_RATIO(MF_MT_PIXEL_ASPECT_RATIO, 1, 2), + {0}, + }; + static const struct attribute_desc new_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, 96, 96), + ATTR_RATIO(MF_MT_FRAME_RATE, 1, 1), + ATTR_RATIO(MF_MT_PIXEL_ASPECT_RATIO, 1, 2), {0}, }; static const MFVideoArea actual_aperture = {.Area={82,84}}; @@ -6549,7 +6584,7 @@ static void test_h264_decoder(void) 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_RATIO(MF_MT_FRAME_RATE, 60000, 1000, .todo_value = TRUE), ATTR_RATIO(MF_MT_FRAME_SIZE, actual_width, actual_height, .todo_value = TRUE), ATTR_UINT32(MF_MT_SAMPLE_SIZE, actual_width * actual_height * 3 / 2, .todo_value = TRUE), ATTR_UINT32(MF_MT_DEFAULT_STRIDE, actual_width, .todo_value = TRUE), @@ -6563,7 +6598,7 @@ static void test_h264_decoder(void) 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_RATIO(MF_MT_FRAME_RATE, 60000, 1000, .todo_value = TRUE), ATTR_RATIO(MF_MT_FRAME_SIZE, actual_width, actual_height, .todo_value = TRUE), ATTR_UINT32(MF_MT_SAMPLE_SIZE, actual_width * actual_height * 3 / 2, .todo_value = TRUE), ATTR_UINT32(MF_MT_DEFAULT_STRIDE, actual_width, .todo_value = TRUE), @@ -6577,7 +6612,7 @@ static void test_h264_decoder(void) 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_RATIO(MF_MT_FRAME_RATE, 60000, 1000, .todo_value = TRUE), ATTR_RATIO(MF_MT_FRAME_SIZE, actual_width, actual_height, .todo_value = TRUE), ATTR_UINT32(MF_MT_SAMPLE_SIZE, actual_width * actual_height * 3 / 2, .todo_value = TRUE), ATTR_UINT32(MF_MT_DEFAULT_STRIDE, actual_width, .todo_value = TRUE), @@ -6591,7 +6626,7 @@ static void test_h264_decoder(void) 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_RATIO(MF_MT_FRAME_RATE, 60000, 1000, .todo_value = TRUE), ATTR_RATIO(MF_MT_FRAME_SIZE, actual_width, actual_height, .todo_value = TRUE), ATTR_UINT32(MF_MT_SAMPLE_SIZE, actual_width * actual_height * 3 / 2, .todo_value = TRUE), ATTR_UINT32(MF_MT_DEFAULT_STRIDE, actual_width, .todo_value = TRUE), @@ -6605,7 +6640,7 @@ static void test_h264_decoder(void) 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_RATIO(MF_MT_FRAME_RATE, 60000, 1000, .todo_value = TRUE), ATTR_RATIO(MF_MT_FRAME_SIZE, actual_width, actual_height, .todo_value = TRUE), ATTR_UINT32(MF_MT_SAMPLE_SIZE, actual_width * actual_height * 2, .todo_value = TRUE), ATTR_UINT32(MF_MT_DEFAULT_STRIDE, actual_width * 2, .todo_value = TRUE), @@ -6761,17 +6796,17 @@ static void test_h264_decoder(void) hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); todo_wine ok(hr == E_INVALIDARG, "SetOutputType returned %#lx.\n", hr); - init_media_type(media_type, output_type_desc, 1); + init_media_type(media_type, minimal_output_type_desc, 1); hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); todo_wine ok(hr == MF_E_INVALIDMEDIATYPE, "SetOutputType returned %#lx.\n", hr); - init_media_type(media_type, output_type_desc, 2); - for (i = 2; i < ARRAY_SIZE(output_type_desc) - 1; ++i) + init_media_type(media_type, minimal_output_type_desc, 2); + for (i = 2; i < ARRAY_SIZE(minimal_output_type_desc) - 1; ++i) { hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); todo_wine ok(hr == MF_E_ATTRIBUTENOTFOUND, "SetOutputType returned %#lx.\n", hr); - init_media_type(media_type, output_type_desc, i + 1); + init_media_type(media_type, minimal_output_type_desc, i + 1); } hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); ok(hr == (is_win7 ? MF_E_INVALIDMEDIATYPE : S_OK), "SetOutputType returned %#lx.\n", hr); @@ -6786,6 +6821,23 @@ static void test_h264_decoder(void) check_media_type(media_type, is_win7 ? output_type_desc_win7 : output_type_desc, -1); ret = IMFMediaType_Release(media_type); ok(ret == 0, "Release returned %lu\n", ret); + + /* check that the output media type we've selected don't change the enumeration */ + + i = -1; + while (SUCCEEDED(hr = IMFTransform_GetOutputAvailableType(transform, 0, ++i, &media_type))) + { + winetest_push_context("out %lu", i); + ok(hr == S_OK, "GetOutputAvailableType returned %#lx\n", hr); + check_media_type(media_type, default_outputs[i], -1); + check_media_type(media_type, is_win7 ? default_outputs_win7[i] : default_outputs_extra[i], -1); + ret = IMFMediaType_Release(media_type); + ok(ret == 0, "Release returned %lu\n", ret); + winetest_pop_context(); + } + ok(hr == MF_E_NO_MORE_TYPES, "GetOutputAvailableType returned %#lx\n", hr); + ok(i == 5, "%lu output media types\n", i); + flags = MFT_INPUT_STREAM_WHOLE_SAMPLES | MFT_INPUT_STREAM_SINGLE_SAMPLE_PER_BUFFER | MFT_INPUT_STREAM_FIXED_SAMPLE_SIZE; memset(&input_info, 0xcd, sizeof(input_info)); hr = IMFTransform_GetInputStreamInfo(transform, 0, &input_info); @@ -6801,6 +6853,7 @@ static void test_h264_decoder(void) hr = IMFTransform_GetOutputStreamInfo(transform, 0, &output_info); ok(hr == S_OK, "GetOutputStreamInfo returned %#lx\n", hr); ok(output_info.dwFlags == flags, "got dwFlags %#lx\n", output_info.dwFlags); + todo_wine ok(output_info.cbSize == 1920 * 1080 * 2 || broken(output_info.cbSize == 1920 * 1088 * 2) /* Win7 */, "got cbSize %#lx\n", output_info.cbSize); ok(output_info.cbAlignment == 0, "got cbAlignment %#lx\n", output_info.cbAlignment); @@ -6974,6 +7027,63 @@ static void test_h264_decoder(void) trace("created %s\n", debugstr_w(output_path)); CloseHandle(output_file);
+ /* we can change it, but only with the correct frame size */ + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "MFCreateMediaType returned %#lx\n", hr); + init_media_type(media_type, is_win7 ? output_type_desc_win7 : output_type_desc, -1); + hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); + todo_wine + ok(hr == MF_E_INVALIDMEDIATYPE, "SetOutputType returned %#lx.\n", hr); + init_media_type(media_type, is_win7 ? new_output_type_desc_win7 : new_output_type_desc, -1); + hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); + ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr); + ret = IMFMediaType_Release(media_type); + ok(ret == 1, "Release returned %lu\n", ret); + + status = 0; + memset(&output, 0, sizeof(output)); + output.pSample = create_sample(NULL, actual_width * actual_height * 2); + hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status); + todo_wine + ok(hr == MF_E_TRANSFORM_STREAM_CHANGE, "ProcessOutput returned %#lx\n", hr); + ok(output.dwStreamID == 0, "got dwStreamID %lu\n", output.dwStreamID); + ok(!!output.pSample, "got pSample %p\n", output.pSample); + todo_wine + ok(output.dwStatus == MFT_OUTPUT_DATA_BUFFER_FORMAT_CHANGE, "got dwStatus %#lx\n", output.dwStatus); + ok(!output.pEvents, "got pEvents %p\n", output.pEvents); + todo_wine + ok(status == MFT_PROCESS_OUTPUT_STATUS_NEW_STREAMS, "got status %#lx\n", status); + check_sample(output.pSample, NULL, 0, NULL); + ret = IMFSample_Release(output.pSample); + ok(ret == 0, "Release returned %lu\n", ret); + + status = 0; + memset(&output, 0, sizeof(output)); + output.pSample = create_sample(NULL, actual_width * actual_height * 2); + hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status); + todo_wine + ok(hr == S_OK, "ProcessOutput returned %#lx\n", hr); + ok(output.dwStreamID == 0, "got dwStreamID %lu\n", output.dwStreamID); + ok(!!output.pSample, "got pSample %p\n", output.pSample); + ok(output.dwStatus == 0, "got dwStatus %#lx\n", output.dwStatus); + ok(!output.pEvents, "got pEvents %p\n", output.pEvents); + ok(status == 0, "got status %#lx\n", status); + ret = IMFSample_Release(output.pSample); + ok(ret == 0, "Release returned %lu\n", ret); + + status = 0; + memset(&output, 0, sizeof(output)); + output.pSample = create_sample(NULL, actual_width * actual_height * 2); + hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status); + ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#lx\n", hr); + ok(output.dwStreamID == 0, "got dwStreamID %lu\n", output.dwStreamID); + ok(!!output.pSample, "got pSample %p\n", output.pSample); + ok(output.dwStatus == 0, "got dwStatus %#lx\n", output.dwStatus); + ok(!output.pEvents, "got pEvents %p\n", output.pEvents); + ok(status == 0, "got status %#lx\n", status); + ret = IMFSample_Release(output.pSample); + ok(ret == 0, "Release returned %lu\n", ret); + ret = IMFTransform_Release(transform); ok(ret == 0, "Release returned %lu\n", ret); ret = IMFSample_Release(sample);
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mf/tests/mf.c | 57 +++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 26 deletions(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 574b25a5a07..73aa1b64a47 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -5717,8 +5717,8 @@ static IMFSample *create_sample(const BYTE *data, ULONG size) return sample; }
-#define check_sample(a, b, c, d) check_sample_(__LINE__, a, b, c, d) -static void check_sample_(int line, IMFSample *sample, const void *expect_buf, ULONG expect_len, HANDLE output_file) +#define check_sample(a, b, c) check_sample_(__LINE__, a, b, c) +static void check_sample_(int line, IMFSample *sample, const void *expect_buf, HANDLE output_file) { IMFMediaBuffer *media_buffer; DWORD length; @@ -5730,12 +5730,7 @@ static void check_sample_(int line, IMFSample *sample, const void *expect_buf, U ok_(__FILE__, line)(hr == S_OK, "ConvertToContiguousBuffer returned %#lx\n", hr); hr = IMFMediaBuffer_Lock(media_buffer, &buffer, NULL, &length); ok_(__FILE__, line)(hr == S_OK, "Lock returned %#lx\n", hr); - ok_(__FILE__, line)(expect_len == length, "got length %lu\n", length); - if (length && length == expect_len) - { - ok_(__FILE__, line)(!memcmp(expect_buf, buffer, expect_len), - "unexpected buffer data\n"); - } + ok_(__FILE__, line)(!memcmp(expect_buf, buffer, length), "unexpected buffer data\n"); if (output_file) WriteFile(output_file, buffer, length, &length, NULL); hr = IMFMediaBuffer_Unlock(media_buffer); ok_(__FILE__, line)(hr == S_OK, "Unlock returned %#lx\n", hr); @@ -5809,11 +5804,11 @@ static void test_wma_encoder(void) ULONG wma_encoded_data_len; IMFMediaType *media_type; IMFTransform *transform; + DWORD status, length; HANDLE output_file; IMFSample *sample; HRSRC resource; GUID class_id; - DWORD status; ULONG i, ret; HRESULT hr;
@@ -5899,7 +5894,10 @@ static void test_wma_encoder(void) "got dwStatus %#lx\n", output.dwStatus); ok(status == 0, "got status %#lx\n", status); ok(wma_encoded_data_len > i * wma_block_size, "got %lu blocks\n", i); - check_sample(sample, wma_encoded_data + i * wma_block_size, wma_block_size, output_file); + hr = IMFSample_GetTotalLength(sample, &length); + ok(hr == S_OK, "GetTotalLength returned %#lx\n", hr); + ok(length == wma_block_size, "got length %lu\n", length); + check_sample(sample, wma_encoded_data + i * wma_block_size, output_file); winetest_pop_context(); i++; } @@ -5919,7 +5917,9 @@ static void test_wma_encoder(void) ok(output.pSample == sample, "got pSample %p\n", output.pSample); ok(output.dwStatus == 0, "got dwStatus %#lx\n", output.dwStatus); ok(status == 0, "got status %#lx\n", status); - check_sample(sample, NULL, 0, NULL); + hr = IMFSample_GetTotalLength(sample, &length); + ok(hr == S_OK, "GetTotalLength returned %#lx\n", hr); + ok(length == 0, "got length %lu\n", length); ret = IMFSample_Release(sample); ok(ret == 0, "Release returned %lu\n", ret);
@@ -6046,10 +6046,10 @@ static void test_wma_decoder(void) ULONG wma_encoded_data_len; IMFMediaType *media_type; IMFTransform *transform; + DWORD status, length; IMFSample *sample; HRSRC resource; GUID class_id; - DWORD status; ULONG i, ret; HRESULT hr;
@@ -6290,26 +6290,23 @@ static void test_wma_decoder(void) broken(output.dwStatus == (MFT_OUTPUT_DATA_BUFFER_INCOMPLETE|7) || output.dwStatus == 7) /* Win7 */, "got dwStatus %#lx\n", output.dwStatus); ok(status == 0, "got status %#lx\n", status); + hr = IMFSample_GetTotalLength(sample, &length); + ok(hr == S_OK, "GetTotalLength returned %#lx\n", hr); if (output.dwStatus == MFT_OUTPUT_DATA_BUFFER_INCOMPLETE || broken(output.dwStatus == (MFT_OUTPUT_DATA_BUFFER_INCOMPLETE|7))) { - check_sample(sample, wma_decoded_data, sizeof(wma_decoded_data), NULL); + ok(length == sizeof(wma_decoded_data), "got length %lu\n", length); + check_sample(sample, wma_decoded_data, NULL); i += sizeof(wma_decoded_data); } else { - DWORD length; - /* FFmpeg doesn't seem to decode WMA buffers in the same way as native */ - - hr = IMFSample_GetTotalLength(sample, &length); - ok(hr == S_OK, "GetTotalLength returned %#lx\n", hr); todo_wine ok(length == sizeof(wma_decoded_data) / 2, "got length %lu\n", length); - if (length == sizeof(wma_decoded_data) / 2) { - check_sample(sample, wma_decoded_data, sizeof(wma_decoded_data) / 2, NULL); + check_sample(sample, wma_decoded_data, NULL); i += sizeof(wma_decoded_data) / 2; } } @@ -6343,7 +6340,9 @@ static void test_wma_decoder(void) broken(output.dwStatus == (MFT_OUTPUT_DATA_BUFFER_INCOMPLETE|7)) /* Win7 */, "got dwStatus %#lx\n", output.dwStatus); ok(status == 0, "got status %#lx\n", status); - check_sample(sample, NULL, 0, NULL); + hr = IMFSample_GetTotalLength(sample, &length); + ok(hr == S_OK, "GetTotalLength returned %#lx\n", hr); + ok(length == 0, "got length %lu\n", length); ret = IMFSample_Release(sample); ok(ret == 0, "Release returned %lu\n", ret);
@@ -6902,7 +6901,9 @@ static void test_h264_decoder(void) ok(output.dwStatus == 0, "got dwStatus %#lx\n", output.dwStatus); ok(!output.pEvents, "got pEvents %p\n", output.pEvents); ok(status == 0, "got status %#lx\n", status); - check_sample(output.pSample, NULL, 0, NULL); + hr = IMFSample_GetTotalLength(output.pSample, &length); + ok(hr == S_OK, "GetTotalLength returned %#lx\n", hr); + ok(length == 0, "got length %lu\n", length); ret = IMFSample_Release(output.pSample); ok(ret == 0, "Release returned %lu\n", ret);
@@ -6937,8 +6938,10 @@ static void test_h264_decoder(void) todo_wine ok(status == MFT_PROCESS_OUTPUT_STATUS_NEW_STREAMS, "got status %#lx\n", status); - if (status == MFT_PROCESS_OUTPUT_STATUS_NEW_STREAMS) - check_sample(output.pSample, NULL, 0, NULL); + hr = IMFSample_GetTotalLength(output.pSample, &length); + ok(hr == S_OK, "GetTotalLength returned %#lx\n", hr); + todo_wine_if(length == 1920 * 1080 * 3 / 2) + ok(length == 0, "got length %lu\n", length); ret = IMFSample_Release(output.pSample); ok(ret == 0, "Release returned %lu\n", ret);
@@ -7019,7 +7022,7 @@ static void test_h264_decoder(void) IMFMediaBuffer_Release(media_buffer);
if (length == nv12_frame_len) - check_sample(output.pSample, nv12_frame_data, nv12_frame_len, output_file); + check_sample(output.pSample, nv12_frame_data, output_file); } ret = IMFSample_Release(output.pSample); ok(ret == 0, "Release returned %lu\n", ret); @@ -7053,7 +7056,9 @@ static void test_h264_decoder(void) ok(!output.pEvents, "got pEvents %p\n", output.pEvents); todo_wine ok(status == MFT_PROCESS_OUTPUT_STATUS_NEW_STREAMS, "got status %#lx\n", status); - check_sample(output.pSample, NULL, 0, NULL); + hr = IMFSample_GetTotalLength(output.pSample, &length); + ok(hr == S_OK, "GetTotalLength returned %#lx\n", hr); + ok(length == 0, "got length %lu\n", length); ret = IMFSample_Release(output.pSample); ok(ret == 0, "Release returned %lu\n", ret);
On 4/19/22 08:56, Rémi Bernon wrote:
I now think that, though there's no guarantee the modules won't change, the transform / dmo classes and their tests should perhaps better live in the same modules where native has them. It is in theory possible that some applications load them and instantiate the classes directly, and I don't think it is likely that windows will remove these modules.
Maybe, although Windows has moved or deleted codecs in the past. (And I expect that if an application really does try to manually instantiate a class, it'll be easy to debug and may not even mean moving the entire implementation out of winegstreamer.)
Beyond that, though, why should the tests live in the same directory as the implementation? At best this helps make sure that tests are automatically run by the testbot, but as the person ensuring that all tests are manually run, I don't particularly see a need to change this (e.g. I'm still going to need to run tests manually anyway.) If we really care about this, we should come up with a solution that'll allow us to automatically run tests in other places where we have strong inter-module dependencies.
The main blocker for that is winegstreamer being a dll and the classes being registered in it. Perhaps it should be a static lib instead, or expose the unixlib interface as its PE entry points.
I don't think we can make winegstreamer a static library, but moving one or more frontends out of it is possible. It doesn't seem necessary yet, though.
On 4/19/22 17:36, Zebediah Figura wrote:
On 4/19/22 08:56, Rémi Bernon wrote:
I now think that, though there's no guarantee the modules won't change, the transform / dmo classes and their tests should perhaps better live in the same modules where native has them. It is in theory possible that some applications load them and instantiate the classes directly, and I don't think it is likely that windows will remove these modules.
Maybe, although Windows has moved or deleted codecs in the past. (And I expect that if an application really does try to manually instantiate a class, it'll be easy to debug and may not even mean moving the entire implementation out of winegstreamer.)
Beyond that, though, why should the tests live in the same directory as the implementation? At best this helps make sure that tests are automatically run by the testbot, but as the person ensuring that all tests are manually run, I don't particularly see a need to change this (e.g. I'm still going to need to run tests manually anyway.) If we really care about this, we should come up with a solution that'll allow us to automatically run tests in other places where we have strong inter-module dependencies.
The main blocker for that is winegstreamer being a dll and the classes being registered in it. Perhaps it should be a static lib instead, or expose the unixlib interface as its PE entry points.
I don't think we can make winegstreamer a static library, but moving one or more frontends out of it is possible. It doesn't seem necessary yet, though.
I don't know, I'm trying to understand why these patches often stall and to figure a way to make it go smoother.
I'm not pretending the tests are all good and should be accepted right away but I hope they aren't completely nonsensical either. I still have plenty of tests to add, and I'm happy to maintain them if it's a burden for the modules maintainers.
On 4/19/22 10:52, Rémi Bernon wrote:
On 4/19/22 17:36, Zebediah Figura wrote:
On 4/19/22 08:56, Rémi Bernon wrote:
I now think that, though there's no guarantee the modules won't change, the transform / dmo classes and their tests should perhaps better live in the same modules where native has them. It is in theory possible that some applications load them and instantiate the classes directly, and I don't think it is likely that windows will remove these modules.
Maybe, although Windows has moved or deleted codecs in the past. (And I expect that if an application really does try to manually instantiate a class, it'll be easy to debug and may not even mean moving the entire implementation out of winegstreamer.)
Beyond that, though, why should the tests live in the same directory as the implementation? At best this helps make sure that tests are automatically run by the testbot, but as the person ensuring that all tests are manually run, I don't particularly see a need to change this (e.g. I'm still going to need to run tests manually anyway.) If we really care about this, we should come up with a solution that'll allow us to automatically run tests in other places where we have strong inter-module dependencies.
The main blocker for that is winegstreamer being a dll and the classes being registered in it. Perhaps it should be a static lib instead, or expose the unixlib interface as its PE entry points.
I don't think we can make winegstreamer a static library, but moving one or more frontends out of it is possible. It doesn't seem necessary yet, though.
I don't know, I'm trying to understand why these patches often stall and to figure a way to make it go smoother.
I'm not pretending the tests are all good and should be accepted right away but I hope they aren't completely nonsensical either. I still have plenty of tests to add, and I'm happy to maintain them if it's a burden for the modules maintainers.
There may be a confusion wrt review. FWIW, I'm expecting that these patches should be reviewed by Nikolay; I don't think there's anything in them that's not related to Media Foundation.