Gijs Vermeulen : amstream: Return correct media type info when enumerating AMAudioStream media types.
Alexandre Julliard
julliard at winehq.org
Sat Aug 1 05:45:55 CDT 2020
Module: wine
Branch: master
Commit: 218409c2d63ac171229471231d210471af98f068
URL: https://source.winehq.org/git/wine.git/?a=commit;h=218409c2d63ac171229471231d210471af98f068
Author: Gijs Vermeulen <gijsvrm at gmail.com>
Date: Thu Jul 30 18:08:52 2020 +0200
amstream: Return correct media type info when enumerating AMAudioStream media types.
Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/amstream/audiostream.c | 21 ++++++++++++++++++++-
dlls/amstream/tests/amstream.c | 11 ++++++-----
2 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/dlls/amstream/audiostream.c b/dlls/amstream/audiostream.c
index 072850aae7..dc6c810d19 100644
--- a/dlls/amstream/audiostream.c
+++ b/dlls/amstream/audiostream.c
@@ -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;
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
index 130f9f0e0e..cf66538a7a 100644
--- a/dlls/amstream/tests/amstream.c
+++ b/dlls/amstream/tests/amstream.c
@@ -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);
More information about the wine-cvs
mailing list