annotate loader/dshow/iunk.h @ 3155:9200edf69d1d

initial commit
author melanson
date Tue, 27 Nov 2001 05:43:03 +0000
parents 213b35f84cf3
children 174e2a58b4cd
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"
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
5 #include <stdlib.h>
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 168
diff changeset
6
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
7 #define INHERIT_IUNKNOWN() \
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
8 long STDCALL ( *QueryInterface )(IUnknown * This, GUID* riid, void **ppvObject); \
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
9 long STDCALL ( *AddRef )(IUnknown * This); \
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
10 long STDCALL ( *Release )(IUnknown * This);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
11
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
12 #define DECLARE_IUNKNOWN() \
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
13 int refcount;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
14
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
15 #define IMPLEMENT_IUNKNOWN(CLASSNAME) \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
16 static long STDCALL CLASSNAME ## _QueryInterface(IUnknown * This, \
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
17 GUID* riid, void **ppvObject) \
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
18 { \
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 168
diff changeset
19 CLASSNAME * me = (CLASSNAME *)This; \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
20 GUID* r; unsigned int i = 0; \
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
21 Debug printf(#CLASSNAME "_QueryInterface(%p) called\n", This);\
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
22 if (!ppvObject) return 0x80004003; \
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
23 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
24 if(!memcmp(r, riid, sizeof(*r))) \
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
25 { \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
26 me->vt->AddRef((IUnknown*)This); \
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
27 *ppvObject=This; \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
28 return 0; \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
29 } \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
30 Debug printf("Query failed!\n"); \
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 168
diff changeset
31 return E_NOINTERFACE; \
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
32 } \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
33 \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
34 static long STDCALL CLASSNAME ## _AddRef(IUnknown * This) \
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
35 { \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
36 CLASSNAME * me=( CLASSNAME *)This; \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
37 Debug printf(#CLASSNAME "_AddRef(%p) called (ref:%d)\n", This, me->refcount); \
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
38 return ++(me->refcount); \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
39 } \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
40 \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
41 static long STDCALL CLASSNAME ## _Release(IUnknown * This) \
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
42 { \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
43 CLASSNAME* me=( CLASSNAME *)This; \
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
44 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
45 if(--(me->refcount) == 0) \
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 1545
diff changeset
46 CLASSNAME ## _Destroy(me); \
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
47 return 0; \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
48 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
49
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 168
diff changeset
50 #endif /* DS_IUNK_H */