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

Zebediah Figura zfigura at codeweavers.com
Wed Apr 1 10:34:36 CDT 2020


On 3/31/20 11:04 AM, Jactry Zeng wrote:
> Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
> ---
>  dlls/qasf/tests/wmasf.c | 20 +++++++-------------
>  dlls/qasf/wmasf.c       | 21 +++++++++++++++++++--
>  2 files changed, 26 insertions(+), 15 deletions(-)
> 
> diff --git a/dlls/qasf/tests/wmasf.c b/dlls/qasf/tests/wmasf.c
> index 7cf11c6c9f..1620a24aa1 100644
> --- a/dlls/qasf/tests/wmasf.c
> +++ b/dlls/qasf/tests/wmasf.c
> @@ -207,11 +207,11 @@ 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));
>      CoTaskMemFree(olepath);
>  
> @@ -219,7 +219,7 @@ static void test_filesourcefilter(void)
>      hr = IFileSourceFilter_Load(filesource, path, 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);
>  
>      path = L"nonexistent2.wmv";
>      hr = IFileSourceFilter_Load(filesource, path, NULL);
> @@ -229,16 +229,13 @@ 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, path), "Expected path %s, got %s.\n",
>         wine_dbgstr_w(path), wine_dbgstr_w(olepath));
>      ok(IsEqualGUID(&type.majortype, &MEDIATYPE_NULL), "Got majortype %s.\n",
>         wine_dbgstr_guid(&type.majortype));
>      ok(IsEqualGUID(&type.subtype, &MEDIASUBTYPE_NULL), "Got subtype %s.\n",
>         wine_dbgstr_guid(&type.subtype));
> -    }
>      CoTaskMemFree(olepath);
>  
>      hr = IFileSourceFilter_QueryInterface(filesource, &IID_IBaseFilter, (void **)&filter);
> @@ -265,16 +262,13 @@ 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, path), "Expected path %s, got %s.\n",
>         wine_dbgstr_w(path), wine_dbgstr_w(olepath));
>      ok(IsEqualGUID(&type.majortype, &MEDIATYPE_NULL), "Got majortype %s.\n",
>         wine_dbgstr_guid(&type.majortype));
>      ok(IsEqualGUID(&type.subtype, &MEDIASUBTYPE_NULL), "Got subtype %s.\n",
>         wine_dbgstr_guid(&type.subtype));
> -    }
>      CoTaskMemFree(olepath);
>  
>      IFilterGraph2_Release(graph);
> diff --git a/dlls/qasf/wmasf.c b/dlls/qasf/wmasf.c
> index e8d1363170..4fc0726879 100644
> --- a/dlls/qasf/wmasf.c
> +++ b/dlls/qasf/wmasf.c
> @@ -126,9 +126,26 @@ 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 wmasf_reader *This = impl_reader_from_IFileSourceFilter(iface);
> +
> +    TRACE("(%p, %p, %p).\n", iface, filename, type);
> +
> +    if (!filename)
> +        return E_POINTER;
> +
> +    *filename = NULL;
> +    if (type)
> +        memset(type, 0, sizeof(*type));
>  
> -    return E_NOTIMPL;
> +    if (This->filename)
> +    {
> +        *filename = CoTaskMemAlloc((wcslen(This->filename) + 1) * sizeof(WCHAR));
> +        wcscpy(*filename, This->filename);
> +        if (type)
> +            CopyMediaType(type, &This->type);
> +    }
> +
> +    return S_OK;
>  }
>  
>  static const IFileSourceFilterVtbl filesourcefilter_vtbl =
> 

This patch looks fine to me.



More information about the wine-devel mailing list