Zebediah Figura : mp3dmod: Verify the format type in IMediaObject::SetOutputType().

Alexandre Julliard julliard at winehq.org
Tue Feb 25 17:23:07 CST 2020


Module: wine
Branch: master
Commit: 690fbf64b85af0b11946e73e41c5335c9b97c1ba
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=690fbf64b85af0b11946e73e41c5335c9b97c1ba

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Feb 24 23:36:15 2020 -0600

mp3dmod: Verify the format type in IMediaObject::SetOutputType().

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mp3dmod/mp3dmod.c       |  3 +++
 dlls/mp3dmod/tests/mp3dmod.c | 26 ++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/dlls/mp3dmod/mp3dmod.c b/dlls/mp3dmod/mp3dmod.c
index 6a904716bc..592ee5482a 100644
--- a/dlls/mp3dmod/mp3dmod.c
+++ b/dlls/mp3dmod/mp3dmod.c
@@ -266,6 +266,9 @@ static HRESULT WINAPI MediaObject_SetOutputType(IMediaObject *iface, DWORD index
         return S_OK;
     }
 
+    if (!IsEqualGUID(&type->formattype, &WMFORMAT_WaveFormatEx))
+        return DMO_E_TYPE_NOT_ACCEPTED;
+
     format = (WAVEFORMATEX *)type->pbFormat;
 
     if (format->wBitsPerSample == 8)
diff --git a/dlls/mp3dmod/tests/mp3dmod.c b/dlls/mp3dmod/tests/mp3dmod.c
index 285b76023b..99d52e6fd7 100644
--- a/dlls/mp3dmod/tests/mp3dmod.c
+++ b/dlls/mp3dmod/tests/mp3dmod.c
@@ -394,6 +394,21 @@ static void test_media_types(void)
         .nSamplesPerSec = 48000,
     };
 
+    WAVEFORMATEX output_format =
+    {
+        .nChannels = 1,
+        .nSamplesPerSec = 48000,
+        .nAvgBytesPerSec = 48000,
+        .nBlockAlign = 1,
+        .wBitsPerSample = 8,
+    };
+    DMO_MEDIA_TYPE output_mt =
+    {
+        .formattype = FORMAT_WaveFormatEx,
+        .cbFormat = sizeof(output_format),
+        .pbFormat = (BYTE *)&output_format,
+    };
+
     DMO_MEDIA_TYPE mt;
     IMediaObject *dmo;
     HRESULT hr;
@@ -514,6 +529,17 @@ static void test_media_types(void)
     hr = IMediaObject_GetOutputType(dmo, 0, 2, &mt);
     ok(hr == DMO_E_NO_MORE_ITEMS, "Got hr %#x.\n", hr);
 
+    hr = IMediaObject_SetOutputType(dmo, 0, &output_mt, DMO_SET_TYPEF_TEST_ONLY);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    output_mt.formattype = GUID_NULL;
+    hr = IMediaObject_SetOutputType(dmo, 0, &output_mt, DMO_SET_TYPEF_TEST_ONLY);
+    ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    output_mt.formattype = FORMAT_None;
+    hr = IMediaObject_SetOutputType(dmo, 0, &output_mt, DMO_SET_TYPEF_TEST_ONLY);
+    ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    output_mt.formattype = FORMAT_WaveFormatEx;
+
     IMediaObject_Release(dmo);
 }
 




More information about the wine-cvs mailing list