[PATCH v2 4/4] qasf: Implement IFileSourceFilter_GetCurFile() for WM ASF reader.

Jactry Zeng jzeng at codeweavers.com
Mon Apr 6 04:41:42 CDT 2020


Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
---
 dlls/qasf/asfreader.c       | 25 +++++++++++++++++++++++--
 dlls/qasf/tests/asfreader.c | 26 ++++++++++----------------
 2 files changed, 33 insertions(+), 18 deletions(-)

diff --git a/dlls/qasf/asfreader.c b/dlls/qasf/asfreader.c
index 6630d7badc..fa9814e3e7 100644
--- a/dlls/qasf/asfreader.c
+++ b/dlls/qasf/asfreader.c
@@ -124,9 +124,30 @@ static HRESULT WINAPI filesourcefilter_Load(IFileSourceFilter * iface, LPCOLESTR
 
 static HRESULT WINAPI filesourcefilter_GetCurFile(IFileSourceFilter *iface, LPOLESTR *filename, AM_MEDIA_TYPE *type)
 {
-    FIXME("(%p, %p, %p): stub.\n", iface, filename, type);
+    struct asf_reader *This = impl_reader_from_IFileSourceFilter(iface);
+
+    TRACE("(%p, %p, %p).\n", iface, filename, type);
+
+    if (!filename)
+        return E_POINTER;
+
+    *filename = NULL;
+    if (type)
+    {
+        type->majortype = This->type.majortype;
+        type->subtype = This->type.subtype;
+        type->lSampleSize = This->type.lSampleSize;
+        type->pUnk = This->type.pUnk;
+        type->cbFormat = This->type.cbFormat;
+    }
 
-    return E_NOTIMPL;
+    if (This->filename)
+    {
+        *filename = CoTaskMemAlloc((wcslen(This->filename) + 1) * sizeof(WCHAR));
+        wcscpy(*filename, This->filename);
+    }
+
+    return S_OK;
 }
 
 static const IFileSourceFilterVtbl filesourcefilter_vtbl =
diff --git a/dlls/qasf/tests/asfreader.c b/dlls/qasf/tests/asfreader.c
index c90956c85e..176c6ca25f 100644
--- a/dlls/qasf/tests/asfreader.c
+++ b/dlls/qasf/tests/asfreader.c
@@ -213,24 +213,24 @@ static void test_filesourcefilter(void)
     olepath = (void *)0xdeadbeef;
     memset(&type, 0x22, sizeof(type));
     hr = IFileSourceFilter_GetCurFile(filesource, &olepath, &type);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(!olepath, "Got %s.\n", wine_dbgstr_w(olepath));
-    todo_wine ok(IsEqualGUID(&type.majortype, &MEDIATYPE_NULL), "Got majortype %s.\n",
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(!olepath, "Got %s.\n", wine_dbgstr_w(olepath));
+    ok(IsEqualGUID(&type.majortype, &MEDIATYPE_NULL), "Got majortype %s.\n",
        wine_dbgstr_guid(&type.majortype));
-    todo_wine ok(IsEqualGUID(&type.subtype, &MEDIASUBTYPE_NULL), "Got subtype %s.\n",
+    ok(IsEqualGUID(&type.subtype, &MEDIASUBTYPE_NULL), "Got subtype %s.\n",
        wine_dbgstr_guid(&type.subtype));
     ok(type.bFixedSizeSamples == 0x22222222, "Got fixed size %d.\n", type.bFixedSizeSamples);
     ok(type.bTemporalCompression == 0x22222222, "Got temporal compression %d.\n", type.bTemporalCompression);
-    todo_wine ok(!type.lSampleSize, "Got sample size %u.\n", type.lSampleSize);
+    ok(!type.lSampleSize, "Got sample size %u.\n", type.lSampleSize);
     ok(IsEqualIID(&type.formattype, &IID_TESTIID), "Got format type %s.\n", wine_dbgstr_guid(&type.formattype));
-    todo_wine ok(!type.pUnk, "Got pUnk %p.\n", type.pUnk);
-    todo_wine ok(!type.cbFormat, "Got format size %u.\n", type.cbFormat);
+    ok(!type.pUnk, "Got pUnk %p.\n", type.pUnk);
+    ok(!type.cbFormat, "Got format size %u.\n", type.cbFormat);
     ok(type.pbFormat == (BYTE *)0x22222222, "Got format block %p.\n", type.pbFormat);
 
     hr = IFileSourceFilter_Load(filesource, L"nonexistent.wmv", NULL);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     hr = IFileSourceFilter_GetCurFile(filesource, NULL, NULL);
-    todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
 
     hr = IFileSourceFilter_Load(filesource, L"nonexistent2.wmv", NULL);
     ok(hr == E_FAIL, "Got hr %#x.\n", hr);
@@ -238,9 +238,7 @@ static void test_filesourcefilter(void)
     olepath = (void *)0xdeadbeef;
     memset(&type, 0x22, sizeof(type));
     hr = IFileSourceFilter_GetCurFile(filesource, &olepath, &type);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
-    if (SUCCEEDED(hr))
-    {
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
     ok(!wcscmp(olepath, L"nonexistent.wmv"), "Expected path %s, got %s.\n",
        wine_dbgstr_w(L"nonexistent.wmv"), wine_dbgstr_w(olepath));
     ok(IsEqualGUID(&type.majortype, &MEDIATYPE_NULL), "Got majortype %s.\n",
@@ -255,7 +253,6 @@ static void test_filesourcefilter(void)
     ok(!type.cbFormat, "Got format size %u.\n", type.cbFormat);
     ok(type.pbFormat == (BYTE *)0x22222222, "Got format block %p.\n", type.pbFormat);
     CoTaskMemFree(olepath);
-    }
 
     hr = IBaseFilter_EnumPins(filter, &enumpins);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -277,9 +274,7 @@ static void test_filesourcefilter(void)
     olepath = (void *)0xdeadbeef;
     memset(&type, 0x22, sizeof(type));
     hr = IFileSourceFilter_GetCurFile(filesource, &olepath, &type);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
-    if (SUCCEEDED(hr))
-    {
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
     ok(!wcscmp(olepath, L"nonexistent.wmv"), "Expected path %s, got %s.\n",
        wine_dbgstr_w(L"nonexistent.wmv"), wine_dbgstr_w(olepath));
     ok(IsEqualGUID(&type.majortype, &MEDIATYPE_NULL), "Got majortype %s.\n",
@@ -294,7 +289,6 @@ static void test_filesourcefilter(void)
     ok(!type.cbFormat, "Got format size %u.\n", type.cbFormat);
     ok(type.pbFormat == (BYTE *)0x22222222, "Got format block %p.\n", type.pbFormat);
     CoTaskMemFree(olepath);
-    }
 
     ref = IFilterGraph2_Release(graph);
     ok(!ref, "Got outstanding refcount %d.\n", ref);
-- 
2.26.0



More information about the wine-devel mailing list