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);