Commit 802a3b6f authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

mf/tests: Add some AAC decoder MFT decoding tests.

parent cc8569dd
...@@ -29,6 +29,9 @@ audioconvdata.bin RCDATA audioconvdata.bin ...@@ -29,6 +29,9 @@ audioconvdata.bin RCDATA audioconvdata.bin
/* @makedep: aacencdata.bin */ /* @makedep: aacencdata.bin */
aacencdata.bin RCDATA aacencdata.bin aacencdata.bin RCDATA aacencdata.bin
/* @makedep: aacdecdata.bin */
aacdecdata.bin RCDATA aacdecdata.bin
/* @makedep: wmaencdata.bin */ /* @makedep: wmaencdata.bin */
wmaencdata.bin RCDATA wmaencdata.bin wmaencdata.bin RCDATA wmaencdata.bin
......
...@@ -1889,11 +1889,33 @@ static void test_aac_decoder(void) ...@@ -1889,11 +1889,33 @@ static void test_aac_decoder(void)
MFT_INPUT_STREAM_FIXED_SAMPLE_SIZE | MFT_INPUT_STREAM_HOLDS_BUFFERS, MFT_INPUT_STREAM_FIXED_SAMPLE_SIZE | MFT_INPUT_STREAM_HOLDS_BUFFERS,
}; };
const struct buffer_desc output_buffer_desc[] =
{
{.length = 0x800},
};
const struct attribute_desc output_sample_attributes[] =
{
ATTR_UINT32(MFSampleExtension_CleanPoint, 1),
{0},
};
const struct sample_desc output_sample_desc[] =
{
{
.attributes = output_sample_attributes + (has_video_processor ? 0 : 1) /* MFSampleExtension_CleanPoint missing on Win7 */,
.sample_time = 0, .sample_duration = 232200,
.buffer_count = 1, .buffers = output_buffer_desc,
},
};
MFT_REGISTER_TYPE_INFO output_type = {MFMediaType_Audio, MFAudioFormat_Float}; MFT_REGISTER_TYPE_INFO output_type = {MFMediaType_Audio, MFAudioFormat_Float};
MFT_REGISTER_TYPE_INFO input_type = {MFMediaType_Audio, MFAudioFormat_AAC}; MFT_REGISTER_TYPE_INFO input_type = {MFMediaType_Audio, MFAudioFormat_AAC};
IMFSample *input_sample, *output_sample;
ULONG i, ret, ref, aacenc_data_len;
IMFCollection *output_samples;
DWORD length, output_status;
IMFMediaType *media_type; IMFMediaType *media_type;
IMFTransform *transform; IMFTransform *transform;
ULONG i, ret; const BYTE *aacenc_data;
HRESULT hr; HRESULT hr;
hr = CoInitialize(NULL); hr = CoInitialize(NULL);
...@@ -1974,6 +1996,66 @@ static void test_aac_decoder(void) ...@@ -1974,6 +1996,66 @@ static void test_aac_decoder(void)
check_mft_get_input_stream_info(transform, &input_info); check_mft_get_input_stream_info(transform, &input_info);
check_mft_get_output_stream_info(transform, &output_info); check_mft_get_output_stream_info(transform, &output_info);
load_resource(L"aacencdata.bin", &aacenc_data, &aacenc_data_len);
ok(aacenc_data_len == 24861, "got length %lu\n", aacenc_data_len);
input_sample = create_sample(aacenc_data + sizeof(DWORD), *(DWORD *)aacenc_data);
hr = IMFTransform_ProcessInput(transform, 0, input_sample, 0);
ok(hr == S_OK, "ProcessInput returned %#lx\n", hr);
hr = IMFTransform_ProcessInput(transform, 0, input_sample, 0);
ok(hr == MF_E_NOTACCEPTING, "ProcessInput returned %#lx\n", hr);
/* 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 */
hr = check_mft_process_output(transform, NULL, &output_status);
ok(hr == E_INVALIDARG, "ProcessOutput returned %#lx\n", hr);
ok(output_status == 0, "got output[0].dwStatus %#lx\n", output_status);
hr = IMFTransform_ProcessInput(transform, 0, input_sample, 0);
ok(hr == MF_E_NOTACCEPTING, "ProcessInput returned %#lx\n", hr);
hr = IMFTransform_ProcessMessage(transform, MFT_MESSAGE_COMMAND_DRAIN, 0);
ok(hr == S_OK, "ProcessMessage returned %#lx\n", hr);
hr = IMFTransform_ProcessInput(transform, 0, input_sample, 0);
ok(hr == MF_E_NOTACCEPTING, "ProcessInput returned %#lx\n", hr);
hr = MFCreateCollection(&output_samples);
ok(hr == S_OK, "MFCreateCollection returned %#lx\n", hr);
output_sample = create_sample(NULL, output_info.cbSize);
for (i = 0; SUCCEEDED(hr = check_mft_process_output(transform, output_sample, &output_status)); i++)
{
winetest_push_context("%lu", i);
ok(hr == S_OK, "ProcessOutput returned %#lx\n", hr);
hr = IMFCollection_AddElement(output_samples, (IUnknown *)output_sample);
ok(hr == S_OK, "AddElement returned %#lx\n", hr);
ref = IMFSample_Release(output_sample);
ok(ref == 1, "Release returned %ld\n", ref);
output_sample = create_sample(NULL, output_info.cbSize);
winetest_pop_context();
}
ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#lx\n", hr);
ok(output_status == MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE, "got output[0].dwStatus %#lx\n", output_status);
ret = IMFSample_Release(output_sample);
ok(ret == 0, "Release returned %lu\n", ret);
ok(i == 1, "got %lu output samples\n", i);
ret = check_mf_sample_collection(output_samples, output_sample_desc, L"aacdecdata.bin");
ok(ret == 0, "got %lu%% diff\n", ret);
IMFCollection_Release(output_samples);
output_sample = create_sample(NULL, output_info.cbSize);
hr = check_mft_process_output(transform, output_sample, &output_status);
ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#lx\n", hr);
ok(output_status == MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE, "got output[0].dwStatus %#lx\n", output_status);
hr = IMFSample_GetTotalLength(output_sample, &length);
ok(hr == S_OK, "GetTotalLength returned %#lx\n", hr);
ok(length == 0, "got length %lu\n", length);
ret = IMFSample_Release(output_sample);
ok(ret == 0, "Release returned %lu\n", ret);
ret = IMFSample_Release(input_sample);
ok(ret == 0, "Release returned %lu\n", ret);
ret = IMFTransform_Release(transform); ret = IMFTransform_Release(transform);
ok(ret == 0, "Release returned %lu\n", ret); ok(ret == 0, "Release returned %lu\n", ret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment