Signed-off-by: Jactry Zeng jzeng@codeweavers.com --- dlls/qasf/asfreader.c | 67 +++++++++++++++++++++++++++++++++++++ dlls/qasf/tests/asfreader.c | 2 +- 2 files changed, 68 insertions(+), 1 deletion(-)
diff --git a/dlls/qasf/asfreader.c b/dlls/qasf/asfreader.c index e5dbd1d052..8388d79a31 100644 --- a/dlls/qasf/asfreader.c +++ b/dlls/qasf/asfreader.c @@ -25,6 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(qasf); struct asf_reader { struct strmbase_filter filter; + IFileSourceFilter IFileSourceFilter_iface; };
static inline struct asf_reader *impl_reader_from_strmbase_filter(struct strmbase_filter *iface) @@ -32,6 +33,11 @@ static inline struct asf_reader *impl_reader_from_strmbase_filter(struct strmbas return CONTAINING_RECORD(iface, struct asf_reader, filter); }
+static inline struct asf_reader *impl_reader_from_IFileSourceFilter(IFileSourceFilter *iface) +{ + return CONTAINING_RECORD(iface, struct asf_reader, IFileSourceFilter_iface); +} + static struct strmbase_pin *asf_reader_get_pin(struct strmbase_filter *iface, unsigned int index) { return NULL; @@ -45,10 +51,69 @@ static void asf_reader_destroy(struct strmbase_filter *iface) free(filter); }
+static HRESULT asf_reader_query_interface(struct strmbase_filter *iface, REFIID iid, void **out) +{ + struct asf_reader *filter = impl_reader_from_strmbase_filter(iface); + + if (IsEqualGUID(iid, &IID_IFileSourceFilter)) + { + *out = &filter->IFileSourceFilter_iface; + IUnknown_AddRef((IUnknown *)*out); + return S_OK; + } + + return E_NOINTERFACE; +} + static struct strmbase_filter_ops filter_ops = { .filter_get_pin = asf_reader_get_pin, .filter_destroy = asf_reader_destroy, + .filter_query_interface = asf_reader_query_interface, +}; + +static HRESULT WINAPI filesourcefilter_QueryInterface(IFileSourceFilter *iface, REFIID riid, void **out) +{ + struct asf_reader *This = impl_reader_from_IFileSourceFilter(iface); + + return IBaseFilter_QueryInterface(&This->filter.IBaseFilter_iface, riid, out); +} + +static ULONG WINAPI filesourcefilter_AddRef(IFileSourceFilter *iface) +{ + struct asf_reader *This = impl_reader_from_IFileSourceFilter(iface); + + return IBaseFilter_AddRef(&This->filter.IBaseFilter_iface); +} + +static ULONG WINAPI filesourcefilter_Release(IFileSourceFilter *iface) +{ + struct asf_reader *This = impl_reader_from_IFileSourceFilter(iface); + + return IBaseFilter_Release(&This->filter.IBaseFilter_iface); +} + +static HRESULT WINAPI filesourcefilter_Load(IFileSourceFilter * iface, LPCOLESTR filename, const AM_MEDIA_TYPE *type) +{ + FIXME("(%p, %s, %p): stub.\n", iface, debugstr_w(filename), type); + + return E_NOTIMPL; +} + +static HRESULT WINAPI filesourcefilter_GetCurFile(IFileSourceFilter *iface, LPOLESTR *filename, AM_MEDIA_TYPE *type) +{ + FIXME("(%p, %p, %p): stub.\n", iface, filename, type); + + return E_NOTIMPL; +} + +static const IFileSourceFilterVtbl filesourcefilter_vtbl = +{ + filesourcefilter_QueryInterface, + filesourcefilter_AddRef, + filesourcefilter_Release, + filesourcefilter_Load, + filesourcefilter_GetCurFile };
HRESULT asf_reader_create(IUnknown *outer, IUnknown **out) @@ -60,6 +125,8 @@ HRESULT asf_reader_create(IUnknown *outer, IUnknown **out)
strmbase_filter_init(&object->filter, outer, &CLSID_WMAsfReader, &filter_ops);
+ object->IFileSourceFilter_iface.lpVtbl = &filesourcefilter_vtbl; + TRACE("Created WM ASF reader %p.\n", object); *out = &object->filter.IUnknown_inner;
diff --git a/dlls/qasf/tests/asfreader.c b/dlls/qasf/tests/asfreader.c index 2b8e8f6f00..b3f61a352a 100644 --- a/dlls/qasf/tests/asfreader.c +++ b/dlls/qasf/tests/asfreader.c @@ -71,7 +71,7 @@ static void test_interfaces(void)
check_interface(filter, &IID_IBaseFilter, TRUE); check_interface(filter, &IID_IMediaFilter, TRUE); - todo_wine check_interface(filter, &IID_IFileSourceFilter, TRUE); + check_interface(filter, &IID_IFileSourceFilter, TRUE); check_interface(filter, &IID_IPersist, TRUE); check_interface(filter, &IID_IUnknown, TRUE);