[v4 4/4] evr: Add EnhancedVideoRenderer coclass

Fabian Maurer dark.shadow4 at web.de
Tue Sep 12 10:48:11 CDT 2017


v4: Implement	Nikolay Sivov's suggestions

Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
---
 dlls/evr/Makefile.in     |   5 +-
 dlls/evr/evr.c           | 235 +++++++++++++++++++++++++++++++++++++++++++++++
 dlls/evr/evr_classes.idl |  28 ++++++
 dlls/evr/evr_private.h   |  28 ++++++
 dlls/evr/main.c          |   4 +-
 5 files changed, 298 insertions(+), 2 deletions(-)
 create mode 100644 dlls/evr/evr.c
 create mode 100644 dlls/evr/evr_classes.idl
 create mode 100644 dlls/evr/evr_private.h

diff --git a/dlls/evr/Makefile.in b/dlls/evr/Makefile.in
index 9e52e115b5..9e4da8217b 100644
--- a/dlls/evr/Makefile.in
+++ b/dlls/evr/Makefile.in
@@ -1,5 +1,8 @@
 MODULE    = evr.dll
-IMPORTS   = uuid ole32
+IMPORTS   = strmiids strmbase uuid ole32 oleaut32
 
 C_SRCS = \
+	evr.c \
 	main.c
