[PATCH 6/7] strmbase: Move the seeking passthrough object to quartz.
Zebediah Figura
z.figura12 at gmail.com
Thu Mar 12 21:34:11 CDT 2020
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
dlls/quartz/Makefile.in | 1 +
dlls/quartz/main.c | 5 --
dlls/quartz/passthrough.c | 112 +++++++++++++++++++++++++++++++++++
dlls/quartz/quartz_private.h | 1 +
dlls/strmbase/pospass.c | 89 ----------------------------
include/wine/strmbase.h | 2 -
6 files changed, 114 insertions(+), 96 deletions(-)
create mode 100644 dlls/quartz/passthrough.c
diff --git a/dlls/quartz/Makefile.in b/dlls/quartz/Makefile.in
index 858b9578792..ec29ef53c6b 100644
--- a/dlls/quartz/Makefile.in
+++ b/dlls/quartz/Makefile.in
@@ -15,6 +15,7 @@ C_SRCS = \
filtermapper.c \
main.c \
memallocator.c \
+ passthrough.c \
regsvr.c \
systemclock.c \
video.c \
diff --git a/dlls/quartz/main.c b/dlls/quartz/main.c
index 284f2cacaea..89c7fe9bb15 100644
--- a/dlls/quartz/main.c
+++ b/dlls/quartz/main.c
@@ -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
*/
diff --git a/dlls/quartz/passthrough.c b/dlls/quartz/passthrough.c
new file mode 100644
index 00000000000..2f8fe9dc370
--- /dev/null
+++ b/dlls/quartz/passthrough.c
@@ -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;
+}
diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h
index 3332c27d21a..55385379085 100644
--- a/dlls/quartz/quartz_private.h
+++ b/dlls/quartz/quartz_private.h
@@ -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;
diff --git a/dlls/strmbase/pospass.c b/dlls/strmbase/pospass.c
index 3b4560d35eb..b9e6f23a974 100644
--- a/dlls/strmbase/pospass.c
+++ b/dlls/strmbase/pospass.c
@@ -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;
-}
diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h
index 6d620c79337..732ba1be269 100644
--- a/include/wine/strmbase.h
+++ b/include/wine/strmbase.h
@@ -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;
--
2.25.1
More information about the wine-devel
mailing list