[PATCH] evr: Add stubs for EnhancedVideoRenderer
Fabian Maurer
dark.shadow4 at web.de
Thu Aug 17 20:25:35 CDT 2017
Code taken and adapted from d3dxof and quartz.
Fixes Bug 43549.
Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
---
dlls/evr/Makefile.in | 3 +
dlls/evr/evr.c | 233 +++++++++++++++++++++++++++++++++++++++++++++++
dlls/evr/evr.spec | 8 +-
dlls/evr/evr_classes.idl | 28 ++++++
dlls/evr/evr_private.h | 32 +++++++
dlls/evr/main.c | 176 ++++++++++++++++++++++++++++++++++-
6 files changed, 474 insertions(+), 6 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 25cc961270..fd840abdff 100644
--- a/dlls/evr/Makefile.in
+++ b/dlls/evr/Makefile.in
@@ -1,4 +1,7 @@
MODULE = evr.dll
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..75a58b6a90
--- /dev/null
+++ b/dlls/evr/evr.c
@@ -0,0 +1,233 @@
+/*
+ * 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
+ */
+
+#include "config.h"
+#include "wine/debug.h"
+
+#define COBJMACROS
+
+#include "initguid.h"
+#include <unknwn.h>
+#include "evr_private.h"
+
+#include <stdio.h>
+
+WINE_DEFAULT_DEBUG_CHANNEL(evr);
+
+static inline EnhancedVideoRendererImpl *impl_from_IBaseFilter(IBaseFilter *iface)
+{
+ return CONTAINING_RECORD(iface, EnhancedVideoRendererImpl, IBaseFilter_iface);
+}
+
+/*** IUnknown methods ***/
+
+static HRESULT WINAPI EnhancedVideoRendererImpl_QueryInterface(IBaseFilter *iface, REFIID riid, void **ppvObject)
+{
+ EnhancedVideoRendererImpl *This = impl_from_IBaseFilter(iface);
+
+ TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
+
+ if (IsEqualGUID(riid, &IID_IUnknown)
+ || IsEqualGUID(riid, &IID_IBaseFilter))
+ {
+ IUnknown_AddRef(iface);
+ *ppvObject = &This->IBaseFilter_iface;
+ return S_OK;
+ }
+
+ ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI EnhancedVideoRendererImpl_AddRef(IBaseFilter *iface)
+{
+ EnhancedVideoRendererImpl *This = impl_from_IBaseFilter(iface);
+ ULONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI EnhancedVideoRendererImpl_Release(IBaseFilter *iface)
+{
+ EnhancedVideoRendererImpl *This = impl_from_IBaseFilter(iface);
+ ULONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
+
+ if (!ref)
+ HeapFree(GetProcessHeap(), 0, This);
+
+ return ref;
+}
+
+/*** IPersist methods ***/
+
+HRESULT WINAPI EnhancedVideoRendererImpl_GetClassID(IBaseFilter *iface, CLSID *pClsid)
+{
+ EnhancedVideoRendererImpl *This = impl_from_IBaseFilter(iface);
+
+ FIXME("(%p)->(%p, %p): stub!\n", This, iface, pClsid);
+
+ return E_NOTIMPL;
+}
+
+/*** IMediaFilter methods ***/
+
+HRESULT WINAPI EnhancedVideoRendererImpl_Stop(IBaseFilter *iface)
+{
+ EnhancedVideoRendererImpl *This = impl_from_IBaseFilter(iface);
+
+ FIXME("(%p)->(%p): stub!\n", This, iface);
+
+ return E_NOTIMPL;
+}
+
+HRESULT WINAPI EnhancedVideoRendererImpl_Pause(IBaseFilter *iface)
+{
+ EnhancedVideoRendererImpl *This = impl_from_IBaseFilter(iface);
+
+ FIXME("(%p)->(%p): stub!\n", This, iface);
+
+ return E_NOTIMPL;
+}
+
+HRESULT WINAPI EnhancedVideoRendererImpl_Run(IBaseFilter *iface, REFERENCE_TIME tStart)
+{
+ EnhancedVideoRendererImpl *This = impl_from_IBaseFilter(iface);
+
+ FIXME("(%p)->(%p, %s): stub!\n", This, iface, wine_dbgstr_longlong(tStart));
+
+ return E_NOTIMPL;
+}
+
+HRESULT WINAPI EnhancedVideoRendererImpl_GetState(IBaseFilter *iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
+{
+ EnhancedVideoRendererImpl *This = impl_from_IBaseFilter(iface);
+
+ FIXME("(%p)->(%p, %d, %p): stub!\n", This, iface, dwMilliSecsTimeout, pState);
+
+ return E_NOTIMPL;
+}
+
+HRESULT WINAPI EnhancedVideoRendererImpl_SetSyncSource(IBaseFilter *iface, IReferenceClock *clock)
+{
+ EnhancedVideoRendererImpl *This = impl_from_IBaseFilter(iface);
+
+ FIXME("(%p)->(%p, %p): stub!\n", This, iface, clock);
+
+ return E_NOTIMPL;
+}
+
+HRESULT WINAPI EnhancedVideoRendererImpl_GetSyncSource(IBaseFilter *iface, IReferenceClock **ppClock)
+{
+ EnhancedVideoRendererImpl *This = impl_from_IBaseFilter(iface);
+
+ FIXME("(%p)->(%p, %p): stub!\n", This, iface, ppClock);
+
+ return E_NOTIMPL;
+}
+
+/*** IBaseFilter methods ***/
+
+HRESULT WINAPI EnhancedVideoRendererImpl_EnumPins(IBaseFilter *iface, IEnumPins **ppEnum)
+{
+ EnhancedVideoRendererImpl *This = impl_from_IBaseFilter(iface);
+
+ FIXME("(%p)->(%p, %p): stub!\n", This, iface, ppEnum);
+
+ return E_NOTIMPL;
+}
+
+HRESULT WINAPI EnhancedVideoRendererImpl_FindPin(IBaseFilter *iface, LPCWSTR Id, IPin **ppPin)
+{
+ EnhancedVideoRendererImpl *This = impl_from_IBaseFilter(iface);
+
+ FIXME("(%p)->(%p, %s, %p): stub!\n", This, iface, debugstr_w(Id), ppPin);
+
+ return E_NOTIMPL;
+}
+
+HRESULT WINAPI EnhancedVideoRendererImpl_QueryFilterInfo(IBaseFilter *iface, FILTER_INFO *pInfo)
+{
+ EnhancedVideoRendererImpl *This = impl_from_IBaseFilter(iface);
+
+ FIXME("(%p)->(%p, %p): stub!\n", This, iface, pInfo);
+
+ return E_NOTIMPL;
+}
+
+HRESULT WINAPI EnhancedVideoRendererImpl_JoinFilterGraph(IBaseFilter *iface, IFilterGraph *pGraph, LPCWSTR pName )
+{
+ EnhancedVideoRendererImpl *This = impl_from_IBaseFilter(iface);
+
+ FIXME("(%p)->(%p, %p, %s): stub!\n", This, iface, pGraph, debugstr_w(pName));
+
+ return E_NOTIMPL;
+}
+
+HRESULT WINAPI EnhancedVideoRendererImpl_QueryVendorInfo(IBaseFilter *iface, LPWSTR *pVendorInfo)
+{
+ EnhancedVideoRendererImpl *This = impl_from_IBaseFilter(iface);
+
+ FIXME("(%p)->(%p, %p): stub!\n", This, iface, pVendorInfo);
+
+ return E_NOTIMPL;
+}
+
+static const IBaseFilterVtbl IBaseFilter_Vtbl =
+{
+ /*** IUnknown methods ***/
+ EnhancedVideoRendererImpl_QueryInterface,
+ EnhancedVideoRendererImpl_AddRef,
+ EnhancedVideoRendererImpl_Release,
+ /*** IPersist methods ***/
+ EnhancedVideoRendererImpl_GetClassID,
+ /*** IMediaFilter methods ***/
+ EnhancedVideoRendererImpl_Stop,
+ EnhancedVideoRendererImpl_Pause,
+ EnhancedVideoRendererImpl_Run,
+ EnhancedVideoRendererImpl_GetState,
+ EnhancedVideoRendererImpl_SetSyncSource,
+ EnhancedVideoRendererImpl_GetSyncSource,
+ /*** IBaseFilter methods ***/
+ EnhancedVideoRendererImpl_EnumPins,
+ EnhancedVideoRendererImpl_FindPin,
+ EnhancedVideoRendererImpl_QueryFilterInfo,
+ EnhancedVideoRendererImpl_JoinFilterGraph,
+ EnhancedVideoRendererImpl_QueryVendorInfo
+};
+
+HRESULT EnhancedVideoRendererImpl_Create(IUnknown *pUnkOuter, void **ppObj)
+{
+ EnhancedVideoRendererImpl *object;
+
+ TRACE("(%p,%p)\n", pUnkOuter, ppObj);
+
+ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(EnhancedVideoRendererImpl));
+ if (!object)
+ return E_OUTOFMEMORY;
+
+ object->IBaseFilter_iface.lpVtbl = &IBaseFilter_Vtbl;
+ object->ref = 1;
+
+ *ppObj = &object->IBaseFilter_iface;
+
+ return S_OK;
+}
diff --git a/dlls/evr/evr.spec b/dlls/evr/evr.spec
index 3f609b6037..c78900c576 100644
--- a/dlls/evr/evr.spec
+++ b/dlls/evr/evr.spec
@@ -1,7 +1,7 @@
-@ stub DllCanUnloadNow
-@ stub DllGetClassObject
-@ stub DllRegisterServer
-@ stub DllUnregisterServer
+@ stdcall -private DllCanUnloadNow()
+@ stdcall -private DllGetClassObject(ptr ptr ptr)
+@ stdcall -private DllRegisterServer()
+@ stdcall -private DllUnregisterServer()
@ stub MFConvertColorInfoFromDXVA
@ stub MFConvertColorInfoToDXVA
@ stub MFConvertFromFP16Array
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..718ed8ae20
--- /dev/null
+++ b/dlls/evr/evr_private.h
@@ -0,0 +1,32 @@
+/*
+ * 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"
+
+typedef struct {
+ IBaseFilter IBaseFilter_iface;
+ LONG ref;
+} EnhancedVideoRendererImpl;
+
+HRESULT EnhancedVideoRendererImpl_Create(IUnknown *pUnkOuter, void **ppObj) DECLSPEC_HIDDEN;
+
+
+#endif /* __EVR_PRIVATE_INCLUDED__ */
diff --git a/dlls/evr/main.c b/dlls/evr/main.c
index 1b223adc11..4d72350b4a 100644
--- a/dlls/evr/main.c
+++ b/dlls/evr/main.c
@@ -15,6 +15,9 @@
* 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 <stdarg.h>
@@ -22,16 +25,185 @@
#include "windef.h"
#include "winbase.h"
+#include "ole2.h"
+#include "rpcproxy.h"
+
+#include "uuids.h"
+#include "evr_private.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(evr);
+
+static HINSTANCE instance_evr;
+
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
{
+ TRACE("(0x%p, %d, %p)\n", instance, reason, reserved);
+
switch (reason)
{
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
case DLL_PROCESS_ATTACH:
+ instance_evr = instance;
DisableThreadLibraryCalls(instance);
break;
}
return TRUE;
}
+
+typedef struct {
+ IClassFactory IClassFactory_iface;
+
+ LONG ref;
+ HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, void **ppObj);
+} IClassFactoryImpl;
+
+static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
+{
+ return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
+}
+
+struct object_creation_info
+{
+ const CLSID *clsid;
+ HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, void **ppObj);
+};
+
+static const struct object_creation_info object_creation[] =
+{
+ { &CLSID_EnhancedVideoRenderer, EnhancedVideoRendererImpl_Create },
+};
+
+static HRESULT WINAPI XFCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid, void **ppobj)
+{
+ IClassFactoryImpl *This = impl_from_IClassFactory(iface);
+
+ if (IsEqualGUID(riid, &IID_IUnknown)
+ || IsEqualGUID(riid, &IID_IClassFactory))
+ {
+ IClassFactory_AddRef(iface);
+ *ppobj = &This->IClassFactory_iface;
+ return S_OK;
+ }
+
+ WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI XFCF_AddRef(LPCLASSFACTORY iface)
+{
+ IClassFactoryImpl *This = impl_from_IClassFactory(iface);
+ return InterlockedIncrement(&This->ref);
+}
+
+static ULONG WINAPI XFCF_Release(LPCLASSFACTORY iface)
+{
+ IClassFactoryImpl *This = impl_from_IClassFactory(iface);
+
+ ULONG ref = InterlockedDecrement(&This->ref);
+
+ if (ref == 0)
+ HeapFree(GetProcessHeap(), 0, This);
+
+ return ref;
+}
+
+static HRESULT WINAPI XFCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, void **ppobj)
+{
+ IClassFactoryImpl *This = impl_from_IClassFactory(iface);
+ HRESULT hres;
+ LPUNKNOWN punk;
+
+ TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
+
+ *ppobj = NULL;
+ hres = This->pfnCreateInstance(pOuter, (void **) &punk);
+ if (SUCCEEDED(hres)) {
+ hres = IUnknown_QueryInterface(punk, riid, ppobj);
+ IUnknown_Release(punk);
+ }
+ return hres;
+}
+
+static HRESULT WINAPI XFCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
+{
+ IClassFactoryImpl *This = impl_from_IClassFactory(iface);
+ FIXME("(%p)->(%d), stub!\n",This,dolock);
+ return S_OK;
+}
+
+static const IClassFactoryVtbl XFCF_Vtbl =
+{
+ XFCF_QueryInterface,
+ XFCF_AddRef,
+ XFCF_Release,
+ XFCF_CreateInstance,
+ XFCF_LockServer
+};
+
+/*******************************************************************************
+ * Retrieves class object from a DLL object
+ *
+ * NOTES
+ * Docs say returns STDAPI
+ *
+ * PARAMS
+ * rclsid [I] CLSID for the class object
+ * riid [I] Reference to identifier of interface for class object
+ * ppv [O] Address of variable to receive interface pointer for riid
+ *
+ * RETURNS
+ * Success: S_OK
+ * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
+ * E_UNEXPECTED
+ */
+HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
+{
+ unsigned int i;
+ IClassFactoryImpl *factory;
+
+ TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
+
+ if ( !IsEqualGUID( &IID_IClassFactory, riid )
+ && ! IsEqualGUID( &IID_IUnknown, riid) )
+ return E_NOINTERFACE;
+
+ for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
+ {
+ if (IsEqualGUID(object_creation[i].clsid, rclsid))
+ break;
+ }
+
+ if (i == sizeof(object_creation)/sizeof(object_creation[0]))
+ {
+ FIXME("%s: no class found.\n", debugstr_guid(rclsid));
+ return CLASS_E_CLASSNOTAVAILABLE;
+ }
+
+ factory = HeapAlloc(GetProcessHeap(), 0, sizeof(*factory));
+ if (factory == NULL) return E_OUTOFMEMORY;
+
+ factory->IClassFactory_iface.lpVtbl = &XFCF_Vtbl;
+ factory->ref = 1;
+
+ factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
+
+ *ppv = &(factory->IClassFactory_iface);
+ return S_OK;
+}
+
+HRESULT WINAPI DllCanUnloadNow(void)
+{
+ return S_FALSE;
+}
+
+HRESULT WINAPI DllRegisterServer(void)
+{
+ return __wine_register_resources(instance_evr);
+}
+
+HRESULT WINAPI DllUnregisterServer(void)
+{
+ return __wine_unregister_resources(instance_evr);
+}
--
2.14.1
More information about the wine-patches
mailing list