strmbase: Move the seeking passthrough object to quartz.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-03-12 21:34:11 -05:00 committed by Alexandre Julliard
parent 191ae9f3ff
commit 3b8b066713
6 changed files with 114 additions and 96 deletions

View File

@ -15,6 +15,7 @@ C_SRCS = \
filtermapper.c \
main.c \
memallocator.c \
passthrough.c \
regsvr.c \
systemclock.c \
video.c \

View File

@ -36,11 +36,6 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
return QUARTZ_DllMain(instance, reason, reserved);
}
static HRESULT seeking_passthrough_create(IUnknown *outer, IUnknown **out)
{
return PosPassThru_Construct(outer, (void **)out);
}
/******************************************************************************
* DirectShow ClassFactory
*/

112
dlls/quartz/passthrough.c Normal file
View File

@ -0,0 +1,112 @@
/*
* Seeking passthrough object
*
* Copyright 2020 Zebediah Figura for CodeWeavers
*
* 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 "quartz_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
struct seeking_passthrough
{
struct strmbase_passthrough passthrough;
IUnknown IUnknown_inner;
IUnknown *outer_unk;
LONG refcount;
};
static struct seeking_passthrough *impl_from_IUnknown(IUnknown *iface)
{
return CONTAINING_RECORD(iface, struct seeking_passthrough, IUnknown_inner);
}
static HRESULT WINAPI seeking_passthrough_QueryInterface(IUnknown *iface, REFIID iid, void **out)
{
struct seeking_passthrough *passthrough = impl_from_IUnknown(iface);
TRACE("passthrough %p, iid %s, out %p.\n", passthrough, debugstr_guid(iid), out);
if (IsEqualGUID(iid, &IID_IUnknown))
*out = iface;
else if (IsEqualGUID(iid, &IID_IMediaPosition))
*out = &passthrough->passthrough.IMediaPosition_iface;
else if (IsEqualGUID(iid, &IID_IMediaSeeking))
*out = &passthrough->passthrough.IMediaSeeking_iface;
else if (IsEqualGUID(iid, &IID_ISeekingPassThru))
*out = &passthrough->passthrough.ISeekingPassThru_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 ULONG WINAPI seeking_passthrough_AddRef(IUnknown *iface)
{
struct seeking_passthrough *passthrough = impl_from_IUnknown(iface);
ULONG refcount = InterlockedIncrement(&passthrough->refcount);
TRACE("%p increasing refcount to %u.\n", passthrough, refcount);
return refcount;
}
static ULONG WINAPI seeking_passthrough_Release(IUnknown *iface)
{
struct seeking_passthrough *passthrough = impl_from_IUnknown(iface);
ULONG refcount = InterlockedDecrement(&passthrough->refcount);
TRACE("%p decreasing refcount to %u.\n", passthrough, refcount);
if (!refcount)
{
strmbase_passthrough_cleanup(&passthrough->passthrough);
free(passthrough);
}
return refcount;
}
static const IUnknownVtbl seeking_passthrough_vtbl =
{
seeking_passthrough_QueryInterface,
seeking_passthrough_AddRef,
seeking_passthrough_Release,
};
HRESULT seeking_passthrough_create(IUnknown *outer, IUnknown **out)
{
struct seeking_passthrough *object;
TRACE("outer %p, out %p.\n", outer, out);
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
object->IUnknown_inner.lpVtbl = &seeking_passthrough_vtbl;
object->outer_unk = outer ? outer : &object->IUnknown_inner;
object->refcount = 1;
strmbase_passthrough_init(&object->passthrough, object->outer_unk);
TRACE("Created seeking passthrough %p.\n", object);
*out = &object->IUnknown_inner;
return S_OK;
}

View File

@ -69,6 +69,7 @@ HRESULT filter_graph_no_thread_create(IUnknown *outer, IUnknown **out) DECLSPEC_
HRESULT filter_mapper_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
HRESULT mem_allocator_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
HRESULT system_clock_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
HRESULT seeking_passthrough_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
HRESULT video_renderer_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
HRESULT video_renderer_default_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
HRESULT vmr7_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;

View File

@ -764,92 +764,3 @@ void strmbase_passthrough_eos(struct strmbase_passthrough *passthrough)
passthrough->timevalid = FALSE;
LeaveCriticalSection(&passthrough->time_cs);
}
struct seeking_passthrough
{
struct strmbase_passthrough passthrough;
IUnknown IUnknown_inner;
IUnknown *outer_unk;
LONG refcount;
};
static struct seeking_passthrough *impl_from_IUnknown(IUnknown *iface)
{
return CONTAINING_RECORD(iface, struct seeking_passthrough, IUnknown_inner);
}
static HRESULT WINAPI seeking_passthrough_QueryInterface(IUnknown *iface, REFIID iid, void **out)
{
struct seeking_passthrough *passthrough = impl_from_IUnknown(iface);
TRACE("passthrough %p, iid %s, out %p.\n", passthrough, debugstr_guid(iid), out);
if (IsEqualGUID(iid, &IID_IUnknown))
*out = iface;
else if (IsEqualGUID(iid, &IID_IMediaPosition))
*out = &passthrough->passthrough.IMediaPosition_iface;
else if (IsEqualGUID(iid, &IID_IMediaSeeking))
*out = &passthrough->passthrough.IMediaSeeking_iface;
else if (IsEqualGUID(iid, &IID_ISeekingPassThru))
*out = &passthrough->passthrough.ISeekingPassThru_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 ULONG WINAPI seeking_passthrough_AddRef(IUnknown *iface)
{
struct seeking_passthrough *passthrough = impl_from_IUnknown(iface);
ULONG refcount = InterlockedIncrement(&passthrough->refcount);
TRACE("%p increasing refcount to %u.\n", passthrough, refcount);
return refcount;
}
static ULONG WINAPI seeking_passthrough_Release(IUnknown *iface)
{
struct seeking_passthrough *passthrough = impl_from_IUnknown(iface);
ULONG refcount = InterlockedDecrement(&passthrough->refcount);
TRACE("%p decreasing refcount to %u.\n", passthrough, refcount);
if (!refcount)
{
strmbase_passthrough_cleanup(&passthrough->passthrough);
heap_free(passthrough);
}
return refcount;
}
static const IUnknownVtbl seeking_passthrough_vtbl =
{
seeking_passthrough_QueryInterface,
seeking_passthrough_AddRef,
seeking_passthrough_Release,
};
HRESULT WINAPI PosPassThru_Construct(IUnknown *outer, void **out)
{
struct seeking_passthrough *object;
TRACE("outer %p, out %p.\n", outer, out);
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
object->IUnknown_inner.lpVtbl = &seeking_passthrough_vtbl;
object->outer_unk = outer ? outer : &object->IUnknown_inner;
object->refcount = 1;
strmbase_passthrough_init(&object->passthrough, object->outer_unk);
TRACE("Created seeking passthrough %p.\n", object);
*out = &object->IUnknown_inner;
return S_OK;
}

View File

@ -204,8 +204,6 @@ HRESULT WINAPI SourceSeekingImpl_SetRate(IMediaSeeking * iface, double dRate);
HRESULT WINAPI SourceSeekingImpl_GetRate(IMediaSeeking * iface, double * dRate);
HRESULT WINAPI SourceSeekingImpl_GetPreroll(IMediaSeeking * iface, LONGLONG * pPreroll);
HRESULT WINAPI PosPassThru_Construct(IUnknown* pUnkOuter, LPVOID *ppPassThru);
/* Output Queue */
typedef struct tagOutputQueue {
CRITICAL_SECTION csQueue;