qdvd: Add IDvdGraphBuilder stub.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=18072
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gijs Vermeulen 2020-07-07 10:14:56 -05:00 committed by Alexandre Julliard
parent 388c53160d
commit 4cd2ca96c2
4 changed files with 227 additions and 6 deletions

View File

@ -1,8 +1,10 @@
MODULE = qdvd.dll
IMPORTS = strmiids uuid ole32
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \
graph.c \
qdvd_main.c
IDL_SRCS = \

112
dlls/qdvd/graph.c Normal file
View File

@ -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"
WINE_DEFAULT_DEBUG_CHANNEL(qdvd);
struct graph_builder
{
IDvdGraphBuilder IDvdGraphBuilder_iface;
LONG refcount;
};
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->refcount);
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->refcount);
TRACE("%p decreasing refcount to %u.\n", builder, refcount);
if (!refcount)
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))
*out = iface;
else
{
*out = NULL;
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown *)*out);
return S_OK;
}
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;
if (!(builder = calloc(1, sizeof(*builder))))
return E_OUTOFMEMORY;
builder->IDvdGraphBuilder_iface.lpVtbl = &graph_builder_vtbl;
builder->refcount = 1;
TRACE("Created DVD graph builder %p.\n", builder);
*out = (IUnknown *)&builder->IDvdGraphBuilder_iface;
return S_OK;
}

View File

@ -18,17 +18,89 @@
* 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 "qdvd_private.h"
#include "rpcproxy.h"
#include "wine/debug.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 +116,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;
}

30
dlls/qdvd/qdvd_private.h Normal file
View File

@ -0,0 +1,30 @@
/*
* 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 "wine/debug.h"
HRESULT graph_builder_create(IUnknown **out) DECLSPEC_HIDDEN;
#endif /* QDVD_PRIVATE_H */