From 675ca3309d98e4257a606e9daed11f7bad8cdca0 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sun, 11 Nov 2001 23:32:25 +0000 Subject: initial import of DirectShow support files. Most of hard work was done (converting all c++ files to c) and DS_Audio codecs are already producing some (weird) sound from my local tree. I hope to commit it soon... CVS patchset: 1022 CVS date: 2001/11/11 23:32:25 --- src/libw32dll/DirectShow/iunk.h | 59 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/libw32dll/DirectShow/iunk.h (limited to 'src/libw32dll/DirectShow/iunk.h') diff --git a/src/libw32dll/DirectShow/iunk.h b/src/libw32dll/DirectShow/iunk.h new file mode 100644 index 000000000..2c672b374 --- /dev/null +++ b/src/libw32dll/DirectShow/iunk.h @@ -0,0 +1,59 @@ +#ifndef DS_IUNK_H +#define DS_IUNK_H + +#include "guids.h" + +#define DECLARE_IUNKNOWN(CLASSNAME) \ + long STDCALL (*QueryInterface)(IUnknown * This, GUID* riid, void **ppvObject); \ + long STDCALL (*AddRef) (IUnknown * This); \ + long STDCALL (*Release) (IUnknown * This); \ + int refcount; + +#define INHERIT_IUNKNOWN() \ + long STDCALL (*QueryInterface)(IUnknown * This, GUID* riid, void **ppvObject); \ + long STDCALL (*AddRef) (IUnknown * This); \ + long STDCALL (*Release) (IUnknown * This); + +#define IMPLEMENT_IUNKNOWN(CLASSNAME) \ +long STDCALL CLASSNAME ## _QueryInterface(IUnknown * This, GUID* riid, void **ppvObject); \ +long STDCALL CLASSNAME ## _AddRef ( \ + IUnknown * This); \ +long STDCALL CLASSNAME ## _Release ( \ + IUnknown * This); \ +long STDCALL CLASSNAME ## _QueryInterface(IUnknown * This, GUID* riid, void **ppvObject) \ +{ \ + CLASSNAME * me = (CLASSNAME *)This; \ + GUID* r; unsigned int i = 0; \ + Debug printf(#CLASSNAME "_QueryInterface() called\n");\ + if (!ppvObject) return 0x80004003; \ + for(r=me->interfaces; iinterfaces)/sizeof(me->interfaces[0]); r++, i++) \ + if(!memcmp(r, riid, 16)) \ + { \ + me->vt->AddRef((IUnknown*)This); \ + *ppvObject=This; \ + return 0; \ + } \ + Debug printf("Failed\n"); \ + return E_NOINTERFACE; \ +} \ + \ +long STDCALL CLASSNAME ## _AddRef ( \ + IUnknown * This) \ +{ \ + CLASSNAME * me=( CLASSNAME *)This; \ + Debug printf(#CLASSNAME "_AddRef() called\n"); \ + return ++(me->refcount); \ +} \ + \ +long STDCALL CLASSNAME ## _Release ( \ + IUnknown * This) \ +{ \ + CLASSNAME* me=( CLASSNAME *)This; \ + Debug printf(#CLASSNAME "_Release() called\n"); \ + if(--(me->refcount) ==0) \ + CLASSNAME ## _Destroy(me); \ + return 0; \ +} + + +#endif /* DS_IUNK_H */ -- cgit v1.2.3