Re: qedit.dll: Add minimal stubs for NullRenderer and SampleGrabber
Paul Chitescu <paulc(a)voip.null.ro> writes:
Changelog: qedit.dll: Add minimal stubs for NullRenderer and SampleGrabber.
It doesn't make much sense to break this patch in two since most applications connect a SampleGrabber to a NullRenderer to capture frames.
That doesn't mean you can't split the patch.
+#define DEF_COMMON(iface)\ +static ULONG WINAPI NullRenderer_ ## iface ## _AddRef(iface *ptr)\ +{\ + return InterlockedIncrement(&GET_THIS(ptr,iface)->refCount);\ +}\ +static ULONG WINAPI NullRenderer_ ## iface ## _Release(iface *ptr)\ +{\ + NR_Impl *This = GET_THIS(ptr,iface);\ + ULONG refCount = InterlockedDecrement(&This->refCount);\ + if (refCount == 0) \ + {\ + NullRenderer_cleanup(This);\ + CoTaskMemFree(This);\ + return 0;\ + }\ + return refCount;\ +}\ +static HRESULT WINAPI NullRenderer_ ## iface ## _QueryInterface(iface *ptr, REFIID riid, void **ppvObject)\ +{\ + return NullRenderer_query(GET_THIS(ptr,iface), riid, ppvObject);\ +} + +/* Macro to put common IUnknown pointers in interface's vtable */ +#define VTBL_COMMON(iface)\ +NullRenderer_ ## iface ## _QueryInterface,\ +NullRenderer_ ## iface ## _AddRef,\ +NullRenderer_ ## iface ## _Release,
Please don't add ugly macros like those, spell things out explicitly. -- Alexandre Julliard julliard(a)winehq.org
On Monday 21 December 2009 05:05:25 pm Alexandre Julliard wrote:
Paul Chitescu <paulc(a)voip.null.ro> writes:
Changelog: qedit.dll: Add minimal stubs for NullRenderer and SampleGrabber.
It doesn't make much sense to break this patch in two since most applications connect a SampleGrabber to a NullRenderer to capture frames.
That doesn't mean you can't split the patch.
+#define DEF_COMMON(iface)\ +static ULONG WINAPI NullRenderer_ ## iface ## _AddRef(iface *ptr)\ +{\ + return InterlockedIncrement(&GET_THIS(ptr,iface)->refCount);\ +}\ +static ULONG WINAPI NullRenderer_ ## iface ## _Release(iface *ptr)\ +{\ + NR_Impl *This = GET_THIS(ptr,iface);\ + ULONG refCount = InterlockedDecrement(&This->refCount);\ + if (refCount == 0) \ + {\ + NullRenderer_cleanup(This);\ + CoTaskMemFree(This);\ + return 0;\ + }\ + return refCount;\ +}\ +static HRESULT WINAPI NullRenderer_ ## iface ## _QueryInterface(iface *ptr, REFIID riid, void **ppvObject)\ +{\ + return NullRenderer_query(GET_THIS(ptr,iface), riid, ppvObject);\ +} + +/* Macro to put common IUnknown pointers in interface's vtable */ +#define VTBL_COMMON(iface)\ +NullRenderer_ ## iface ## _QueryInterface,\ +NullRenderer_ ## iface ## _AddRef,\ +NullRenderer_ ## iface ## _Release,
Please don't add ugly macros like those, spell things out explicitly.
-- Alexandre Julliard julliard(a)winehq.org
I'll split it. About the macros - were you talking about the VTBL_COMMON which is pretty short or DEF_COMMON which is long and would cause the source code to grow unnecessarily? There are more interfaces to be implemented and I find easier to mantain _one_ macro rather than 6 copies of same code. Paul
Paul Chitescu <paulc(a)voip.null.ro> writes:
About the macros - were you talking about the VTBL_COMMON which is pretty short or DEF_COMMON which is long and would cause the source code to grow unnecessarily? There are more interfaces to be implemented and I find easier to mantain _one_ macro rather than 6 copies of same code.
Both. Don't use macros for this. -- Alexandre Julliard julliard(a)winehq.org
participants (2)
-
Alexandre Julliard -
Paul Chitescu