annotate loader/dshow/iunk.h @ 14342:0a89a9a88692

sync
author paszczi
date Mon, 03 Jan 2005 22:49:25 +0000
parents 9533c26c0806
children f5537cc95b02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 168
diff changeset
1 #ifndef DS_IUNK_H
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 168
diff changeset
2 #define DS_IUNK_H
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 168
diff changeset
3
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
4 #include "guids.h"
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 168
diff changeset
5
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
6 #define INHERIT_IUNKNOWN() \
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3056
diff changeset
7 long STDCALL ( *QueryInterface )(IUnknown * This, const GUID* riid, void **ppvObject); \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
8 long STDCALL ( *AddRef )(IUnknown * This); \
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
9 long STDCALL ( *Release )(IUnknown * This);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
10
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
11 #define DECLARE_IUNKNOWN() \
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
12 int refcount;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
13
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
14 #define IMPLEMENT_IUNKNOWN(CLASSNAME) \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
15 static long STDCALL CLASSNAME ## _QueryInterface(IUnknown * This, \
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3056
diff changeset
16 const GUID* riid, void **ppvObject) \
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
17 { \
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 168
diff changeset
18 CLASSNAME * me = (CLASSNAME *)This; \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
19 GUID* r; unsigned int i = 0; \
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
20 Debug printf(#CLASSNAME "_QueryInterface(%p) called\n", This);\
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
21 if (!ppvObject) return E_POINTER; \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
22 for(r=me->interfaces; i<sizeof(me->interfaces)/sizeof(me->interfaces[0]); r++, i++) \
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
23 if(!memcmp(r, riid, sizeof(*r))) \
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
24 { \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
25 me->vt->AddRef((IUnknown*)This); \
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
26 *ppvObject=This; \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
27 return 0; \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
28 } \
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
29 Debug printf("Query failed! (GUID: 0x%x)\n", *(unsigned int*)riid); \
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 168
diff changeset
30 return E_NOINTERFACE; \
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
31 } \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
32 \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
33 static long STDCALL CLASSNAME ## _AddRef(IUnknown * This) \
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
34 { \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
35 CLASSNAME * me=( CLASSNAME *)This; \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
36 Debug printf(#CLASSNAME "_AddRef(%p) called (ref:%d)\n", This, me->refcount); \
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
37 return ++(me->refcount); \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
38 } \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
39 \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
40 static long STDCALL CLASSNAME ## _Release(IUnknown * This) \
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
41 { \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
42 CLASSNAME* me=( CLASSNAME *)This; \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
43 Debug printf(#CLASSNAME "_Release(%p) called (new ref:%d)\n", This, me->refcount - 1); \
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
44 if(--(me->refcount) == 0) \
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
45 CLASSNAME ## _Destroy(me); \
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
46 return 0; \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
47 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
48
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 168
diff changeset
49 #endif /* DS_IUNK_H */