diff options
author | arpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-03-20 00:05:27 +0000 |
---|---|---|
committer | arpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-03-20 00:05:27 +0000 |
commit | fbe693a169b346b4b4e48ee39017cf86b594429b (patch) | |
tree | f2a0d6aae01e6a560ce75bba7f68f53890b5b9b9 /loader/dshow/iunk.h | |
parent | caf48a3f5da35dd2e183da9f34ed265bf082856f (diff) | |
download | mpv-fbe693a169b346b4b4e48ee39017cf86b594429b.tar.bz2 mpv-fbe693a169b346b4b4e48ee39017cf86b594429b.tar.xz |
Initial revision
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@169 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'loader/dshow/iunk.h')
-rw-r--r-- | loader/dshow/iunk.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/loader/dshow/iunk.h b/loader/dshow/iunk.h new file mode 100644 index 0000000000..cf07e9cea5 --- /dev/null +++ b/loader/dshow/iunk.h @@ -0,0 +1,47 @@ +#ifndef _iunk_h +#define _iunk_h +#include "interfaces.h" +#include "guids.h" +#define DECLARE_IUNKNOWN(CLASSNAME) \ + int refcount; \ + static long STDCALL QueryInterface (IUnknown * This, GUID* riid, void **ppvObject); \ + static long STDCALL AddRef (IUnknown * This); \ + static long STDCALL Release (IUnknown * This); + +#define IMPLEMENT_IUNKNOWN(CLASSNAME) \ +long STDCALL CLASSNAME ::QueryInterface (IUnknown * This, GUID* riid, void **ppvObject) \ +{ \ + Debug printf(#CLASSNAME "::QueryInterface() called\n");\ + if(!ppvObject)return 0x80004003; \ + CLASSNAME * me=( CLASSNAME *)This; \ + int i=0; \ + for(const GUID* r=me->interfaces; i<sizeof(CLASSNAME ::interfaces)/sizeof(CLASSNAME ::interfaces[0]); r++, i++) \ + if(!memcmp(r, riid, 16)) \ + { \ + This->vt->AddRef((IUnknown*)This); \ + *ppvObject=This; \ + return 0; \ + } \ + Debug printf("Failed\n"); \ + return 0x80004002; \ +} \ + \ +long STDCALL CLASSNAME ::AddRef ( \ + IUnknown * This) \ +{ \ + Debug printf(#CLASSNAME "::AddRef() called\n"); \ + CLASSNAME * me=( CLASSNAME *)This; \ + return ++(me->refcount); \ +} \ + \ +long STDCALL CLASSNAME ::Release ( \ + IUnknown * This) \ +{ \ + Debug printf(#CLASSNAME "::Release() called\n"); \ + CLASSNAME* me=( CLASSNAME *)This; \ + if(--(me->refcount) ==0) \ + delete ( CLASSNAME *) This; \ + return 0; \ +} + +#endif |