Mercurial > mplayer.hg
annotate loader/dshow/iunk.h @ 27855:eb78efa6cb07
Merge ARCH_BFIN lines.
author | diego |
---|---|
date | Mon, 03 Nov 2008 22:06:45 +0000 |
parents | a8ea87c71d18 |
children |
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 */ |
f5537cc95b02
Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents:
8292
diff
changeset
|
5 |
26045 | 6 #ifndef MPLAYER_IUNK_H |
7 #define MPLAYER_IUNK_H | |
1545 | 8 |
168 | 9 #include "guids.h" |
1545 | 10 |
3056 | 11 #define INHERIT_IUNKNOWN() \ |
7386 | 12 long STDCALL ( *QueryInterface )(IUnknown * This, const GUID* riid, void **ppvObject); \ |
3056 | 13 long STDCALL ( *AddRef )(IUnknown * This); \ |
14 long STDCALL ( *Release )(IUnknown * This); | |
15 | |
16 #define DECLARE_IUNKNOWN() \ | |
17 int refcount; | |
18 | |
168 | 19 #define IMPLEMENT_IUNKNOWN(CLASSNAME) \ |
3056 | 20 static long STDCALL CLASSNAME ## _QueryInterface(IUnknown * This, \ |
7386 | 21 const GUID* riid, void **ppvObject) \ |
168 | 22 { \ |
1545 | 23 CLASSNAME * me = (CLASSNAME *)This; \ |
3056 | 24 GUID* r; unsigned int i = 0; \ |
25 Debug printf(#CLASSNAME "_QueryInterface(%p) called\n", This);\ | |
8292 | 26 if (!ppvObject) return E_POINTER; \ |
3056 | 27 for(r=me->interfaces; i<sizeof(me->interfaces)/sizeof(me->interfaces[0]); r++, i++) \ |
28 if(!memcmp(r, riid, sizeof(*r))) \ | |
168 | 29 { \ |
3056 | 30 me->vt->AddRef((IUnknown*)This); \ |
168 | 31 *ppvObject=This; \ |
32 return 0; \ | |
33 } \ | |
8292 | 34 Debug printf("Query failed! (GUID: 0x%x)\n", *(unsigned int*)riid); \ |
1545 | 35 return E_NOINTERFACE; \ |
168 | 36 } \ |
37 \ | |
3056 | 38 static long STDCALL CLASSNAME ## _AddRef(IUnknown * This) \ |
168 | 39 { \ |
40 CLASSNAME * me=( CLASSNAME *)This; \ | |
3056 | 41 Debug printf(#CLASSNAME "_AddRef(%p) called (ref:%d)\n", This, me->refcount); \ |
168 | 42 return ++(me->refcount); \ |
43 } \ | |
44 \ | |
3056 | 45 static long STDCALL CLASSNAME ## _Release(IUnknown * This) \ |
168 | 46 { \ |
47 CLASSNAME* me=( CLASSNAME *)This; \ | |
3056 | 48 Debug printf(#CLASSNAME "_Release(%p) called (new ref:%d)\n", This, me->refcount - 1); \ |
49 if(--(me->refcount) == 0) \ | |
50 CLASSNAME ## _Destroy(me); \ | |
168 | 51 return 0; \ |
52 } | |
53 | |
26045 | 54 #endif /* MPLAYER_IUNK_H */ |