Mercurial > mplayer.hg
annotate loader/dshow/iunk.h @ 22885:2fb21c753674
remove useless ()
author | aurel |
---|---|
date | Sun, 01 Apr 2007 21:58:45 +0000 |
parents | 0783dd397f74 |
children | b70f5ac9c001 |
rev | line source |
---|---|
15166
f5537cc95b02
Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents:
8292
diff
changeset
|
1 /* |
18783 | 2 * Modified for use with MPlayer, detailed changelog at |
3 * http://svn.mplayerhq.hu/mplayer/trunk/ | |
15166
f5537cc95b02
Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents:
8292
diff
changeset
|
4 * $Id$ |
f5537cc95b02
Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents:
8292
diff
changeset
|
5 */ |
f5537cc95b02
Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents:
8292
diff
changeset
|
6 |
1545 | 7 #ifndef DS_IUNK_H |
8 #define DS_IUNK_H | |
9 | |
168 | 10 #include "guids.h" |
1545 | 11 |
3056 | 12 #define INHERIT_IUNKNOWN() \ |
7386 | 13 long STDCALL ( *QueryInterface )(IUnknown * This, const GUID* riid, void **ppvObject); \ |
3056 | 14 long STDCALL ( *AddRef )(IUnknown * This); \ |
15 long STDCALL ( *Release )(IUnknown * This); | |
16 | |
17 #define DECLARE_IUNKNOWN() \ | |
18 int refcount; | |
19 | |
168 | 20 #define IMPLEMENT_IUNKNOWN(CLASSNAME) \ |
3056 | 21 static long STDCALL CLASSNAME ## _QueryInterface(IUnknown * This, \ |
7386 | 22 const GUID* riid, void **ppvObject) \ |
168 | 23 { \ |
1545 | 24 CLASSNAME * me = (CLASSNAME *)This; \ |
3056 | 25 GUID* r; unsigned int i = 0; \ |
26 Debug printf(#CLASSNAME "_QueryInterface(%p) called\n", This);\ | |
8292 | 27 if (!ppvObject) return E_POINTER; \ |
3056 | 28 for(r=me->interfaces; i<sizeof(me->interfaces)/sizeof(me->interfaces[0]); r++, i++) \ |
29 if(!memcmp(r, riid, sizeof(*r))) \ | |
168 | 30 { \ |
3056 | 31 me->vt->AddRef((IUnknown*)This); \ |
168 | 32 *ppvObject=This; \ |
33 return 0; \ | |
34 } \ | |
8292 | 35 Debug printf("Query failed! (GUID: 0x%x)\n", *(unsigned int*)riid); \ |
1545 | 36 return E_NOINTERFACE; \ |
168 | 37 } \ |
38 \ | |
3056 | 39 static long STDCALL CLASSNAME ## _AddRef(IUnknown * This) \ |
168 | 40 { \ |
41 CLASSNAME * me=( CLASSNAME *)This; \ | |
3056 | 42 Debug printf(#CLASSNAME "_AddRef(%p) called (ref:%d)\n", This, me->refcount); \ |
168 | 43 return ++(me->refcount); \ |
44 } \ | |
45 \ | |
3056 | 46 static long STDCALL CLASSNAME ## _Release(IUnknown * This) \ |
168 | 47 { \ |
48 CLASSNAME* me=( CLASSNAME *)This; \ | |
3056 | 49 Debug printf(#CLASSNAME "_Release(%p) called (new ref:%d)\n", This, me->refcount - 1); \ |
50 if(--(me->refcount) == 0) \ | |
51 CLASSNAME ## _Destroy(me); \ | |
168 | 52 return 0; \ |
53 } | |
54 | |
1545 | 55 #endif /* DS_IUNK_H */ |