amstream: Return correct media type info when enumerating AMAudioStream media types.

Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gijs Vermeulen 2020-07-30 18:08:52 +02:00 committed by Alexandre Julliard
parent 774ee4734a
commit 218409c2d6
2 changed files with 26 additions and 6 deletions

View File

@ -837,6 +837,17 @@ static HRESULT WINAPI enum_media_types_Next(IEnumMediaTypes *iface, ULONG count,
{
struct enum_media_types *enum_media_types = impl_from_IEnumMediaTypes(iface);
static const WAVEFORMATEX wfx =
{
.wFormatTag = WAVE_FORMAT_PCM,
.nChannels = 1,
.nSamplesPerSec = 11025,
.nAvgBytesPerSec = 11025 * 2,
.nBlockAlign = 2,
.wBitsPerSample = 16,
.cbSize = 0,
};
TRACE("iface %p, count %u, mts %p, ret_count %p.\n", iface, count, mts, ret_count);
if (!ret_count)
@ -847,7 +858,15 @@ static HRESULT WINAPI enum_media_types_Next(IEnumMediaTypes *iface, ULONG count,
mts[0] = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
memset(mts[0], 0, sizeof(AM_MEDIA_TYPE));
mts[0]->majortype = MEDIATYPE_Audio;
mts[0]->subtype = MEDIASUBTYPE_PCM;
mts[0]->subtype = GUID_NULL;
mts[0]->bFixedSizeSamples = TRUE;
mts[0]->bTemporalCompression = FALSE;
mts[0]->lSampleSize = 2;
mts[0]->formattype = FORMAT_WaveFormatEx;
mts[0]->cbFormat = sizeof(WAVEFORMATEX);
mts[0]->pbFormat = CoTaskMemAlloc(sizeof(WAVEFORMATEX));
memcpy(mts[0]->pbFormat, &wfx, sizeof(WAVEFORMATEX));
++enum_media_types->index;
*ret_count = 1;
return count == 1 ? S_OK : S_FALSE;

View File

@ -2515,20 +2515,21 @@ static void test_media_types(void)
ok(count == 1, "Got count %u.\n", count);
ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Audio), "Got major type %s\n",
wine_dbgstr_guid(&pmt->majortype));
todo_wine ok(IsEqualGUID(&pmt->subtype, &GUID_NULL), "Got subtype %s\n",
ok(IsEqualGUID(&pmt->subtype, &GUID_NULL), "Got subtype %s\n",
wine_dbgstr_guid(&pmt->subtype));
todo_wine ok(pmt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", pmt->bFixedSizeSamples);
ok(pmt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", pmt->bFixedSizeSamples);
ok(!pmt->bTemporalCompression, "Got temporal compression %d.\n", pmt->bTemporalCompression);
todo_wine ok(pmt->lSampleSize == 2, "Got sample size %u.\n", pmt->lSampleSize);
todo_wine ok(IsEqualGUID(&pmt->formattype, &FORMAT_WaveFormatEx), "Got format type %s.\n",
ok(pmt->lSampleSize == 2, "Got sample size %u.\n", pmt->lSampleSize);
ok(IsEqualGUID(&pmt->formattype, &FORMAT_WaveFormatEx), "Got format type %s.\n",
wine_dbgstr_guid(&pmt->formattype));
ok(!pmt->pUnk, "Got pUnk %p.\n", pmt->pUnk);
todo_wine ok(pmt->cbFormat == sizeof(WAVEFORMATEX), "Got format size %u.\n", pmt->cbFormat);
ok(pmt->cbFormat == sizeof(WAVEFORMATEX), "Got format size %u.\n", pmt->cbFormat);
ok(!memcmp(pmt->pbFormat, &expect_wfx, pmt->cbFormat), "Format blocks didn't match.\n");
hr = IPin_QueryAccept(pin, pmt);
ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
CoTaskMemFree(pmt->pbFormat);
CoTaskMemFree(pmt);
hr = IEnumMediaTypes_Next(enummt, 1, &pmt, &count);