Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- configure.ac | 1 + dlls/qdvd/graph.c | 61 ++++++++++--- dlls/qdvd/qdvd_main.c | 8 +- dlls/qdvd/qdvd_private.h | 2 +- dlls/qdvd/tests/Makefile.in | 5 ++ dlls/qdvd/tests/graph.c | 171 ++++++++++++++++++++++++++++++++++++ 6 files changed, 232 insertions(+), 16 deletions(-) create mode 100644 dlls/qdvd/tests/Makefile.in create mode 100644 dlls/qdvd/tests/graph.c
diff --git a/configure.ac b/configure.ac index 4829648c3a..d914e3eca8 100644 --- a/configure.ac +++ b/configure.ac @@ -3634,6 +3634,7 @@ WINE_CONFIG_MAKEFILE(dlls/qasf/tests) WINE_CONFIG_MAKEFILE(dlls/qcap) WINE_CONFIG_MAKEFILE(dlls/qcap/tests) WINE_CONFIG_MAKEFILE(dlls/qdvd) +WINE_CONFIG_MAKEFILE(dlls/qdvd/tests) WINE_CONFIG_MAKEFILE(dlls/qedit) WINE_CONFIG_MAKEFILE(dlls/qedit/tests) WINE_CONFIG_MAKEFILE(dlls/qmgr) diff --git a/dlls/qdvd/graph.c b/dlls/qdvd/graph.c index f33293bfa4..986fcc0db0 100644 --- a/dlls/qdvd/graph.c +++ b/dlls/qdvd/graph.c @@ -24,26 +24,29 @@ WINE_DEFAULT_DEBUG_CHANNEL(qdvd);
struct graph_builder { + IUnknown IUnknown_inner; IDvdGraphBuilder IDvdGraphBuilder_iface; + + IUnknown *outer_unk; LONG refcount; };
-static struct graph_builder *impl_from_IDvdGraphBuilder(IDvdGraphBuilder *iface) +static struct graph_builder *impl_from_IUnknown(IUnknown *iface) { - return CONTAINING_RECORD(iface, struct graph_builder, IDvdGraphBuilder_iface); + return CONTAINING_RECORD(iface, struct graph_builder, IUnknown_inner); }
-static ULONG WINAPI graph_builder_AddRef(IDvdGraphBuilder *iface) +static ULONG WINAPI inner_AddRef(IUnknown *iface) { - struct graph_builder *builder = impl_from_IDvdGraphBuilder(iface); + struct graph_builder *builder = impl_from_IUnknown(iface); ULONG refcount = InterlockedIncrement(&builder->refcount); TRACE("%p increasing refcount to %u.\n", builder, refcount); return refcount; }
-static ULONG WINAPI graph_builder_Release(IDvdGraphBuilder *iface) +static ULONG WINAPI inner_Release(IUnknown *iface) { - struct graph_builder *builder = impl_from_IDvdGraphBuilder(iface); + struct graph_builder *builder = impl_from_IUnknown(iface); ULONG refcount = InterlockedDecrement(&builder->refcount); TRACE("%p decreasing refcount to %u.\n", builder, refcount); if (!refcount) @@ -51,12 +54,16 @@ static ULONG WINAPI graph_builder_Release(IDvdGraphBuilder *iface) return refcount; }
-static HRESULT WINAPI graph_builder_QueryInterface(IDvdGraphBuilder *iface, REFIID iid, void **out) +static HRESULT WINAPI inner_QueryInterface(IUnknown *iface, REFIID iid, void **out) { + struct graph_builder *builder = impl_from_IUnknown(iface); + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
- if (IsEqualGUID(iid, &IID_IDvdGraphBuilder) || IsEqualGUID(iid, &IID_IUnknown)) - *out = iface; + if (IsEqualGUID(iid, &IID_IUnknown)) + *out = &builder->IUnknown_inner; + else if (IsEqualGUID(iid, &IID_IDvdGraphBuilder)) + *out = &builder->IDvdGraphBuilder_iface; else { *out = NULL; @@ -68,6 +75,36 @@ static HRESULT WINAPI graph_builder_QueryInterface(IDvdGraphBuilder *iface, REFI return S_OK; }
+static const IUnknownVtbl inner_vtbl = +{ + inner_QueryInterface, + inner_AddRef, + inner_Release, +}; + +static struct graph_builder *impl_from_IDvdGraphBuilder(IDvdGraphBuilder *iface) +{ + return CONTAINING_RECORD(iface, struct graph_builder, IDvdGraphBuilder_iface); +} + +static ULONG WINAPI graph_builder_AddRef(IDvdGraphBuilder *iface) +{ + struct graph_builder *builder = impl_from_IDvdGraphBuilder(iface); + return IUnknown_AddRef(builder->outer_unk); +} + +static ULONG WINAPI graph_builder_Release(IDvdGraphBuilder *iface) +{ + struct graph_builder *builder = impl_from_IDvdGraphBuilder(iface); + return IUnknown_Release(builder->outer_unk); +} + +static HRESULT WINAPI graph_builder_QueryInterface(IDvdGraphBuilder *iface, REFIID iid, void **out) +{ + struct graph_builder *builder = impl_from_IDvdGraphBuilder(iface); + return IUnknown_QueryInterface(builder->outer_unk, iid, out); +} + static HRESULT WINAPI graph_builder_GetFiltergraph(IDvdGraphBuilder *iface, IGraphBuilder **graph) { FIXME("iface %p, graph %p, stub!\n", iface, graph); @@ -96,7 +133,7 @@ static const struct IDvdGraphBuilderVtbl graph_builder_vtbl = graph_builder_RenderDvdVideoVolume, };
-HRESULT graph_builder_create(IUnknown **out) +HRESULT graph_builder_create(IUnknown *outer, IUnknown **out) { struct graph_builder *builder;
@@ -104,9 +141,11 @@ HRESULT graph_builder_create(IUnknown **out) return E_OUTOFMEMORY;
builder->IDvdGraphBuilder_iface.lpVtbl = &graph_builder_vtbl; + builder->IUnknown_inner.lpVtbl = &inner_vtbl; builder->refcount = 1; + builder->outer_unk = outer ? outer : &builder->IUnknown_inner;
TRACE("Created DVD graph builder %p.\n", builder); - *out = (IUnknown *)&builder->IDvdGraphBuilder_iface; + *out = &builder->IUnknown_inner; return S_OK; } diff --git a/dlls/qdvd/qdvd_main.c b/dlls/qdvd/qdvd_main.c index 9377f248ce..c529533e44 100644 --- a/dlls/qdvd/qdvd_main.c +++ b/dlls/qdvd/qdvd_main.c @@ -28,7 +28,7 @@ static HINSTANCE qdvd_instance; struct class_factory { IClassFactory IClassFactory_iface; - HRESULT (*create_instance)(IUnknown **out); + HRESULT (*create_instance)(IUnknown *outer, IUnknown **out); };
static struct class_factory *impl_from_IClassFactory(IClassFactory *iface) @@ -73,10 +73,10 @@ static HRESULT WINAPI class_factory_CreateInstance(IClassFactory *iface,
*out = NULL;
- if (outer) - return CLASS_E_NOAGGREGATION; + if (outer && !IsEqualGUID(iid, &IID_IUnknown)) + return E_NOINTERFACE;
- if (SUCCEEDED(hr = factory->create_instance(&unk))) + if (SUCCEEDED(hr = factory->create_instance(outer, &unk))) { hr = IUnknown_QueryInterface(unk, iid, out); IUnknown_Release(unk); diff --git a/dlls/qdvd/qdvd_private.h b/dlls/qdvd/qdvd_private.h index b54dd3ddc1..297949ee60 100644 --- a/dlls/qdvd/qdvd_private.h +++ b/dlls/qdvd/qdvd_private.h @@ -25,6 +25,6 @@ #include "dshow.h" #include "wine/debug.h"
-HRESULT graph_builder_create(IUnknown **out) DECLSPEC_HIDDEN; +HRESULT graph_builder_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
#endif /* QDVD_PRIVATE_H */ diff --git a/dlls/qdvd/tests/Makefile.in b/dlls/qdvd/tests/Makefile.in new file mode 100644 index 0000000000..3e9efd9c74 --- /dev/null +++ b/dlls/qdvd/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = qdvd.dll +IMPORTS = strmiids uuid ole32 + +C_SRCS = \ + graph.c diff --git a/dlls/qdvd/tests/graph.c b/dlls/qdvd/tests/graph.c new file mode 100644 index 0000000000..93dc4e66a9 --- /dev/null +++ b/dlls/qdvd/tests/graph.c @@ -0,0 +1,171 @@ +/* + * Graph builder unit tests + * + * Copyright 2020 Gijs Vermeulen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS +#include "dshow.h" +#include "wine/strmbase.h" +#include "wine/test.h" + +static IDvdGraphBuilder *create_graph_builder(void) +{ + IDvdGraphBuilder *graph = NULL; + HRESULT hr = CoCreateInstance(&CLSID_DvdGraphBuilder, NULL, + CLSCTX_INPROC_SERVER, &IID_IDvdGraphBuilder, (void **)&graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + return graph; +} + +static ULONG get_refcount(void *iface) +{ + IUnknown *unknown = iface; + IUnknown_AddRef(unknown); + return IUnknown_Release(unknown); +} + +#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +{ + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + +static void test_interfaces(void) +{ + IDvdGraphBuilder *graph = create_graph_builder(); + + check_interface(graph, &IID_IDvdGraphBuilder, TRUE); + check_interface(graph, &IID_IUnknown, TRUE); + + check_interface(graph, &IID_IBaseFilter, FALSE); + + IDvdGraphBuilder_Release(graph); +} + +static const GUID test_iid = {0x33333333}; +static LONG outer_ref = 1; + +static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out) +{ + if (IsEqualGUID(iid, &IID_IUnknown) + || IsEqualGUID(iid, &IID_IDvdGraphBuilder) + || IsEqualGUID(iid, &test_iid)) + { + *out = (IUnknown *)0xdeadbeef; + return S_OK; + } + ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI outer_AddRef(IUnknown *iface) +{ + return InterlockedIncrement(&outer_ref); +} + +static ULONG WINAPI outer_Release(IUnknown *iface) +{ + return InterlockedDecrement(&outer_ref); +} + +static const IUnknownVtbl outer_vtbl = +{ + outer_QueryInterface, + outer_AddRef, + outer_Release, +}; + +static IUnknown test_outer = {&outer_vtbl}; + +static void test_aggregation(void) +{ + IDvdGraphBuilder *graph, *graph2; + IUnknown *unk, *unk2; + HRESULT hr; + ULONG ref; + + graph = (IDvdGraphBuilder *)0xdeadbeef; + hr = CoCreateInstance(&CLSID_DvdGraphBuilder, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IDvdGraphBuilder, (void **)&graph); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(!graph, "Got interface %p.\n", graph); + + hr = CoCreateInstance(&CLSID_DvdGraphBuilder, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void **)&unk); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n"); + ref = get_refcount(unk); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + + ref = IUnknown_AddRef(unk); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + + ref = IUnknown_Release(unk); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + + hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2); + IUnknown_Release(unk2); + + hr = IUnknown_QueryInterface(unk, &IID_IDvdGraphBuilder, (void **)&graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IDvdGraphBuilder_QueryInterface(graph, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + hr = IDvdGraphBuilder_QueryInterface(graph, &IID_IDvdGraphBuilder, (void **)&graph2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(graph2 == (IDvdGraphBuilder *)0xdeadbeef, "Got unexpected IDvdGraphBuilder %p.\n", graph2); + + hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(!unk2, "Got unexpected IUnknown %p.\n", unk2); + + hr = IDvdGraphBuilder_QueryInterface(graph, &test_iid, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + IDvdGraphBuilder_Release(graph); + ref = IUnknown_Release(unk); + ok(!ref, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); +} + +START_TEST(graph) +{ + CoInitializeEx(NULL, COINIT_MULTITHREADED); + + test_interfaces(); + test_aggregation(); + + CoUninitialize(); +}
Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/qdvd/Makefile.in | 3 + dlls/qdvd/navigator.c | 67 +++++++++++++ dlls/qdvd/qdvd_classes.idl | 7 ++ dlls/qdvd/qdvd_main.c | 3 + dlls/qdvd/qdvd_private.h | 1 + dlls/qdvd/tests/Makefile.in | 3 +- dlls/qdvd/tests/navigator.c | 191 ++++++++++++++++++++++++++++++++++++ 7 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 dlls/qdvd/navigator.c create mode 100644 dlls/qdvd/tests/navigator.c
diff --git a/dlls/qdvd/Makefile.in b/dlls/qdvd/Makefile.in index 8f5089b3ac..e100870d32 100644 --- a/dlls/qdvd/Makefile.in +++ b/dlls/qdvd/Makefile.in @@ -1,10 +1,13 @@ MODULE = qdvd.dll IMPORTS = strmiids uuid ole32 +PARENTSRC = ../strmbase
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ + filter.c \ graph.c \ + navigator.c \ qdvd_main.c
IDL_SRCS = \ diff --git a/dlls/qdvd/navigator.c b/dlls/qdvd/navigator.c new file mode 100644 index 0000000000..1e121dde60 --- /dev/null +++ b/dlls/qdvd/navigator.c @@ -0,0 +1,67 @@ +/* + * Navigator filter + * + * Copyright 2020 Gijs Vermeulen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "qdvd_private.h" +#include "wine/strmbase.h" + +WINE_DEFAULT_DEBUG_CHANNEL(qdvd); + +struct navigator +{ + struct strmbase_filter filter; +}; + +static inline struct navigator *impl_from_strmbase_filter(struct strmbase_filter *filter) +{ + return CONTAINING_RECORD(filter, struct navigator, filter); +} + +static struct strmbase_pin *navigator_get_pin(struct strmbase_filter *iface, unsigned int index) +{ + return NULL; +} + +static void navigator_destroy(struct strmbase_filter *iface) +{ + struct navigator *filter = impl_from_strmbase_filter(iface); + + strmbase_filter_cleanup(&filter->filter); + free(filter); +} + +static const struct strmbase_filter_ops filter_ops = +{ + .filter_get_pin = navigator_get_pin, + .filter_destroy = navigator_destroy, +}; + +HRESULT navigator_create(IUnknown *outer, IUnknown **out) +{ + struct navigator *object; + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + strmbase_filter_init(&object->filter, outer, &CLSID_DVDNavigator, &filter_ops); + + TRACE("Created DVD Navigator filter %p.\n", object); + *out = &object->filter.IUnknown_inner; + return S_OK; +} diff --git a/dlls/qdvd/qdvd_classes.idl b/dlls/qdvd/qdvd_classes.idl index 7fd2a081ba..c55c7e3944 100644 --- a/dlls/qdvd/qdvd_classes.idl +++ b/dlls/qdvd/qdvd_classes.idl @@ -24,3 +24,10 @@ uuid(fcc152b7-f372-11d0-8e00-00c04fd7c08b), ] coclass DvdGraphBuilder {} + +[ + helpstring("DVD Navigator Filter"), + threading(both), + uuid(9b8c4620-2c1a-11d0-8493-00a02438ad48), +] +coclass DVDNavigator {} diff --git a/dlls/qdvd/qdvd_main.c b/dlls/qdvd/qdvd_main.c index c529533e44..2fdb108877 100644 --- a/dlls/qdvd/qdvd_main.c +++ b/dlls/qdvd/qdvd_main.c @@ -100,6 +100,7 @@ static const IClassFactoryVtbl class_factory_vtbl = };
static struct class_factory graph_builder_cf = {{&class_factory_vtbl}, graph_builder_create}; +static struct class_factory navigator_cf = {{&class_factory_vtbl}, navigator_create};
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) { @@ -120,6 +121,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out)
if (IsEqualGUID(clsid, &CLSID_DvdGraphBuilder)) return IClassFactory_QueryInterface(&graph_builder_cf.IClassFactory_iface, iid, out); + if (IsEqualGUID(clsid, &CLSID_DVDNavigator)) + return IClassFactory_QueryInterface(&navigator_cf.IClassFactory_iface, iid, out);
FIXME("%s not available, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(clsid)); return CLASS_E_CLASSNOTAVAILABLE; diff --git a/dlls/qdvd/qdvd_private.h b/dlls/qdvd/qdvd_private.h index 297949ee60..48fced46f1 100644 --- a/dlls/qdvd/qdvd_private.h +++ b/dlls/qdvd/qdvd_private.h @@ -26,5 +26,6 @@ #include "wine/debug.h"
HRESULT graph_builder_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN; +HRESULT navigator_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
#endif /* QDVD_PRIVATE_H */ diff --git a/dlls/qdvd/tests/Makefile.in b/dlls/qdvd/tests/Makefile.in index 3e9efd9c74..57f8fbba5a 100644 --- a/dlls/qdvd/tests/Makefile.in +++ b/dlls/qdvd/tests/Makefile.in @@ -2,4 +2,5 @@ TESTDLL = qdvd.dll IMPORTS = strmiids uuid ole32
C_SRCS = \ - graph.c + graph.c \ + navigator.c diff --git a/dlls/qdvd/tests/navigator.c b/dlls/qdvd/tests/navigator.c new file mode 100644 index 0000000000..f01e428b4e --- /dev/null +++ b/dlls/qdvd/tests/navigator.c @@ -0,0 +1,191 @@ +/* + * Navigator filter unit tests + * + * Copyright 2020 Gijs Vermeulen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS +#include "dshow.h" +#include "wine/strmbase.h" +#include "wine/test.h" + +static IBaseFilter *create_navigator(void) +{ + IBaseFilter *filter = NULL; + HRESULT hr = CoCreateInstance(&CLSID_DVDNavigator, NULL, + CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void **)&filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + return filter; +} + +static ULONG get_refcount(void *iface) +{ + IUnknown *unknown = iface; + IUnknown_AddRef(unknown); + return IUnknown_Release(unknown); +} + +#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +{ + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + +static void test_interfaces(void) +{ + IBaseFilter *filter = create_navigator(); + + check_interface(filter, &IID_IBaseFilter, TRUE); + todo_wine check_interface(filter, &IID_IDvdControl, TRUE); + todo_wine check_interface(filter, &IID_IDvdControl2, TRUE); + todo_wine check_interface(filter, &IID_IDvdInfo, TRUE); + todo_wine check_interface(filter, &IID_IDvdInfo2, TRUE); + check_interface(filter, &IID_IMediaFilter, TRUE); + check_interface(filter, &IID_IPersist, TRUE); + todo_wine check_interface(filter, &IID_ISpecifyPropertyPages, TRUE); + check_interface(filter, &IID_IUnknown, TRUE); + + check_interface(filter, &IID_IAMFilterMiscFlags, FALSE); + check_interface(filter, &IID_IBasicAudio, FALSE); + check_interface(filter, &IID_IBasicVideo, FALSE); + check_interface(filter, &IID_IFileSourceFilter, FALSE); + check_interface(filter, &IID_IKsPropertySet, FALSE); + check_interface(filter, &IID_IMediaPosition, FALSE); + check_interface(filter, &IID_IMediaSeeking, FALSE); + check_interface(filter, &IID_IPersistPropertyBag, FALSE); + check_interface(filter, &IID_IPersistStream, FALSE); + check_interface(filter, &IID_IPin, FALSE); + check_interface(filter, &IID_IQualityControl, FALSE); + check_interface(filter, &IID_IQualProp, FALSE); + check_interface(filter, &IID_IReferenceClock, FALSE); + check_interface(filter, &IID_IVideoWindow, FALSE); + + IBaseFilter_Release(filter); +} + +static const GUID test_iid = {0x33333333}; +static LONG outer_ref = 1; + +static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out) +{ + if (IsEqualGUID(iid, &IID_IUnknown) + || IsEqualGUID(iid, &IID_IBaseFilter) + || IsEqualGUID(iid, &test_iid)) + { + *out = (IUnknown *)0xdeadbeef; + return S_OK; + } + ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI outer_AddRef(IUnknown *iface) +{ + return InterlockedIncrement(&outer_ref); +} + +static ULONG WINAPI outer_Release(IUnknown *iface) +{ + return InterlockedDecrement(&outer_ref); +} + +static const IUnknownVtbl outer_vtbl = +{ + outer_QueryInterface, + outer_AddRef, + outer_Release, +}; + +static IUnknown test_outer = {&outer_vtbl}; + +static void test_aggregation(void) +{ + IBaseFilter *filter, *filter2; + IUnknown *unk, *unk2; + HRESULT hr; + ULONG ref; + + filter = (IBaseFilter *)0xdeadbeef; + hr = CoCreateInstance(&CLSID_DVDNavigator, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&filter); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(!filter, "Got interface %p.\n", filter); + + hr = CoCreateInstance(&CLSID_DVDNavigator, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void **)&unk); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n"); + ref = get_refcount(unk); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + + ref = IUnknown_AddRef(unk); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + + ref = IUnknown_Release(unk); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + + hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2); + IUnknown_Release(unk2); + + hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2); + + hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(!unk2, "Got unexpected IUnknown %p.\n", unk2); + + hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + IBaseFilter_Release(filter); + ref = IUnknown_Release(unk); + ok(!ref, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); +} + +START_TEST(navigator) +{ + CoInitializeEx(NULL, COINIT_MULTITHREADED); + + test_interfaces(); + test_aggregation(); + + CoUninitialize(); +}
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=75523
Your paranoid android.
=== debiant (32 bit report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
=== debiant (32 bit French report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
=== debiant (32 bit Japanese:Japan report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
=== debiant (32 bit Chinese:China report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
=== debiant (32 bit WoW report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
=== debiant (64 bit WoW report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
This works fine locally, seems like it needs a prefix update.
Op do 16 jul. 2020 om 07:13 schreef Marvin testbot@winehq.org:
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=75523
Your paranoid android.
=== debiant (32 bit report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
=== debiant (32 bit French report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
=== debiant (32 bit Japanese:Japan report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
=== debiant (32 bit Chinese:China report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
=== debiant (32 bit WoW report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
=== debiant (64 bit WoW report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
On 7/15/20 11:16 PM, Gijs Vermeulen wrote:
Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com
dlls/qdvd/Makefile.in | 3 + dlls/qdvd/navigator.c | 67 +++++++++++++ dlls/qdvd/qdvd_classes.idl | 7 ++ dlls/qdvd/qdvd_main.c | 3 + dlls/qdvd/qdvd_private.h | 1 + dlls/qdvd/tests/Makefile.in | 3 +- dlls/qdvd/tests/navigator.c | 191 ++++++++++++++++++++++++++++++++++++ 7 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 dlls/qdvd/navigator.c create mode 100644 dlls/qdvd/tests/navigator.c
diff --git a/dlls/qdvd/Makefile.in b/dlls/qdvd/Makefile.in index 8f5089b3ac..e100870d32 100644 --- a/dlls/qdvd/Makefile.in +++ b/dlls/qdvd/Makefile.in @@ -1,10 +1,13 @@ MODULE = qdvd.dll IMPORTS = strmiids uuid ole32 +PARENTSRC = ../strmbase
PARENTSRC is a bit of a hack for modules that aren't PE yet and thus can't import strmbase; you just want to import strmbase normally.
The rest of the patch and 3/3 looks fine to me.
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \
- filter.c \ graph.c \
- navigator.c \ qdvd_main.c
IDL_SRCS = \ diff --git a/dlls/qdvd/navigator.c b/dlls/qdvd/navigator.c new file mode 100644 index 0000000000..1e121dde60 --- /dev/null +++ b/dlls/qdvd/navigator.c @@ -0,0 +1,67 @@ +/*
- Navigator filter
- Copyright 2020 Gijs Vermeulen
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
+#include "qdvd_private.h" +#include "wine/strmbase.h"
+WINE_DEFAULT_DEBUG_CHANNEL(qdvd);
+struct navigator +{
- struct strmbase_filter filter;
+};
+static inline struct navigator *impl_from_strmbase_filter(struct strmbase_filter *filter) +{
- return CONTAINING_RECORD(filter, struct navigator, filter);
+}
+static struct strmbase_pin *navigator_get_pin(struct strmbase_filter *iface, unsigned int index) +{
- return NULL;
+}
+static void navigator_destroy(struct strmbase_filter *iface) +{
- struct navigator *filter = impl_from_strmbase_filter(iface);
- strmbase_filter_cleanup(&filter->filter);
- free(filter);
+}
+static const struct strmbase_filter_ops filter_ops = +{
- .filter_get_pin = navigator_get_pin,
- .filter_destroy = navigator_destroy,
+};
+HRESULT navigator_create(IUnknown *outer, IUnknown **out) +{
- struct navigator *object;
- if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
- strmbase_filter_init(&object->filter, outer, &CLSID_DVDNavigator, &filter_ops);
- TRACE("Created DVD Navigator filter %p.\n", object);
- *out = &object->filter.IUnknown_inner;
- return S_OK;
+} diff --git a/dlls/qdvd/qdvd_classes.idl b/dlls/qdvd/qdvd_classes.idl index 7fd2a081ba..c55c7e3944 100644 --- a/dlls/qdvd/qdvd_classes.idl +++ b/dlls/qdvd/qdvd_classes.idl @@ -24,3 +24,10 @@ uuid(fcc152b7-f372-11d0-8e00-00c04fd7c08b), ] coclass DvdGraphBuilder {}
+[
- helpstring("DVD Navigator Filter"),
- threading(both),
- uuid(9b8c4620-2c1a-11d0-8493-00a02438ad48),
+] +coclass DVDNavigator {} diff --git a/dlls/qdvd/qdvd_main.c b/dlls/qdvd/qdvd_main.c index c529533e44..2fdb108877 100644 --- a/dlls/qdvd/qdvd_main.c +++ b/dlls/qdvd/qdvd_main.c @@ -100,6 +100,7 @@ static const IClassFactoryVtbl class_factory_vtbl = };
static struct class_factory graph_builder_cf = {{&class_factory_vtbl}, graph_builder_create}; +static struct class_factory navigator_cf = {{&class_factory_vtbl}, navigator_create};
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) { @@ -120,6 +121,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out)
if (IsEqualGUID(clsid, &CLSID_DvdGraphBuilder)) return IClassFactory_QueryInterface(&graph_builder_cf.IClassFactory_iface, iid, out);
if (IsEqualGUID(clsid, &CLSID_DVDNavigator))
return IClassFactory_QueryInterface(&navigator_cf.IClassFactory_iface, iid, out);
FIXME("%s not available, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(clsid)); return CLASS_E_CLASSNOTAVAILABLE;
diff --git a/dlls/qdvd/qdvd_private.h b/dlls/qdvd/qdvd_private.h index 297949ee60..48fced46f1 100644 --- a/dlls/qdvd/qdvd_private.h +++ b/dlls/qdvd/qdvd_private.h @@ -26,5 +26,6 @@ #include "wine/debug.h"
HRESULT graph_builder_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN; +HRESULT navigator_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
#endif /* QDVD_PRIVATE_H */ diff --git a/dlls/qdvd/tests/Makefile.in b/dlls/qdvd/tests/Makefile.in index 3e9efd9c74..57f8fbba5a 100644 --- a/dlls/qdvd/tests/Makefile.in +++ b/dlls/qdvd/tests/Makefile.in @@ -2,4 +2,5 @@ TESTDLL = qdvd.dll IMPORTS = strmiids uuid ole32
C_SRCS = \
- graph.c
- graph.c \
- navigator.c
diff --git a/dlls/qdvd/tests/navigator.c b/dlls/qdvd/tests/navigator.c new file mode 100644 index 0000000000..f01e428b4e --- /dev/null +++ b/dlls/qdvd/tests/navigator.c @@ -0,0 +1,191 @@ +/*
- Navigator filter unit tests
- Copyright 2020 Gijs Vermeulen
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
+#define COBJMACROS +#include "dshow.h" +#include "wine/strmbase.h" +#include "wine/test.h"
+static IBaseFilter *create_navigator(void) +{
- IBaseFilter *filter = NULL;
- HRESULT hr = CoCreateInstance(&CLSID_DVDNavigator, NULL,
CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void **)&filter);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
- return filter;
+}
+static ULONG get_refcount(void *iface) +{
- IUnknown *unknown = iface;
- IUnknown_AddRef(unknown);
- return IUnknown_Release(unknown);
+}
+#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +{
- IUnknown *iface = iface_ptr;
- HRESULT hr, expected_hr;
- IUnknown *unk;
- expected_hr = supported ? S_OK : E_NOINTERFACE;
- hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
- ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
- if (SUCCEEDED(hr))
IUnknown_Release(unk);
+}
+static void test_interfaces(void) +{
- IBaseFilter *filter = create_navigator();
- check_interface(filter, &IID_IBaseFilter, TRUE);
- todo_wine check_interface(filter, &IID_IDvdControl, TRUE);
- todo_wine check_interface(filter, &IID_IDvdControl2, TRUE);
- todo_wine check_interface(filter, &IID_IDvdInfo, TRUE);
- todo_wine check_interface(filter, &IID_IDvdInfo2, TRUE);
- check_interface(filter, &IID_IMediaFilter, TRUE);
- check_interface(filter, &IID_IPersist, TRUE);
- todo_wine check_interface(filter, &IID_ISpecifyPropertyPages, TRUE);
- check_interface(filter, &IID_IUnknown, TRUE);
- check_interface(filter, &IID_IAMFilterMiscFlags, FALSE);
- check_interface(filter, &IID_IBasicAudio, FALSE);
- check_interface(filter, &IID_IBasicVideo, FALSE);
- check_interface(filter, &IID_IFileSourceFilter, FALSE);
- check_interface(filter, &IID_IKsPropertySet, FALSE);
- check_interface(filter, &IID_IMediaPosition, FALSE);
- check_interface(filter, &IID_IMediaSeeking, FALSE);
- check_interface(filter, &IID_IPersistPropertyBag, FALSE);
- check_interface(filter, &IID_IPersistStream, FALSE);
- check_interface(filter, &IID_IPin, FALSE);
- check_interface(filter, &IID_IQualityControl, FALSE);
- check_interface(filter, &IID_IQualProp, FALSE);
- check_interface(filter, &IID_IReferenceClock, FALSE);
- check_interface(filter, &IID_IVideoWindow, FALSE);
- IBaseFilter_Release(filter);
+}
+static const GUID test_iid = {0x33333333}; +static LONG outer_ref = 1;
+static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out) +{
- if (IsEqualGUID(iid, &IID_IUnknown)
|| IsEqualGUID(iid, &IID_IBaseFilter)
|| IsEqualGUID(iid, &test_iid))
- {
*out = (IUnknown *)0xdeadbeef;
return S_OK;
- }
- ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid));
- return E_NOINTERFACE;
+}
+static ULONG WINAPI outer_AddRef(IUnknown *iface) +{
- return InterlockedIncrement(&outer_ref);
+}
+static ULONG WINAPI outer_Release(IUnknown *iface) +{
- return InterlockedDecrement(&outer_ref);
+}
+static const IUnknownVtbl outer_vtbl = +{
- outer_QueryInterface,
- outer_AddRef,
- outer_Release,
+};
+static IUnknown test_outer = {&outer_vtbl};
+static void test_aggregation(void) +{
- IBaseFilter *filter, *filter2;
- IUnknown *unk, *unk2;
- HRESULT hr;
- ULONG ref;
- filter = (IBaseFilter *)0xdeadbeef;
- hr = CoCreateInstance(&CLSID_DVDNavigator, &test_outer, CLSCTX_INPROC_SERVER,
&IID_IBaseFilter, (void **)&filter);
- ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
- ok(!filter, "Got interface %p.\n", filter);
- hr = CoCreateInstance(&CLSID_DVDNavigator, &test_outer, CLSCTX_INPROC_SERVER,
&IID_IUnknown, (void **)&unk);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
- ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
- ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
- ref = get_refcount(unk);
- ok(ref == 1, "Got unexpected refcount %d.\n", ref);
- ref = IUnknown_AddRef(unk);
- ok(ref == 2, "Got unexpected refcount %d.\n", ref);
- ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
- ref = IUnknown_Release(unk);
- ok(ref == 1, "Got unexpected refcount %d.\n", ref);
- ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
- hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
- ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
- IUnknown_Release(unk2);
- hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
- hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
- ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
- hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
- ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
- hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
- ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
- ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
- hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
- ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
- IBaseFilter_Release(filter);
- ref = IUnknown_Release(unk);
- ok(!ref, "Got unexpected refcount %d.\n", ref);
- ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+}
+START_TEST(navigator) +{
- CoInitializeEx(NULL, COINIT_MULTITHREADED);
- test_interfaces();
- test_aggregation();
- CoUninitialize();
+}
Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/qdvd/navigator.c | 453 ++++++++++++++++++++++++++++++++++++ dlls/qdvd/tests/navigator.c | 2 +- 2 files changed, 454 insertions(+), 1 deletion(-)
diff --git a/dlls/qdvd/navigator.c b/dlls/qdvd/navigator.c index 1e121dde60..f5697e0804 100644 --- a/dlls/qdvd/navigator.c +++ b/dlls/qdvd/navigator.c @@ -26,6 +26,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(qdvd); struct navigator { struct strmbase_filter filter; + IDvdControl2 IDvdControl2_iface; };
static inline struct navigator *impl_from_strmbase_filter(struct strmbase_filter *filter) @@ -33,6 +34,19 @@ static inline struct navigator *impl_from_strmbase_filter(struct strmbase_filter return CONTAINING_RECORD(filter, struct navigator, filter); }
+static HRESULT navigator_query_interface(struct strmbase_filter *iface, REFIID iid, void **out) +{ + struct navigator *filter = impl_from_strmbase_filter(iface); + + if (IsEqualGUID(iid, &IID_IDvdControl2)) + *out = &filter->IDvdControl2_iface; + else + return E_NOINTERFACE; + + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +} + static struct strmbase_pin *navigator_get_pin(struct strmbase_filter *iface, unsigned int index) { return NULL; @@ -48,10 +62,448 @@ static void navigator_destroy(struct strmbase_filter *iface)
static const struct strmbase_filter_ops filter_ops = { + .filter_query_interface = navigator_query_interface, .filter_get_pin = navigator_get_pin, .filter_destroy = navigator_destroy, };
+static struct navigator *impl_from_IDvdControl2(IDvdControl2 *iface) +{ + return CONTAINING_RECORD(iface, struct navigator, IDvdControl2_iface); +} + +static HRESULT WINAPI dvd_control_QueryInterface(IDvdControl2 *iface, REFIID iid, void **out) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + return IUnknown_QueryInterface(filter->filter.outer_unk, iid, out); +} + +static ULONG WINAPI dvd_control_AddRef(IDvdControl2 *iface) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + return IUnknown_AddRef(filter->filter.outer_unk); +} + +static ULONG WINAPI dvd_control_Release(IDvdControl2 *iface) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + return IUnknown_Release(filter->filter.outer_unk); +} + +static HRESULT WINAPI dvd_control_PlayTitle(IDvdControl2 *iface, ULONG title, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, title %u, flags %#x, cmd %p.\n", filter, title, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_PlayChapterInTitle(IDvdControl2 *iface, ULONG title, ULONG chapter, + DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, title %u, chapter %u, flags %#x, cmd %p.\n", filter, title, chapter, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_PlayTimeInTitle(IDvdControl2 *iface, ULONG title, DVD_HMSF_TIMECODE *time, + DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, title %u, time %p, flags %#x, cmd %p.\n", filter, title, time, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_Stop(IDvdControl2 *iface) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p.\n", filter); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_ReturnFromSubmenu(IDvdControl2 *iface, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, flags %#x, cmd %p.\n", filter, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_PlayAtTime(IDvdControl2 *iface, DVD_HMSF_TIMECODE *time, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, time %p, flags %#x, cmd %p.\n", filter, time, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_PlayChapter(IDvdControl2 *iface, ULONG chapter, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, chapter %u, flags %#x, cmd %p.\n", filter, chapter, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_PlayPrevChapter(IDvdControl2 *iface, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, flags %#x, cmd %p.\n", filter, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_ReplayChapter(IDvdControl2 *iface, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, flags %#x, cmd %p.\n", filter, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_PlayNextChapter(IDvdControl2 *iface, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, flags %#x, cmd %p.\n", filter, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_PlayForwards(IDvdControl2 *iface, double speed, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, speed %f, flags %#x, cmd %p.\n", filter, speed, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_PlayBackwards(IDvdControl2 *iface, double speed, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, speed %f, flags %#x, cmd %p.\n", filter, speed, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_ShowMenu(IDvdControl2 *iface, DVD_MENU_ID id, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, id %d, flags %#x, cmd %p.\n", filter, id, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_Resume(IDvdControl2 *iface, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, flags %#x, cmd %p.\n", filter, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SelectRelativeButton(IDvdControl2 *iface, DVD_RELATIVE_BUTTON button) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, button %d.\n", filter, button); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_ActivateButton(IDvdControl2 *iface) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p.\n", filter); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SelectButton(IDvdControl2 *iface, ULONG button) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, button %u.\n", filter, button); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SelectAndActivateButton(IDvdControl2 *iface, ULONG button) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, button %u.\n", filter, button); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_StillOff(IDvdControl2 *iface) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p.\n", filter); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_Pause(IDvdControl2 *iface, BOOL enable) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, enable %d.\n", filter, enable); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SelectAudioStream(IDvdControl2 *iface, ULONG stream, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, stream %u, flags %#x, cmd %p.\n", filter, stream, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SelectSubpictureStream(IDvdControl2 *iface, ULONG stream, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, stream %u, flags %#x, cmd %p.\n", filter, stream, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SetSubpictureState(IDvdControl2 *iface, BOOL enable, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, enable %d, flags %#x, cmd %p.\n", filter, enable, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SelectAngle(IDvdControl2 *iface, ULONG angle, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, angle %u, flags %#x, cmd %p.\n", filter, angle, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SelectParentalLevel(IDvdControl2 *iface, ULONG level) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, level %u.\n", filter, level); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SelectParentalCountry(IDvdControl2 *iface, BYTE country[2]) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, country %p.\n", filter, country); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SelectKaraokeAudioPresentationMode(IDvdControl2 *iface, ULONG mode) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, mode %u.\n", filter, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SelectVideoModePreference(IDvdControl2 *iface, ULONG mode) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, mode %u.\n", filter, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SetDVDDirectory(IDvdControl2 *iface, const WCHAR *path) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, path %s.\n", filter, debugstr_w(path)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_ActivateAtPosition(IDvdControl2 *iface, POINT point) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, point %s.\n", filter, wine_dbgstr_point(&point)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SelectAtPosition(IDvdControl2 *iface, POINT point) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, point %s.\n", filter, wine_dbgstr_point(&point)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_PlayChaptersAutoStop(IDvdControl2 *iface, ULONG title, ULONG chapter, ULONG count, + DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, title %u, chapter %u, count %u, flags %#x, cmd %p.\n", filter, title, chapter, count, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_AcceptParentalLevelChange(IDvdControl2 *iface, BOOL accept) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, accept %d.\n", filter, accept); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SetOption(IDvdControl2 *iface, DVD_OPTION_FLAG flag, BOOL option) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, flag %d, option %d.\n", filter, flag, option); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SetState(IDvdControl2 *iface, IDvdState *state, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, state %p, flags %#x, cmd %p.\n", filter, state, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_PlayPeriodInTitleAutoStop(IDvdControl2 *iface, ULONG title, + DVD_HMSF_TIMECODE *start_time, DVD_HMSF_TIMECODE *end_time, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, title %u, start_time %p, end_time %p, flags %#x, cmd %p.\n", + filter, title, start_time, end_time, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SetGRPM(IDvdControl2 *iface, ULONG index, WORD value, DWORD flags, IDvdCmd **cmd) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, index %u, value %i, flags %#x, cmd %p.\n", filter, index, value, flags, cmd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SelectDefaultMenuLanguage(IDvdControl2 *iface, LCID language) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, language %#x.\n", filter, language); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SelectDefaultAudioLanguage(IDvdControl2 *iface, LCID language, + DVD_AUDIO_LANG_EXT extension) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, language %#x, extension %d.\n", filter, language, extension); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dvd_control_SelectDefaultSubpictureLanguage(IDvdControl2 *iface, LCID language, + DVD_SUBPICTURE_LANG_EXT extension) +{ + struct navigator *filter = impl_from_IDvdControl2(iface); + + FIXME("filter %p, language %#x, extension %d.\n", filter, language, extension); + + return E_NOTIMPL; +} + +static const struct IDvdControl2Vtbl dvd_control_vtbl = +{ + dvd_control_QueryInterface, + dvd_control_AddRef, + dvd_control_Release, + dvd_control_PlayTitle, + dvd_control_PlayChapterInTitle, + dvd_control_PlayTimeInTitle, + dvd_control_Stop, + dvd_control_ReturnFromSubmenu, + dvd_control_PlayAtTime, + dvd_control_PlayChapter, + dvd_control_PlayPrevChapter, + dvd_control_ReplayChapter, + dvd_control_PlayNextChapter, + dvd_control_PlayForwards, + dvd_control_PlayBackwards, + dvd_control_ShowMenu, + dvd_control_Resume, + dvd_control_SelectRelativeButton, + dvd_control_ActivateButton, + dvd_control_SelectButton, + dvd_control_SelectAndActivateButton, + dvd_control_StillOff, + dvd_control_Pause, + dvd_control_SelectAudioStream, + dvd_control_SelectSubpictureStream, + dvd_control_SetSubpictureState, + dvd_control_SelectAngle, + dvd_control_SelectParentalLevel, + dvd_control_SelectParentalCountry, + dvd_control_SelectKaraokeAudioPresentationMode, + dvd_control_SelectVideoModePreference, + dvd_control_SetDVDDirectory, + dvd_control_ActivateAtPosition, + dvd_control_SelectAtPosition, + dvd_control_PlayChaptersAutoStop, + dvd_control_AcceptParentalLevelChange, + dvd_control_SetOption, + dvd_control_SetState, + dvd_control_PlayPeriodInTitleAutoStop, + dvd_control_SetGRPM, + dvd_control_SelectDefaultMenuLanguage, + dvd_control_SelectDefaultAudioLanguage, + dvd_control_SelectDefaultSubpictureLanguage, +}; + HRESULT navigator_create(IUnknown *outer, IUnknown **out) { struct navigator *object; @@ -60,6 +512,7 @@ HRESULT navigator_create(IUnknown *outer, IUnknown **out) return E_OUTOFMEMORY;
strmbase_filter_init(&object->filter, outer, &CLSID_DVDNavigator, &filter_ops); + object->IDvdControl2_iface.lpVtbl = &dvd_control_vtbl;
TRACE("Created DVD Navigator filter %p.\n", object); *out = &object->filter.IUnknown_inner; diff --git a/dlls/qdvd/tests/navigator.c b/dlls/qdvd/tests/navigator.c index f01e428b4e..db2ba392dc 100644 --- a/dlls/qdvd/tests/navigator.c +++ b/dlls/qdvd/tests/navigator.c @@ -60,7 +60,7 @@ static void test_interfaces(void)
check_interface(filter, &IID_IBaseFilter, TRUE); todo_wine check_interface(filter, &IID_IDvdControl, TRUE); - todo_wine check_interface(filter, &IID_IDvdControl2, TRUE); + check_interface(filter, &IID_IDvdControl2, TRUE); todo_wine check_interface(filter, &IID_IDvdInfo, TRUE); todo_wine check_interface(filter, &IID_IDvdInfo2, TRUE); check_interface(filter, &IID_IMediaFilter, TRUE);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=75524
Your paranoid android.
=== debiant (32 bit report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
=== debiant (32 bit French report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
=== debiant (32 bit Japanese:Japan report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
=== debiant (32 bit Chinese:China report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
=== debiant (32 bit WoW report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)
=== debiant (64 bit WoW report) ===
qdvd: navigator.c:31: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040198e).
Report validation errors: qdvd:navigator crashed (c0000005)