Zebediah Figura : quartz/filesource: Return a default media type from FileAsyncReaderPin_GetMediaType().

Alexandre Julliard julliard at winehq.org
Fri Feb 22 15:22:10 CST 2019


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu Feb 21 18:42:58 2019 -0600

quartz/filesource: Return a default media type from FileAsyncReaderPin_GetMediaType().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/quartz/filesource.c       | 39 ++++++++++++++++++++++-------------
 dlls/quartz/tests/filesource.c | 46 +++++++++++++++++-------------------------
 2 files changed, 44 insertions(+), 41 deletions(-)

diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c
index 44794df..6b8bfa3 100644
--- a/dlls/quartz/filesource.c
+++ b/dlls/quartz/filesource.c
@@ -37,6 +37,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz);
 
 static const WCHAR wszOutputPinName[] = { 'O','u','t','p','u','t',0 };
 
+static const AM_MEDIA_TYPE default_mt =
+{
+    {0xe436eb83,0x524f,0x11ce,{0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70}},   /* MEDIATYPE_Stream */
+    {0,0,0,{0,0,0,0,0,0,0,0}},
+    TRUE,
+    FALSE,
+    1,
+    {0,0,0,{0,0,0,0,0,0,0,0}},
+    NULL,
+    0,
+    NULL
+};
+
 typedef struct AsyncReader
 {
     BaseFilter filter;
@@ -618,19 +631,11 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
         This->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
         if (!pmt)
         {
-            This->pmt->bFixedSizeSamples = TRUE;
-            This->pmt->bTemporalCompression = FALSE;
-            This->pmt->cbFormat = 0;
-            This->pmt->pbFormat = NULL;
-            This->pmt->pUnk = NULL;
-            This->pmt->lSampleSize = 1;
-            This->pmt->formattype = GUID_NULL;
-            hr = GetClassMediaFile(pReader, pszFileName, &This->pmt->majortype, &This->pmt->subtype, NULL);
-            if (FAILED(hr))
+            CopyMediaType(This->pmt, &default_mt);
+            if (FAILED(GetClassMediaFile(pReader, pszFileName, &This->pmt->majortype, &This->pmt->subtype, NULL)))
             {
                 This->pmt->majortype = MEDIATYPE_Stream;
                 This->pmt->subtype = MEDIASUBTYPE_NULL;
-                hr = S_OK;
             }
         }
         else
@@ -763,14 +768,20 @@ static HRESULT WINAPI FileAsyncReaderPin_CheckMediaType(BasePin *pin, const AM_M
     return S_FALSE;
 }
 
-static HRESULT WINAPI FileAsyncReaderPin_GetMediaType(BasePin *iface, int iPosition, AM_MEDIA_TYPE *pmt)
+static HRESULT WINAPI FileAsyncReaderPin_GetMediaType(BasePin *iface, int index, AM_MEDIA_TYPE *mt)
 {
     FileAsyncReader *This = impl_from_BasePin(iface);
-    if (iPosition < 0)
+    AsyncReader *filter = impl_from_IBaseFilter(This->pin.pin.pinInfo.pFilter);
+
+    if (index < 0)
         return E_INVALIDARG;
-    if (iPosition > 0)
+    else if (index > 1)
         return VFW_S_NO_MORE_ITEMS;
-    CopyMediaType(pmt, impl_from_IBaseFilter(This->pin.pin.pinInfo.pFilter)->pmt);
+
+    if (index == 0)
+        CopyMediaType(mt, filter->pmt);
+    else if (index == 1)
+        CopyMediaType(mt, &default_mt);
     return S_OK;
 }
 
diff --git a/dlls/quartz/tests/filesource.c b/dlls/quartz/tests/filesource.c
index 2e287f7..7330a83 100644
--- a/dlls/quartz/tests/filesource.c
+++ b/dlls/quartz/tests/filesource.c
@@ -257,15 +257,11 @@ static void test_file_source_filter(void)
         CoTaskMemFree(pmt);
 
         hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
-todo_wine
         ok(hr == S_OK, "Got hr %#x.\n", hr);
-        if (hr == S_OK)
-        {
-            mt = file_mt;
-            mt.subtype = GUID_NULL;
-            ok(!memcmp(pmt, &mt, sizeof(*pmt)), "Media types did not match.\n");
-            CoTaskMemFree(pmt);
-        }
+        mt = file_mt;
+        mt.subtype = GUID_NULL;
+        ok(!memcmp(pmt, &mt, sizeof(*pmt)), "Media types did not match.\n");
+        CoTaskMemFree(pmt);
 
         hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
         ok(hr == S_FALSE, "Got hr %#x.\n", hr);
@@ -339,26 +335,22 @@ todo_wine
     CoTaskMemFree(pmt);
 
     hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
-todo_wine
     ok(hr == S_OK, "Got hr %#x.\n", hr);
-    if (hr == S_OK)
-    {
-        ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Stream), "Got major type %s.\n",
-                wine_dbgstr_guid(&pmt->majortype));
-        ok(IsEqualGUID(&pmt->subtype, &GUID_NULL), "Got subtype %s.\n",
-                wine_dbgstr_guid(&pmt->subtype));
-        ok(pmt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", pmt->bFixedSizeSamples);
-        ok(!pmt->bTemporalCompression, "Got temporal compression %d.\n", pmt->bTemporalCompression);
-        ok(pmt->lSampleSize == 1, "Got sample size %u.\n", pmt->lSampleSize);
-        ok(IsEqualGUID(&pmt->formattype, &GUID_NULL), "Got format type %s.\n",
-                wine_dbgstr_guid(&pmt->formattype));
-        ok(!pmt->pUnk, "Got pUnk %p.\n", pmt->pUnk);
-        ok(!pmt->cbFormat, "Got format size %#x.\n", pmt->cbFormat);
-        ok(!pmt->pbFormat, "Got format %p.\n", pmt->pbFormat);
-
-        hr = IPin_QueryAccept(pin, pmt);
-        ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    }
+    ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Stream), "Got major type %s.\n",
+            wine_dbgstr_guid(&pmt->majortype));
+    ok(IsEqualGUID(&pmt->subtype, &GUID_NULL), "Got subtype %s.\n",
+            wine_dbgstr_guid(&pmt->subtype));
+    ok(pmt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", pmt->bFixedSizeSamples);
+    ok(!pmt->bTemporalCompression, "Got temporal compression %d.\n", pmt->bTemporalCompression);
+    ok(pmt->lSampleSize == 1, "Got sample size %u.\n", pmt->lSampleSize);
+    ok(IsEqualGUID(&pmt->formattype, &GUID_NULL), "Got format type %s.\n",
+            wine_dbgstr_guid(&pmt->formattype));
+    ok(!pmt->pUnk, "Got pUnk %p.\n", pmt->pUnk);
+    ok(!pmt->cbFormat, "Got format size %#x.\n", pmt->cbFormat);
+    ok(!pmt->pbFormat, "Got format %p.\n", pmt->pbFormat);
+
+    hr = IPin_QueryAccept(pin, pmt);
+    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
     ok(hr == S_FALSE, "Got hr %#x.\n", hr);




More information about the wine-cvs mailing list