2020-07-07 17:14:56 +02:00
|
|
|
/*
|
|
|
|
* 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"
|
|
|
|
|
2021-07-10 05:14:41 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
2020-07-07 17:14:56 +02:00
|
|
|
|
|
|
|
struct graph_builder
|
|
|
|
{
|
2020-07-16 06:16:33 +02:00
|
|
|
IUnknown IUnknown_inner;
|
2020-07-07 17:14:56 +02:00
|
|
|
IDvdGraphBuilder IDvdGraphBuilder_iface;
|
2020-07-16 06:16:33 +02:00
|
|
|
|
|
|
|
IUnknown *outer_unk;
|
2020-07-07 17:14:56 +02:00
|
|
|
LONG refcount;
|
|
|
|
};
|
|
|
|
|
2020-07-16 06:16:33 +02:00
|
|
|
static struct graph_builder *impl_from_IUnknown(IUnknown *iface)
|
2020-07-07 17:14:56 +02:00
|
|
|
{
|
2020-07-16 06:16:33 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct graph_builder, IUnknown_inner);
|
2020-07-07 17:14:56 +02:00
|
|
|
}
|
|
|
|
|
2020-07-16 06:16:33 +02:00
|
|
|
static ULONG WINAPI inner_AddRef(IUnknown *iface)
|
2020-07-07 17:14:56 +02:00
|
|
|
{
|
2020-07-16 06:16:33 +02:00
|
|
|
struct graph_builder *builder = impl_from_IUnknown(iface);
|
2020-07-07 17:14:56 +02:00
|
|
|
ULONG refcount = InterlockedIncrement(&builder->refcount);
|
2022-02-09 03:04:43 +01:00
|
|
|
TRACE("%p increasing refcount to %lu.\n", builder, refcount);
|
2020-07-07 17:14:56 +02:00
|
|
|
return refcount;
|
|
|
|
}
|
|
|
|
|
2020-07-16 06:16:33 +02:00
|
|
|
static ULONG WINAPI inner_Release(IUnknown *iface)
|
2020-07-07 17:14:56 +02:00
|
|
|
{
|
2020-07-16 06:16:33 +02:00
|
|
|
struct graph_builder *builder = impl_from_IUnknown(iface);
|
2020-07-07 17:14:56 +02:00
|
|
|
ULONG refcount = InterlockedDecrement(&builder->refcount);
|
2022-02-09 03:04:43 +01:00
|
|
|
TRACE("%p decreasing refcount to %lu.\n", builder, refcount);
|
2020-07-07 17:14:56 +02:00
|
|
|
if (!refcount)
|
|
|
|
free(builder);
|
|
|
|
return refcount;
|
|
|
|
}
|
|
|
|
|
2020-07-16 06:16:33 +02:00
|
|
|
static HRESULT WINAPI inner_QueryInterface(IUnknown *iface, REFIID iid, void **out)
|
2020-07-07 17:14:56 +02:00
|
|
|
{
|
2020-07-16 06:16:33 +02:00
|
|
|
struct graph_builder *builder = impl_from_IUnknown(iface);
|
|
|
|
|
2020-07-07 17:14:56 +02:00
|
|
|
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
|
|
|
|
|
2020-07-16 06:16:33 +02:00
|
|
|
if (IsEqualGUID(iid, &IID_IUnknown))
|
|
|
|
*out = &builder->IUnknown_inner;
|
|
|
|
else if (IsEqualGUID(iid, &IID_IDvdGraphBuilder))
|
|
|
|
*out = &builder->IDvdGraphBuilder_iface;
|
2020-07-07 17:14:56 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
*out = NULL;
|
|
|
|
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown *)*out);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-07-16 06:16:33 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2020-07-07 17:14:56 +02:00
|
|
|
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)
|
|
|
|
{
|
2022-02-09 03:04:43 +01:00
|
|
|
FIXME("iface %p, path %s, flags %#lx, status %p, stub!\n", iface, debugstr_w(path), flags, status);
|
2020-07-07 17:14:56 +02:00
|
|
|
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,
|
|
|
|
};
|
|
|
|
|
2020-07-16 06:16:33 +02:00
|
|
|
HRESULT graph_builder_create(IUnknown *outer, IUnknown **out)
|
2020-07-07 17:14:56 +02:00
|
|
|
{
|
|
|
|
struct graph_builder *builder;
|
|
|
|
|
|
|
|
if (!(builder = calloc(1, sizeof(*builder))))
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
builder->IDvdGraphBuilder_iface.lpVtbl = &graph_builder_vtbl;
|
2020-07-16 06:16:33 +02:00
|
|
|
builder->IUnknown_inner.lpVtbl = &inner_vtbl;
|
2020-07-07 17:14:56 +02:00
|
|
|
builder->refcount = 1;
|
2020-07-16 06:16:33 +02:00
|
|
|
builder->outer_unk = outer ? outer : &builder->IUnknown_inner;
|
2020-07-07 17:14:56 +02:00
|
|
|
|
|
|
|
TRACE("Created DVD graph builder %p.\n", builder);
|
2020-07-16 06:16:33 +02:00
|
|
|
*out = &builder->IUnknown_inner;
|
2020-07-07 17:14:56 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|