Commit 32524883 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

mp3dmod/tests: Add more tests for GetInputSizeInfo() and GetOutputSizeInfo().

parent 33af64c5
...@@ -377,9 +377,8 @@ static void test_aggregation(void) ...@@ -377,9 +377,8 @@ static void test_aggregation(void)
static void test_stream_info(void) static void test_stream_info(void)
{ {
static const MPEGLAYER3WAVEFORMAT input_format = MPEGLAYER3WAVEFORMAT input_format =
{ {
.wfx.nChannels = 2,
.wfx.nSamplesPerSec = 48000, .wfx.nSamplesPerSec = 48000,
}; };
DMO_MEDIA_TYPE input_mt = DMO_MEDIA_TYPE input_mt =
...@@ -391,13 +390,9 @@ static void test_stream_info(void) ...@@ -391,13 +390,9 @@ static void test_stream_info(void)
.pbFormat = (BYTE *)&input_format, .pbFormat = (BYTE *)&input_format,
}; };
static const WAVEFORMATEX output_format = WAVEFORMATEX output_format =
{ {
.nChannels = 1,
.nSamplesPerSec = 48000, .nSamplesPerSec = 48000,
.nAvgBytesPerSec = 2 * 48000,
.nBlockAlign = 2,
.wBitsPerSample = 16,
}; };
DMO_MEDIA_TYPE output_mt = DMO_MEDIA_TYPE output_mt =
{ {
...@@ -407,6 +402,7 @@ static void test_stream_info(void) ...@@ -407,6 +402,7 @@ static void test_stream_info(void)
}; };
DWORD input_count, output_count, flags, size, lookahead, alignment; DWORD input_count, output_count, flags, size, lookahead, alignment;
WORD channels, depth;
IMediaObject *dmo; IMediaObject *dmo;
HRESULT hr; HRESULT hr;
...@@ -434,29 +430,49 @@ static void test_stream_info(void) ...@@ -434,29 +430,49 @@ static void test_stream_info(void)
hr = IMediaObject_GetOutputSizeInfo(dmo, 0, &size, &alignment); hr = IMediaObject_GetOutputSizeInfo(dmo, 0, &size, &alignment);
ok(hr == DMO_E_TYPE_NOT_SET, "Got hr %#x.\n", hr); ok(hr == DMO_E_TYPE_NOT_SET, "Got hr %#x.\n", hr);
hr = IMediaObject_SetInputType(dmo, 0, &input_mt, 0); for (channels = 1; channels <= 2; ++channels)
ok(hr == S_OK, "Got hr %#x.\n", hr); {
input_format.wfx.nChannels = channels;
hr = IMediaObject_GetInputSizeInfo(dmo, 0, &size, &lookahead, &alignment); output_format.nChannels = channels;
ok(hr == DMO_E_TYPE_NOT_SET, "Got hr %#x.\n", hr);
hr = IMediaObject_GetOutputSizeInfo(dmo, 0, &size, &alignment);
ok(hr == DMO_E_TYPE_NOT_SET, "Got hr %#x.\n", hr);
hr = IMediaObject_SetOutputType(dmo, 0, &output_mt, 0);
ok(hr == S_OK, "Got hr %#x.\n", hr);
size = lookahead = alignment = 0xdeadbeef; hr = IMediaObject_SetInputType(dmo, 0, &input_mt, 0);
hr = IMediaObject_GetInputSizeInfo(dmo, 0, &size, &lookahead, &alignment); ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(!size, "Got size %u.\n", size);
ok(lookahead == 0xdeadbeef, "Got lookahead %u.\n", lookahead);
ok(alignment == 1, "Got alignment %u.\n", alignment);
size = alignment = 0xdeadbeef; hr = IMediaObject_GetInputSizeInfo(dmo, 0, &size, &lookahead, &alignment);
hr = IMediaObject_GetOutputSizeInfo(dmo, 0, &size, &alignment); ok(hr == DMO_E_TYPE_NOT_SET, "Got hr %#x.\n", hr);
ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IMediaObject_GetOutputSizeInfo(dmo, 0, &size, &alignment);
ok(size == 1152 * 4, "Got size %u.\n", size); ok(hr == DMO_E_TYPE_NOT_SET, "Got hr %#x.\n", hr);
ok(alignment == 1, "Got alignment %u.\n", alignment);
for (depth = 8; depth <= 16; depth += 8)
{
output_format.wBitsPerSample = depth;
output_format.nBlockAlign = channels * depth / 8;
output_format.nAvgBytesPerSec = 48000 * output_format.nBlockAlign;
hr = IMediaObject_SetOutputType(dmo, 0, &output_mt, 0);
ok(hr == S_OK, "Got hr %#x.\n", hr);
size = lookahead = alignment = 0xdeadbeef;
hr = IMediaObject_GetInputSizeInfo(dmo, 0, &size, &lookahead, &alignment);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(!size || broken(size == output_format.nBlockAlign) /* Vista */,
"Got size %u for %u channels, depth %u.\n", size, channels, depth);
ok(lookahead == 0xdeadbeef, "Got lookahead %u.\n", lookahead);
ok(alignment == 1, "Got alignment %u.\n", alignment);
size = alignment = 0xdeadbeef;
hr = IMediaObject_GetOutputSizeInfo(dmo, 0, &size, &alignment);
ok(hr == S_OK, "Got hr %#x.\n", hr);
/* Vista returns the expected size; all later versions act as if
* channels == 2 for some reason. */
ok(size >= channels * 1152 * depth / 8,
"Got size %u for %u channels, depth %u.\n", size, channels, depth);
ok(alignment == 1, "Got alignment %u.\n", alignment);
}
hr = IMediaObject_SetOutputType(dmo, 0, &output_mt, DMO_SET_TYPEF_CLEAR);
ok(hr == S_OK, "Got hr %#x.\n", hr);
}
IMediaObject_Release(dmo); IMediaObject_Release(dmo);
} }
......
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