[PATCH 1/6] amstream: Return correct media type info when enumerating AMAudioStream media types.
Gijs Vermeulen
gijsvrm at gmail.com
Wed Jul 29 05:30:32 CDT 2020
Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
---
dlls/amstream/audiostream.c | 20 +++++++++++++++++++-
dlls/amstream/tests/amstream.c | 10 +++++-----
2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/dlls/amstream/audiostream.c b/dlls/amstream/audiostream.c
index 112891eeb7..c3831544d6 100644
--- a/dlls/amstream/audiostream.c
+++ b/dlls/amstream/audiostream.c
@@ -821,6 +821,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)
@@ -831,7 +842,14 @@ 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 = (BYTE *)&wfx;
+
++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 68d2b9c18f..da9633feec 100644
--- a/dlls/amstream/tests/amstream.c
+++ b/dlls/amstream/tests/amstream.c
@@ -2426,15 +2426,15 @@ 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);
--
2.27.0
More information about the wine-devel
mailing list