+
+IDL_SRCS = evr_classes.idl
diff --git a/dlls/evr/evr.c b/dlls/evr/evr.c
new file mode 100644
index 0000000000..c2d2933211
--- /dev/null
+++ b/dlls/evr/evr.c
@@ -0,0 +1,235 @@
+/*
+ * Copyright 2017 Fabian Maurer
+ *
+ * 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
+ */
+
+#define COBJMACROS
+
+#include "config.h"
+#include "wine/debug.h"
+
+#include <stdio.h>
+
+#include "evr_private.h"
+#include "d3d9.h"
+#include "wine/strmbase.h"
+
+#include "initguid.h"
+#include "dxva2api.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(evr);
+
+typedef struct
+{
+    BaseFilter filter;
+
+    IUnknown IUnknown_inner;
+} evr_filter;
+
+static inline evr_filter *impl_from_inner_IUnknown(IUnknown *iface)
+{
+    return CONTAINING_RECORD(iface, evr_filter, IUnknown_inner);
+}
+
+static HRESULT WINAPI inner_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
+{
+    evr_filter *This = impl_from_inner_IUnknown(iface);
+    TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppv);
+
+    *ppv = NULL;
+
+     if (IsEqualIID(riid, &IID_IUnknown))
+         *ppv = &This->IUnknown_inner;
+
+     else if (IsEqualIID(riid, &IID_IAMCertifiedOutputProtection))
+         FIXME("No interface for IID_IAMCertifiedOutputProtection\n");
+     else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags))
+         FIXME("No interface for IID_IAMFilterMiscFlags\n");
+     else if (IsEqualIID(riid, &IID_IBaseFilter))
+         *ppv =&This->filter.IBaseFilter_iface;
+     else if (IsEqualIID(riid, &IID_IMediaFilter))
+         *ppv =&This->filter.IBaseFilter_iface;
+     else if (IsEqualIID(riid, &IID_IPersist))
+         *ppv =&This->filter.IBaseFilter_iface;
+     else if (IsEqualIID(riid, &IID_IKsPropertySet))
+         FIXME("No interface for IID_IKsPropertySet\n");
+     else if (IsEqualIID(riid, &IID_IMediaEventSink))
+         FIXME("No interface for IID_IMediaEventSink\n");
+     else if (IsEqualIID(riid, &IID_IMediaSeeking))
+         FIXME("No interface for IID_IMediaSeeking\n");
+     else if (IsEqualIID(riid, &IID_IQualityControl))
+         FIXME("No interface for IID_IQualityControl\n");
+     else if (IsEqualIID(riid, &IID_IQualProp))
+         FIXME("No interface for IID_IQualProp\n");
+
+     else if (IsEqualIID(riid, &IID_IEVRFilterConfig))
+         FIXME("No interface for IID_IEVRFilterConfig\n");
+     else if (IsEqualIID(riid, &IID_IMFGetService))
+         FIXME("No interface for IID_IMFGetService\n");
+     else if (IsEqualIID(riid, &IID_IMFVideoPositionMapper))
+         FIXME("No interface for IID_IMFVideoPositionMapper\n");
+     else if (IsEqualIID(riid, &IID_IMFVideoRenderer))
+         FIXME("No interface for IID_IMFVideoRenderer\n");
+
+     else if (IsEqualIID(riid, &IID_IMemInputPin))
+         FIXME("No interface for IID_IMemInputPin\n");
+     else if (IsEqualIID(riid, &IID_IPin))
+         FIXME("No interface for IID_IPin\n");
+     else if (IsEqualIID(riid, &IID_IQualityControl))
+         FIXME("No interface for IID_IQualityControl\n");
+
+     else if (IsEqualIID(riid, &IID_IDirectXVideoMemoryConfiguration))
+         FIXME("No interface for IID_IDirectXVideoMemoryConfiguration\n");
+
+    if (*ppv)
+    {
+        IUnknown_AddRef((IUnknown *)(*ppv));
+        return S_OK;
+    }
+
+    FIXME("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppv);
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI inner_AddRef(IUnknown *iface)
+{
+    evr_filter *This = impl_from_inner_IUnknown(iface);
+    ULONG ref = BaseFilterImpl_AddRef(&This->filter.IBaseFilter_iface);
+
+    TRACE("(%p, %p)->(): new ref %d\n", iface, This, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI inner_Release(IUnknown *iface)
+{
+    evr_filter *This = impl_from_inner_IUnknown(iface);
+    ULONG ref = BaseFilterImpl_Release(&This->filter.IBaseFilter_iface);
+
+    TRACE("(%p, %p)->(): new ref %d\n", iface, This, ref);
+
+    if (!ref)
+        CoTaskMemFree(This);
+
+    return ref;
+}
+
+static const IUnknownVtbl evr_inner_vtbl =
+{
+    inner_QueryInterface,
+    inner_AddRef,
+    inner_Release
+};
+
+static inline evr_filter *impl_from_IBaseFilter(IBaseFilter *iface)
+{
+    return CONTAINING_RECORD(iface, evr_filter, filter);
+}
+
+static HRESULT WINAPI filter_QueryInterface(IBaseFilter *iface, REFIID riid, void **ppv)
+{
+    evr_filter *This = impl_from_IBaseFilter(iface);
+    return IUnknown_QueryInterface(&This->IUnknown_inner, riid, ppv);
+}
+
+static ULONG WINAPI filter_AddRef(IBaseFilter *iface)
+{
+    evr_filter *This = impl_from_IBaseFilter(iface);
+    LONG ret;
+
+    ret = IUnknown_AddRef(&This->IUnknown_inner);
+
+    TRACE("(%p)->AddRef from %d\n", iface, ret - 1);
+
+    return ret;
+}
+
+static ULONG WINAPI filter_Release(IBaseFilter *iface)
+{
+    evr_filter *This = impl_from_IBaseFilter(iface);
+    LONG ret;
+
+    ret = IUnknown_Release(&This->IUnknown_inner);
+
+    TRACE("(%p)->Release from %d\n", iface, ret + 1);
+
+    return ret;
+}
+
+static const IBaseFilterVtbl basefilter_vtbl =
+{
+    filter_QueryInterface,
+    filter_AddRef,
+    filter_Release,
+    BaseFilterImpl_GetClassID,
+    BaseRendererImpl_Stop,
+    BaseRendererImpl_Pause,
+    BaseRendererImpl_Run,
+    BaseRendererImpl_GetState,
+    BaseRendererImpl_SetSyncSource,
+    BaseFilterImpl_GetSyncSource,
+    BaseFilterImpl_EnumPins,
+    BaseRendererImpl_FindPin,
+    BaseFilterImpl_QueryFilterInfo,
+    BaseFilterImpl_JoinFilterGraph,
+    BaseFilterImpl_QueryVendorInfo
+};
+
+static IPin* WINAPI filter_GetPin(BaseFilter *iface, int position)
+{
+    FIXME("(%p, %d): stub!\n", iface, position);
+    return NULL;
+}
+
+static LONG WINAPI filter_GetPinCount(BaseFilter *iface)
+{
+    FIXME("(%p): stub!\n", iface);
+    return 0;
+}
+
+static const BaseFilterFuncTable basefilter_functable =
+{
+    filter_GetPin,
+    filter_GetPinCount,
+};
+
+HRESULT evr_filter_create(IUnknown *outer_unk, void **ppv)
+{
+    evr_filter *object;
+
+    TRACE("(%p, %p)\n", outer_unk, ppv);
+
+    *ppv = NULL;
+
+    if(outer_unk != NULL)
+    {
+        FIXME("Aggregation yet unsupported!\n");
+        return E_NOINTERFACE;
+    }
+
+    object = CoTaskMemAlloc(sizeof(evr_filter));
+    if (!object)
+        return E_OUTOFMEMORY;
+
+    BaseFilter_Init(&object->filter, &basefilter_vtbl, &CLSID_EnhancedVideoRenderer,
+                    (DWORD_PTR)(__FILE__ ": EVR.csFilter"), &basefilter_functable);
+
+    object->IUnknown_inner.lpVtbl = &evr_inner_vtbl;
+
+    *ppv = &object->IUnknown_inner;
+
+    return S_OK;
+}
diff --git a/dlls/evr/evr_classes.idl b/dlls/evr/evr_classes.idl
new file mode 100644
index 0000000000..20a346ac67
--- /dev/null
+++ b/dlls/evr/evr_classes.idl
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2017 Fabian Maurer
+ *
+ * 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
+ */
+
+#pragma makedep register
+
+#include "strmif.idl"
+
+[
+    helpstring("Enhanced Video Renderer"),
+    threading(both),
+    uuid(fa10746c-9b63-4b6c-bc49-fc300ea5f256)
+]
+coclass EnhancedVideoRenderer { interface IBaseFilter; }
diff --git a/dlls/evr/evr_private.h b/dlls/evr/evr_private.h
new file mode 100644
index 0000000000..65dcbb7a9b
--- /dev/null
+++ b/dlls/evr/evr_private.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2017 Fabian Maurer
+ *
+ * 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 __EVR_PRIVATE_INCLUDED__
+#define __EVR_PRIVATE_INCLUDED__
+
+#include "dshow.h"
+#include "evr.h"
+
+HRESULT evr_filter_create(IUnknown *outer_unk, void **ppv) DECLSPEC_HIDDEN;
+
+
+#endif /* __EVR_PRIVATE_INCLUDED__ */
diff --git a/dlls/evr/main.c b/dlls/evr/main.c
index 641aed90e6..ed5c9f4c79 100644
--- a/dlls/evr/main.c
+++ b/dlls/evr/main.c
@@ -28,6 +28,8 @@
 #include "ole2.h"
 #include "rpcproxy.h"
 
+#include "evr_private.h"
+
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(evr);
@@ -71,7 +73,7 @@ struct object_creation_info
 
 static const struct object_creation_info object_creation[] =
 {
-    { &GUID_NULL, 0 },
+    { &CLSID_EnhancedVideoRenderer, evr_filter_create },
 };
 
 static HRESULT WINAPI classfactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj)
-- 
2.14.1




More information about the wine-patches mailing list