mfplat: Add MFCreateWaveFormatExFromMFMediaType AudioFormat_Float test.
Add test for MFAudioFormat_Float subtype being passed to MFCreateWaveFormatExFromMFMediaType. Signed-off-by: Connor McAdams <cmcadams@codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
538b702c87
commit
7dc454be85
|
@ -4240,10 +4240,20 @@ static void test_wrapped_media_type(void)
|
|||
|
||||
static void test_MFCreateWaveFormatExFromMFMediaType(void)
|
||||
{
|
||||
static const struct wave_fmt_test
|
||||
{
|
||||
const GUID *subtype;
|
||||
WORD format_tag;
|
||||
}
|
||||
wave_fmt_tests[] =
|
||||
{
|
||||
{ &MFAudioFormat_PCM, WAVE_FORMAT_PCM, },
|
||||
{ &MFAudioFormat_Float, WAVE_FORMAT_IEEE_FLOAT, },
|
||||
};
|
||||
WAVEFORMATEXTENSIBLE *format_ext;
|
||||
IMFMediaType *mediatype;
|
||||
WAVEFORMATEX *format;
|
||||
UINT32 size;
|
||||
UINT32 size, i;
|
||||
HRESULT hr;
|
||||
|
||||
hr = MFCreateMediaType(&mediatype);
|
||||
|
@ -4261,45 +4271,48 @@ static void test_MFCreateWaveFormatExFromMFMediaType(void)
|
|||
hr = IMFMediaType_SetGUID(mediatype, &MF_MT_SUBTYPE, &MFMediaType_Video);
|
||||
ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr);
|
||||
|
||||
/* Audio/PCM */
|
||||
hr = IMFMediaType_SetGUID(mediatype, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio);
|
||||
ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr);
|
||||
hr = IMFMediaType_SetGUID(mediatype, &MF_MT_SUBTYPE, &MFAudioFormat_PCM);
|
||||
ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr);
|
||||
|
||||
hr = MFCreateWaveFormatExFromMFMediaType(mediatype, &format, &size, MFWaveFormatExConvertFlag_Normal);
|
||||
ok(hr == S_OK, "Failed to create format, hr %#x.\n", hr);
|
||||
ok(format != NULL, "Expected format structure.\n");
|
||||
ok(size == sizeof(*format), "Unexpected size %u.\n", size);
|
||||
ok(format->wFormatTag == WAVE_FORMAT_PCM, "Unexpected tag.\n");
|
||||
ok(format->nChannels == 0, "Unexpected number of channels, %u.\n", format->nChannels);
|
||||
ok(format->nSamplesPerSec == 0, "Unexpected sample rate, %u.\n", format->nSamplesPerSec);
|
||||
ok(format->nAvgBytesPerSec == 0, "Unexpected average data rate rate, %u.\n", format->nAvgBytesPerSec);
|
||||
ok(format->nBlockAlign == 0, "Unexpected alignment, %u.\n", format->nBlockAlign);
|
||||
ok(format->wBitsPerSample == 0, "Unexpected sample size, %u.\n", format->wBitsPerSample);
|
||||
ok(format->cbSize == 0, "Unexpected size field, %u.\n", format->cbSize);
|
||||
CoTaskMemFree(format);
|
||||
for (i = 0; i < ARRAY_SIZE(wave_fmt_tests); ++i)
|
||||
{
|
||||
hr = IMFMediaType_SetGUID(mediatype, &MF_MT_SUBTYPE, wave_fmt_tests[i].subtype);
|
||||
ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr);
|
||||
|
||||
hr = MFCreateWaveFormatExFromMFMediaType(mediatype, (WAVEFORMATEX **)&format_ext, &size,
|
||||
MFWaveFormatExConvertFlag_ForceExtensible);
|
||||
ok(hr == S_OK, "Failed to create format, hr %#x.\n", hr);
|
||||
ok(format_ext != NULL, "Expected format structure.\n");
|
||||
ok(size == sizeof(*format_ext), "Unexpected size %u.\n", size);
|
||||
ok(format_ext->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE, "Unexpected tag.\n");
|
||||
ok(format_ext->Format.nChannels == 0, "Unexpected number of channels, %u.\n", format_ext->Format.nChannels);
|
||||
ok(format_ext->Format.nSamplesPerSec == 0, "Unexpected sample rate, %u.\n", format_ext->Format.nSamplesPerSec);
|
||||
ok(format_ext->Format.nAvgBytesPerSec == 0, "Unexpected average data rate rate, %u.\n",
|
||||
format_ext->Format.nAvgBytesPerSec);
|
||||
ok(format_ext->Format.nBlockAlign == 0, "Unexpected alignment, %u.\n", format_ext->Format.nBlockAlign);
|
||||
ok(format_ext->Format.wBitsPerSample == 0, "Unexpected sample size, %u.\n", format_ext->Format.wBitsPerSample);
|
||||
ok(format_ext->Format.cbSize == sizeof(*format_ext) - sizeof(format_ext->Format), "Unexpected size field, %u.\n",
|
||||
format_ext->Format.cbSize);
|
||||
CoTaskMemFree(format_ext);
|
||||
hr = MFCreateWaveFormatExFromMFMediaType(mediatype, &format, &size, MFWaveFormatExConvertFlag_Normal);
|
||||
ok(hr == S_OK, "Failed to create format, hr %#x.\n", hr);
|
||||
ok(format != NULL, "Expected format structure.\n");
|
||||
ok(size == sizeof(*format), "Unexpected size %u.\n", size);
|
||||
ok(format->wFormatTag == wave_fmt_tests[i].format_tag, "Expected tag %u, got %u.\n", wave_fmt_tests[i].format_tag, format->wFormatTag);
|
||||
ok(format->nChannels == 0, "Unexpected number of channels, %u.\n", format->nChannels);
|
||||
ok(format->nSamplesPerSec == 0, "Unexpected sample rate, %u.\n", format->nSamplesPerSec);
|
||||
ok(format->nAvgBytesPerSec == 0, "Unexpected average data rate rate, %u.\n", format->nAvgBytesPerSec);
|
||||
ok(format->nBlockAlign == 0, "Unexpected alignment, %u.\n", format->nBlockAlign);
|
||||
ok(format->wBitsPerSample == 0, "Unexpected sample size, %u.\n", format->wBitsPerSample);
|
||||
ok(format->cbSize == 0, "Unexpected size field, %u.\n", format->cbSize);
|
||||
CoTaskMemFree(format);
|
||||
|
||||
hr = MFCreateWaveFormatExFromMFMediaType(mediatype, &format, &size, MFWaveFormatExConvertFlag_ForceExtensible + 1);
|
||||
ok(hr == S_OK, "Failed to create format, hr %#x.\n", hr);
|
||||
ok(size == sizeof(*format), "Unexpected size %u.\n", size);
|
||||
CoTaskMemFree(format);
|
||||
hr = MFCreateWaveFormatExFromMFMediaType(mediatype, (WAVEFORMATEX **)&format_ext, &size,
|
||||
MFWaveFormatExConvertFlag_ForceExtensible);
|
||||
ok(hr == S_OK, "Failed to create format, hr %#x.\n", hr);
|
||||
ok(format_ext != NULL, "Expected format structure.\n");
|
||||
ok(size == sizeof(*format_ext), "Unexpected size %u.\n", size);
|
||||
ok(format_ext->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE, "Unexpected tag.\n");
|
||||
ok(format_ext->Format.nChannels == 0, "Unexpected number of channels, %u.\n", format_ext->Format.nChannels);
|
||||
ok(format_ext->Format.nSamplesPerSec == 0, "Unexpected sample rate, %u.\n", format_ext->Format.nSamplesPerSec);
|
||||
ok(format_ext->Format.nAvgBytesPerSec == 0, "Unexpected average data rate rate, %u.\n",
|
||||
format_ext->Format.nAvgBytesPerSec);
|
||||
ok(format_ext->Format.nBlockAlign == 0, "Unexpected alignment, %u.\n", format_ext->Format.nBlockAlign);
|
||||
ok(format_ext->Format.wBitsPerSample == 0, "Unexpected sample size, %u.\n", format_ext->Format.wBitsPerSample);
|
||||
ok(format_ext->Format.cbSize == sizeof(*format_ext) - sizeof(format_ext->Format), "Unexpected size field, %u.\n",
|
||||
format_ext->Format.cbSize);
|
||||
CoTaskMemFree(format_ext);
|
||||
|
||||
hr = MFCreateWaveFormatExFromMFMediaType(mediatype, &format, &size, MFWaveFormatExConvertFlag_ForceExtensible + 1);
|
||||
ok(hr == S_OK, "Failed to create format, hr %#x.\n", hr);
|
||||
ok(size == sizeof(*format), "Unexpected size %u.\n", size);
|
||||
CoTaskMemFree(format);
|
||||
}
|
||||
|
||||
IMFMediaType_Release(mediatype);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue