diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2002-01-06 18:56:19 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2002-01-06 18:56:19 +0000 |
commit | 8377788b342919ec0ff4c29f048b907abce994d4 (patch) | |
tree | 4e68ceae3962d2033d0124c232196f6b896cf25f /src/libw32dll/DirectShow/iunk.h | |
parent | 3c6d03ef837577db63f9b7f246978a9ccb009aae (diff) | |
download | xine-lib-8377788b342919ec0ff4c29f048b907abce994d4.tar.gz xine-lib-8377788b342919ec0ff4c29f048b907abce994d4.tar.bz2 |
updating directshow support with avifile/mplayer changes
CVS patchset: 1357
CVS date: 2002/01/06 18:56:19
Diffstat (limited to 'src/libw32dll/DirectShow/iunk.h')
-rw-r--r-- | src/libw32dll/DirectShow/iunk.h | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/src/libw32dll/DirectShow/iunk.h b/src/libw32dll/DirectShow/iunk.h index cf139b924..6dbf00ffa 100644 --- a/src/libw32dll/DirectShow/iunk.h +++ b/src/libw32dll/DirectShow/iunk.h @@ -2,55 +2,49 @@ #define DS_IUNK_H #include "guids.h" - -#define DECLARE_IUNKNOWN(CLASSNAME) \ - int refcount; +#include <stdlib.h> #define INHERIT_IUNKNOWN() \ - long STDCALL (*QueryInterface)(IUnknown * This, GUID* riid, void **ppvObject); \ - long STDCALL (*AddRef) (IUnknown * This); \ - long STDCALL (*Release) (IUnknown * This); - + long STDCALL ( *QueryInterface )(IUnknown * This, GUID* riid, void **ppvObject); \ + long STDCALL ( *AddRef )(IUnknown * This); \ + long STDCALL ( *Release )(IUnknown * This); + +#define DECLARE_IUNKNOWN() \ + int refcount; + #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) \ +static 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");\ + GUID* r; unsigned int i = 0; \ + Debug printf(#CLASSNAME "_QueryInterface(%p) called\n", This);\ if (!ppvObject) return 0x80004003; \ for(r=me->interfaces; i<sizeof(me->interfaces)/sizeof(me->interfaces[0]); r++, i++) \ - if(!memcmp(r, riid, 16)) \ + if(!memcmp(r, riid, sizeof(*r))) \ { \ me->vt->AddRef((IUnknown*)This); \ *ppvObject=This; \ return 0; \ } \ - Debug printf("Failed\n"); \ + Debug printf("Query failed!\n"); \ return E_NOINTERFACE; \ } \ \ -long STDCALL CLASSNAME ## _AddRef ( \ - IUnknown * This) \ +static long STDCALL CLASSNAME ## _AddRef(IUnknown * This) \ { \ CLASSNAME * me=( CLASSNAME *)This; \ - Debug printf(#CLASSNAME "_AddRef() called\n"); \ + Debug printf(#CLASSNAME "_AddRef(%p) called (ref:%d)\n", This, me->refcount); \ return ++(me->refcount); \ } \ \ -long STDCALL CLASSNAME ## _Release ( \ - IUnknown * This) \ +static long STDCALL CLASSNAME ## _Release(IUnknown * This) \ { \ CLASSNAME* me=( CLASSNAME *)This; \ - Debug printf(#CLASSNAME "_Release() called\n"); \ - if(--(me->refcount) ==0) \ + Debug printf(#CLASSNAME "_Release(%p) called (new ref:%d)\n", This, me->refcount - 1); \ + if(--(me->refcount) == 0) \ CLASSNAME ## _Destroy(me); \ return 0; \ } - #endif /* DS_IUNK_H */ |