On 7/6/20 1:50 PM, Gijs Vermeulen wrote:
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=18072 Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com
dlls/qdvd/Makefile.in | 2 + dlls/qdvd/graph.c | 112 +++++++++++++++++++++++++++++++++++++++ dlls/qdvd/qdvd_main.c | 90 ++++++++++++++++++++++++++++--- dlls/qdvd/qdvd_private.h | 31 +++++++++++ 4 files changed, 228 insertions(+), 7 deletions(-) create mode 100644 dlls/qdvd/graph.c create mode 100644 dlls/qdvd/qdvd_private.h
diff --git a/dlls/qdvd/Makefile.in b/dlls/qdvd/Makefile.in index b3b13486ed..8f5089b3ac 100644 --- a/dlls/qdvd/Makefile.in +++ b/dlls/qdvd/Makefile.in @@ -1,8 +1,10 @@ MODULE = qdvd.dll +IMPORTS = strmiids uuid ole32
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \
- graph.c \ qdvd_main.c
IDL_SRCS = \ diff --git a/dlls/qdvd/graph.c b/dlls/qdvd/graph.c new file mode 100644 index 0000000000..da12dcff0a --- /dev/null +++ b/dlls/qdvd/graph.c @@ -0,0 +1,112 @@ +/*
- Graph builder
- 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/heap.h"
+WINE_DEFAULT_DEBUG_CHANNEL(qdvd);
+struct graph_builder +{
- IDvdGraphBuilder IDvdGraphBuilder_iface;
- LONG refs;
+};
+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);
- ULONG refcount = InterlockedIncrement(&builder->refs);
- TRACE("%p increasing refcount to %u.\n", builder, refcount);
- return refcount;
+}
+static ULONG WINAPI graph_builder_Release(IDvdGraphBuilder *iface) +{
- struct graph_builder *builder = impl_from_IDvdGraphBuilder(iface);
- ULONG refcount = InterlockedDecrement(&builder->refs);
- TRACE("%p decreasing refcount to %u.\n", builder, refcount);
- if (!refcount)
heap_free(builder);
- return refcount;
+}
+static HRESULT WINAPI graph_builder_QueryInterface(IDvdGraphBuilder *iface, REFIID iid, void **out) +{
- TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
- if (IsEqualGUID(iid, &IID_IDvdGraphBuilder) || IsEqualGUID(iid, &IID_IUnknown))
- {
IDvdGraphBuilder_AddRef(iface);
*out = iface;
return S_OK;
- }
- *out = NULL;
- WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(iid));
- return E_NOINTERFACE;
+}
+static HRESULT WINAPI graph_builder_GetFiltergraph(IDvdGraphBuilder *iface, IGraphBuilder **graph) +{
- FIXME("iface %p, graph %p, stub!\n", iface, graph);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI graph_builder_GetDvdInterface(IDvdGraphBuilder *iface, REFIID iid, void **out) +{
- FIXME("iface %p, iid %s, out %p, stub!\n", iface, debugstr_guid(iid), out);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI graph_builder_RenderDvdVideoVolume(IDvdGraphBuilder *iface, const WCHAR *path, DWORD flags, AM_DVD_RENDERSTATUS *status) +{
- FIXME("iface %p, path %s, flags %#x, status %p, stub!\n", iface, debugstr_w(path), flags, status);
- return E_NOTIMPL;
+}
+static const struct IDvdGraphBuilderVtbl graph_builder_vtbl = +{
- graph_builder_QueryInterface,
- graph_builder_AddRef,
- graph_builder_Release,
- graph_builder_GetFiltergraph,
- graph_builder_GetDvdInterface,
- graph_builder_RenderDvdVideoVolume
+};
+HRESULT graph_builder_create(IUnknown **out) +{
- struct graph_builder *builder;
- builder = heap_alloc(sizeof(*builder));
This should really be calloc() [even if we're not initializing anything to zero, we probably will in the near future...]
- if (!builder) return E_OUTOFMEMORY;
- builder->IDvdGraphBuilder_iface.lpVtbl = &graph_builder_vtbl;
- builder->refs = 1;
- *out = (IUnknown *)&builder->IDvdGraphBuilder_iface;
Can you please add a trace here along the lines of "Created DVD graph builder %p.\n"?
- return S_OK;
+} diff --git a/dlls/qdvd/qdvd_main.c b/dlls/qdvd/qdvd_main.c index 72dcda7c91..57a6b32ff7 100644 --- a/dlls/qdvd/qdvd_main.c +++ b/dlls/qdvd/qdvd_main.c @@ -18,17 +18,88 @@
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include <stdarg.h> -#include "windef.h" -#include "winbase.h" -#include "oleidl.h" -#include "rpcproxy.h" -#include "wine/debug.h" +#include "qdvd_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(qdvd);
static HINSTANCE qdvd_instance;
+struct class_factory +{
- IClassFactory IClassFactory_iface;
- HRESULT (*create_instance)(IUnknown **out);
+};
+static struct class_factory *impl_from_IClassFactory(IClassFactory *iface) +{
- return CONTAINING_RECORD(iface, struct class_factory, IClassFactory_iface);
+}
+static HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID iid, void **out) +{
- TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
- if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IClassFactory))
- {
IClassFactory_AddRef(iface);
*out = iface;
return S_OK;
- }
- *out = NULL;
- WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(iid));
- return E_NOINTERFACE;
+}
+static ULONG WINAPI class_factory_AddRef(IClassFactory *iface) +{
- return 2;
+}
+static ULONG WINAPI class_factory_Release(IClassFactory *iface) +{
- return 1;
+}
+static HRESULT WINAPI class_factory_CreateInstance(IClassFactory *iface,
IUnknown *outer, REFIID iid, void **out)
+{
- struct class_factory *factory = impl_from_IClassFactory(iface);
- IUnknown *unk;
- HRESULT hr;
- TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out);
- *out = NULL;
- if (outer)
return CLASS_E_NOAGGREGATION;
- if (SUCCEEDED(hr = factory->create_instance(&unk)))
- {
hr = IUnknown_QueryInterface(unk, iid, out);
IUnknown_Release(unk);
- }
- return hr;
+}
+static HRESULT WINAPI class_factory_LockServer(IClassFactory *iface, BOOL lock) +{
- FIXME("lock %d, stub!\n", lock);
- return S_OK;
+}
+static const IClassFactoryVtbl class_factory_vtbl = +{
- class_factory_QueryInterface,
- class_factory_AddRef,
- class_factory_Release,
- class_factory_CreateInstance,
- class_factory_LockServer,
+};
+static struct class_factory graph_builder_cf = {{&class_factory_vtbl}, graph_builder_create};
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) { if (reason == DLL_WINE_PREATTACH) @@ -44,7 +115,12 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) {
- FIXME("clsid %s, iid %s, out %p, stub!\n", debugstr_guid(clsid), debugstr_guid(iid), out);
- TRACE("clsid %s, iid %s, out %p.\n", debugstr_guid(clsid), debugstr_guid(iid), out);
- if (IsEqualGUID(clsid, &CLSID_DvdGraphBuilder))
return IClassFactory_QueryInterface(&graph_builder_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 new file mode 100644 index 0000000000..a09174e5e1 --- /dev/null +++ b/dlls/qdvd/qdvd_private.h @@ -0,0 +1,31 @@ +/*
- DirectShow DVD filters
- 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
- */
+#ifndef QDVD_PRIVATE_H +#define QDVD_PRIVATE_H
+#define COBJMACROS +#include "dshow.h" +#include "rpcproxy.h" +#include "wine/debug.h"
+HRESULT graph_builder_create(IUnknown **out) DECLSPEC_HIDDEN;
+#endif /* QDVD_PRIVATE_H */