Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mf/tests/mf.c | 132 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index ebf42bcad9c..03d0250d51a 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -5492,9 +5492,103 @@ static IMFSample *create_sample(const BYTE *data, ULONG size) return sample; }
+#define check_sample(a, b, c) check_sample_(__LINE__, a, b, c) +static void check_sample_(int line, IMFSample *sample, const void *expect_buf, ULONG expect_len) +{ + IMFMediaBuffer *media_buffer; + DWORD length; + BYTE *buffer; + HRESULT hr; + ULONG ret; + + hr = IMFSample_ConvertToContiguousBuffer(sample, &media_buffer); + ok_(__FILE__, line)(hr == S_OK, "ConvertToContiguousBuffer returned %#x\n", hr); + hr = IMFMediaBuffer_Lock(media_buffer, &buffer, NULL, &length); + ok_(__FILE__, line)(hr == S_OK, "Lock returned %#x\n", hr); + ok_(__FILE__, line)(expect_len == length, "got length %u\n", length); + if (length && length == expect_len) + { + ok_(__FILE__, line)(!memcmp(expect_buf, buffer, expect_len), + "unexpected buffer data\n"); + } + hr = IMFMediaBuffer_Unlock(media_buffer); + ok_(__FILE__, line)(hr == S_OK, "Unlock returned %#x\n", hr); + ret = IMFMediaBuffer_Release(media_buffer); + ok_(__FILE__, line)(ret == 1, "Release returned %u\n", ret); +} + static const BYTE wma_codec_data[10] = {0, 0x44, 0, 0, 0x17, 0, 0, 0, 0, 0}; static const BYTE wma_decoded_data[0x4000] = {0}; static const ULONG wma_block_size = 1487; +static const BYTE wma_encoded_data[][1487] = +{ + {0x09,0x00,0x00,0x77,0xe9,0x48,0x0c,0x84,0x44,0x88,0x4a,0x40,0x64,0x22,0x24,0x43, + 0xd6,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x18,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x28,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x38,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x48,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x58,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x44,0x88,0x4a,0x40,0x64,0x22,0x24,0x43, + 0xd6,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x68,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x78,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x88,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x98,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0xa8,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x44,0x88,0x4a,0x40,0x64,0x22,0x24,0x43, + 0xd6,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0xb8,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0xc8,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0xd8,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0xe8,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0xf8,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x44,0x88,0x4a,0x40,0x64,0x22,0x24,0x43, + 0xd6,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x08,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x18,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x28,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x38,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x48,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x44,0x88,0x4a,0x40,0x64,0x22,0x24,0x43, + 0xd6,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x58,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x68,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x78,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x88,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x98,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x44,0x88,0x4a,0x40,0x64,0x22,0x24,0x43, + 0xd6,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0xa8,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0xb8,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0xc8,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0xd8,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0xe8,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x44,0x88,0x4a,0x40,0x64,0x22,0x24,0x43, + 0xd6,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0xf8,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + {0x03,0x00,0x00,0x42,0x10,0x84,0x21,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, +};
static void test_wma_encoder(void) { @@ -5552,10 +5646,12 @@ static void test_wma_encoder(void) MFT_REGISTER_TYPE_INFO input_type = {MFMediaType_Audio, MFAudioFormat_Float}; MFT_OUTPUT_STREAM_INFO output_info; MFT_INPUT_STREAM_INFO input_info; + MFT_OUTPUT_DATA_BUFFER output; IMFMediaType *media_type; IMFTransform *transform; IMFSample *sample; GUID class_id; + DWORD status; ULONG i, ret; HRESULT hr;
@@ -5612,6 +5708,42 @@ static void test_wma_encoder(void) hr = IMFTransform_ProcessInput(transform, 0, sample, 0); ok(hr == MF_E_NOTACCEPTING, "ProcessInput returned %#x\n", hr);
+ status = 0xdeadbeef; + sample = create_sample(NULL, output_info.cbSize); + memset(&output, 0, sizeof(output)); + output.pSample = sample; + + i = 0; + while (SUCCEEDED(hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status))) + { + winetest_push_context("%u", i); + ok(hr == S_OK, "ProcessOutput returned %#x\n", hr); + ok(output.pSample == sample, "got pSample %p\n", output.pSample); + ok(output.dwStatus == MFT_OUTPUT_DATA_BUFFER_INCOMPLETE || + broken(output.dwStatus == (MFT_OUTPUT_DATA_BUFFER_INCOMPLETE|5)) /* win7 */, + "got dwStatus %#x\n", output.dwStatus); + ok(status == 0, "got status %#x\n", status); + check_sample(sample, wma_encoded_data + i, wma_block_size); + winetest_pop_context(); + i++; + } + + ret = IMFSample_Release(sample); + ok(ret == 0, "Release returned %u\n", ret); + + status = 0xdeadbeef; + sample = create_sample(NULL, output_info.cbSize); + memset(&output, 0, sizeof(output)); + output.pSample = sample; + hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status); + ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#x\n", hr); + ok(output.pSample == sample, "got pSample %p\n", output.pSample); + ok(output.dwStatus == 0, "got dwStatus %#x\n", output.dwStatus); + ok(status == 0, "got status %#x\n", status); + check_sample(sample, NULL, 0); + ret = IMFSample_Release(sample); + ok(ret == 0, "Release returned %u\n", ret); + ret = IMFTransform_Release(transform); ok(ret == 0, "Release returned %u\n", ret);
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mf/tests/mf.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 03d0250d51a..6577d88dce7 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -5863,6 +5863,7 @@ static void test_wma_decoder(void) MFT_INPUT_STREAM_INFO input_info; IMFMediaType *media_type; IMFTransform *transform; + IMFSample *sample; GUID class_id; ULONG i, ret; HRESULT hr; @@ -6018,6 +6019,29 @@ static void test_wma_decoder(void) ok(output_info.cbSize == sizeof(wma_decoded_data), "got cbSize %#x\n", output_info.cbSize); ok(output_info.cbAlignment == 1, "got cbAlignment %#x\n", output_info.cbAlignment);
+ sample = create_sample(wma_encoded_data[0], wma_block_size / 2); + hr = IMFTransform_ProcessInput(transform, 0, sample, 0); + todo_wine + ok(hr == S_OK, "ProcessInput returned %#x\n", hr); + ret = IMFSample_Release(sample); + ok(ret == 0, "Release returned %u\n", ret); + sample = create_sample(wma_encoded_data[0] + wma_block_size, wma_block_size - wma_block_size / 2); + hr = IMFTransform_ProcessInput(transform, 0, sample, 0); + todo_wine + ok(hr == S_OK, "ProcessInput returned %#x\n", hr); + ret = IMFSample_Release(sample); + ok(ret == 0, "Release returned %u\n", ret); + sample = create_sample(wma_encoded_data[0], wma_block_size); + hr = IMFTransform_ProcessInput(transform, 0, sample, 0); + todo_wine + ok(hr == S_OK, "ProcessInput returned %#x\n", hr); + hr = IMFTransform_ProcessInput(transform, 0, sample, 0); + todo_wine + ok(hr == MF_E_NOTACCEPTING, "ProcessInput returned %#x\n", hr); + ret = IMFSample_Release(sample); + todo_wine + ok(ret == 1, "Release returned %u\n", ret); + ret = IMFTransform_Release(transform); ok(ret == 0, "Release returned %u\n", ret);
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mf/tests/mf.c | 137 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 6577d88dce7..eafaae24522 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -5861,10 +5861,12 @@ static void test_wma_decoder(void) MFT_REGISTER_TYPE_INFO output_type = {MFMediaType_Audio, MFAudioFormat_Float}; MFT_OUTPUT_STREAM_INFO output_info; MFT_INPUT_STREAM_INFO input_info; + MFT_OUTPUT_DATA_BUFFER output; IMFMediaType *media_type; IMFTransform *transform; IMFSample *sample; GUID class_id; + DWORD status; ULONG i, ret; HRESULT hr;
@@ -6042,8 +6044,143 @@ static void test_wma_decoder(void) todo_wine ok(ret == 1, "Release returned %u\n", ret);
+ /* As output_info.dwFlags doesn't have MFT_OUTPUT_STREAM_CAN_PROVIDE_SAMPLES + * IMFTransform_ProcessOutput needs a sample or returns MF_E_TRANSFORM_NEED_MORE_INPUT */ + + status = 0xdeadbeef; + memset(&output, 0, sizeof(output)); + hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status); + todo_wine + ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#x\n", hr); + ok(output.dwStreamID == 0, "got dwStreamID %u\n", output.dwStreamID); + ok(!output.pSample, "got pSample %p\n", output.pSample); + todo_wine + ok(output.dwStatus == MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE || + broken(output.dwStatus == (MFT_OUTPUT_DATA_BUFFER_INCOMPLETE|MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE)) /* Win7 */, + "got dwStatus %#x\n", output.dwStatus); + ok(!output.pEvents, "got pEvents %p\n", output.pEvents); + todo_wine + ok(status == 0, "got status %#x\n", status); + + sample = create_sample(wma_encoded_data[0], wma_block_size); + hr = IMFTransform_ProcessInput(transform, 0, sample, 0); + todo_wine + ok(hr == MF_E_NOTACCEPTING, "ProcessInput returned %#x\n", hr); + ret = IMFSample_Release(sample); + ok(ret == 0, "Release returned %u\n", ret); + + status = 0xdeadbeef; + memset(&output, 0, sizeof(output)); + hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status); + todo_wine + ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#x\n", hr); + ok(!output.pSample, "got pSample %p\n", output.pSample); + todo_wine + ok(output.dwStatus == MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE || + broken(output.dwStatus == (MFT_OUTPUT_DATA_BUFFER_INCOMPLETE|MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE)) /* Win7 */, + "got dwStatus %#x\n", output.dwStatus); + todo_wine + ok(status == 0, "got status %#x\n", status); + + status = 0xdeadbeef; + output_info.cbSize = sizeof(wma_decoded_data); + sample = create_sample(NULL, output_info.cbSize); + memset(&output, 0, sizeof(output)); + output.pSample = sample; + hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status); + while (hr == MF_E_TRANSFORM_NEED_MORE_INPUT) + { + ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#x\n", hr); + ok(output.pSample == sample, "got pSample %p\n", output.pSample); + ok(output.dwStatus == 0, "got dwStatus %#x\n", output.dwStatus); + ok(status == 0, "got status %#x\n", status); + check_sample(sample, NULL, 0); + ret = IMFSample_Release(sample); + ok(ret == 0, "Release returned %u\n", ret); + + sample = create_sample(wma_encoded_data[0], wma_block_size); + hr = IMFTransform_ProcessInput(transform, 0, sample, 0); + ok(hr == S_OK, "ProcessInput returned %#x\n", hr); + ret = IMFSample_Release(sample); + ok(ret == 1, "Release returned %u\n", ret); + + status = 0xdeadbeef; + sample = create_sample(NULL, output_info.cbSize); + memset(&output, 0, sizeof(output)); + output.pSample = sample; + hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status); + } + + todo_wine + ok(hr == S_OK, "ProcessOutput returned %#x\n", hr); + ok(output.pSample == sample, "got pSample %p\n", output.pSample); + + i = 0; + while (hr == S_OK) + { + ok(output.pSample == sample, "got pSample %p\n", output.pSample); + ok(output.dwStatus == MFT_OUTPUT_DATA_BUFFER_INCOMPLETE || output.dwStatus == 0 || + broken(output.dwStatus == (MFT_OUTPUT_DATA_BUFFER_INCOMPLETE|7) || output.dwStatus == 7) /* Win7 */, + "got dwStatus %#x\n", output.dwStatus); + ok(status == 0, "got status %#x\n", status); + 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)); + i += sizeof(wma_decoded_data); + } + else + { + check_sample(sample, wma_decoded_data, sizeof(wma_decoded_data) / 2); + i += sizeof(wma_decoded_data) / 2; + } + ret = IMFSample_Release(sample); + ok(ret == 0, "Release returned %u\n", ret); + + status = 0xdeadbeef; + sample = create_sample(NULL, output_info.cbSize); + memset(&output, 0, sizeof(output)); + output.pSample = sample; + hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status); + } + todo_wine + ok(i == 0xe000, "ProcessOutput produced %#x bytes\n", i); + + todo_wine + ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#x\n", hr); + ok(output.pSample == sample, "got pSample %p\n", output.pSample); + ok(output.dwStatus == 0, "got dwStatus %#x\n", output.dwStatus); + todo_wine + ok(status == 0, "got status %#x\n", status); + ret = IMFSample_Release(sample); + ok(ret == 0, "Release returned %u\n", ret); + + status = 0xdeadbeef; + sample = create_sample(NULL, output_info.cbSize); + memset(&output, 0, sizeof(output)); + output.pSample = sample; + hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status); + todo_wine + ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#x\n", hr); + ok(output.pSample == sample, "got pSample %p\n", output.pSample); + ok(output.dwStatus == 0 || + broken(output.dwStatus == (MFT_OUTPUT_DATA_BUFFER_INCOMPLETE|7)) /* Win7 */, + "got dwStatus %#x\n", output.dwStatus); + todo_wine + ok(status == 0, "got status %#x\n", status); + check_sample(sample, NULL, 0); + ret = IMFSample_Release(sample); + ok(ret == 0, "Release returned %u\n", ret); + + sample = create_sample(wma_encoded_data[0], wma_block_size); + hr = IMFTransform_ProcessInput(transform, 0, sample, 0); + todo_wine + ok(hr == S_OK, "ProcessInput returned %#x\n", hr); + ret = IMFTransform_Release(transform); ok(ret == 0, "Release returned %u\n", ret); + ret = IMFSample_Release(sample); + ok(ret == 0, "Release returned %u\n", ret);
failed: CoUninitialize();
On 2/4/22 15:49, Rémi Bernon wrote:
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391 Signed-off-by: Rémi Bernon rbernon@codeweavers.com
dlls/mf/tests/mf.c | 132 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index ebf42bcad9c..03d0250d51a 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -5492,9 +5492,103 @@ static IMFSample *create_sample(const BYTE *data, ULONG size) return sample; }
+#define check_sample(a, b, c) check_sample_(__LINE__, a, b, c) +static void check_sample_(int line, IMFSample *sample, const void *expect_buf, ULONG expect_len) +{
- IMFMediaBuffer *media_buffer;
- DWORD length;
- BYTE *buffer;
- HRESULT hr;
- ULONG ret;
- hr = IMFSample_ConvertToContiguousBuffer(sample, &media_buffer);
- ok_(__FILE__, line)(hr == S_OK, "ConvertToContiguousBuffer returned %#x\n", hr);
- hr = IMFMediaBuffer_Lock(media_buffer, &buffer, NULL, &length);
- ok_(__FILE__, line)(hr == S_OK, "Lock returned %#x\n", hr);
- ok_(__FILE__, line)(expect_len == length, "got length %u\n", length);
- if (length && length == expect_len)
- {
ok_(__FILE__, line)(!memcmp(expect_buf, buffer, expect_len),
"unexpected buffer data\n");
- }
- hr = IMFMediaBuffer_Unlock(media_buffer);
- ok_(__FILE__, line)(hr == S_OK, "Unlock returned %#x\n", hr);
- ret = IMFMediaBuffer_Release(media_buffer);
- ok_(__FILE__, line)(ret == 1, "Release returned %u\n", ret);
+}
- static const BYTE wma_codec_data[10] = {0, 0x44, 0, 0, 0x17, 0, 0, 0, 0, 0}; static const BYTE wma_decoded_data[0x4000] = {0}; static const ULONG wma_block_size = 1487;
+static const BYTE wma_encoded_data[][1487] = +{
Sorry, I forgot to reply to this one. Would it make sense to have this blob in the resources like we occasionally do? Is it possible to reduce the size of it, and provide a way to regenerate it, or a note on how it was generated at least?
I realize that it's not pretty to add a whole wma stream, because you'll need to parse through first, using source methods, which means even more code.
If there is going to be more tests for WMx, and since decoders/encoders don't strictly belong to mf.dll, maybe moving this to additional test file is an option.
On 2/4/22 20:55, Nikolay Sivov wrote:
On 2/4/22 15:49, Rémi Bernon wrote:
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391 Signed-off-by: Rémi Bernon rbernon@codeweavers.com
dlls/mf/tests/mf.c | 132 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index ebf42bcad9c..03d0250d51a 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -5492,9 +5492,103 @@ static IMFSample *create_sample(const BYTE *data, ULONG size) return sample; } +#define check_sample(a, b, c) check_sample_(__LINE__, a, b, c) +static void check_sample_(int line, IMFSample *sample, const void *expect_buf, ULONG expect_len) +{ + IMFMediaBuffer *media_buffer; + DWORD length; + BYTE *buffer; + HRESULT hr; + ULONG ret;
+ hr = IMFSample_ConvertToContiguousBuffer(sample, &media_buffer); + ok_(__FILE__, line)(hr == S_OK, "ConvertToContiguousBuffer returned %#x\n", hr); + hr = IMFMediaBuffer_Lock(media_buffer, &buffer, NULL, &length); + ok_(__FILE__, line)(hr == S_OK, "Lock returned %#x\n", hr); + ok_(__FILE__, line)(expect_len == length, "got length %u\n", length); + if (length && length == expect_len) + { + ok_(__FILE__, line)(!memcmp(expect_buf, buffer, expect_len), + "unexpected buffer data\n"); + } + hr = IMFMediaBuffer_Unlock(media_buffer); + ok_(__FILE__, line)(hr == S_OK, "Unlock returned %#x\n", hr); + ret = IMFMediaBuffer_Release(media_buffer); + ok_(__FILE__, line)(ret == 1, "Release returned %u\n", ret); +}
static const BYTE wma_codec_data[10] = {0, 0x44, 0, 0, 0x17, 0, 0, 0, 0, 0}; static const BYTE wma_decoded_data[0x4000] = {0}; static const ULONG wma_block_size = 1487; +static const BYTE wma_encoded_data[][1487] = +{
Sorry, I forgot to reply to this one. Would it make sense to have this blob in the resources like we occasionally do? Is it possible to reduce the size of it, and provide a way to regenerate it, or a note on how it was generated at least?
Well that's the sole purpose of the encoder tests. Sure, it doesn't really print it, but it's just a matter of adding a few hexdump lines to print the packets. Maybe a comment about that would be appropriate.
Regarding its size, it wasn't obviously easy to have it smaller, I tried a few things and this was the simplest case for which the encoder was satisfied with the amount of input, and accepted to output encoded data, and for which the encoder had also enough input packets to decode something.
It didn't feel so large so I didn't try much harder. I think it may also be because we encode buffers full of 0s, so the encoded data is very small, and somehow it causes the encoder to eat a lot of data before some packets.
I realize that it's not pretty to add a whole wma stream, because you'll need to parse through first, using source methods, which means even more code.
Yes, I wanted to avoid having to parse a container file if possible.
First, because I used Windows WMA encoder to generate the WMA packets (I couldn't make ffmpeg encoder work with Windows decoder), it'd be less convenient if it needed to be put in a container. Currently with just a few added hexdump lines the test output can be used to generate new data.
I think the question is still actually going to stand later, as I intend to add tests for the H264 encoder. There too we would need to get our hands on raw H264 packets, but as the open-source encoders are working fine it's possible to generate the stream in a container.
In any case, it is indeed a bit of a burden to have to parse a container to get the raw buffers, and I hoped that keeping the buffers small enough it could be fine to embed them like this (even H264 can stay relatively small with a small picture size).
If there is going to be more tests for WMx, and since decoders/encoders don't strictly belong to mf.dll, maybe moving this to additional test file is an option.
Yeah, well I could move them to wmadmod now, for the WMA transform, as it's supposed to live there. I'm not sure where the H264 transform is supposed to be though?
On 2/4/22 21:24, Rémi Bernon wrote:
I think the question is still actually going to stand later, as I intend to add tests for the H264 encoder.
s/encoder/decoder/