1 /* 2 * Modified for use with MPlayer, detailed changelog at 3 * http://svn.mplayerhq.hu/mplayer/trunk/ 4 */ 5 6 #ifndef MPLAYER_COM_H 7 #define MPLAYER_COM_H 8 9 #include <stdint.h> 10 11 #include "config.h" 12 13 /** 14 * Internal functions and structures for COM emulation code. 15 */ 16 17 #ifndef GUID_TYPE 18 #define GUID_TYPE 19 typedef struct 20 { 21 uint32_t f1; 22 uint16_t f2; 23 uint16_t f3; 24 uint8_t f4[8]; 25 } GUID; 26 #endif 27 28 // use copies of the IIDs to avoid symbol collisions 29 #define IID_IUnknown MP_IID_IUnknown 30 #define IID_IClassFactory MP_IID_IClassFactory 31 extern const GUID IID_IUnknown; 32 extern const GUID IID_IClassFactory; 33 34 typedef long (*GETCLASSOBJECT) (GUID* clsid, const GUID* iid, void** ppv); 35 int RegisterComClass(const GUID* clsid, GETCLASSOBJECT gcs); 36 int UnregisterComClass(const GUID* clsid, GETCLASSOBJECT gcs); 37 38 #ifndef STDCALL 39 #define STDCALL __attribute__((__stdcall__)) 40 #endif 41 42 struct IUnknown; 43 struct IClassFactory; 44 struct IUnknown_vt 45 { 46 long STDCALL (*QueryInterface)(struct IUnknown* this, const GUID* iid, void** ppv); 47 long STDCALL (*AddRef)(struct IUnknown* this) ; 48 long STDCALL (*Release)(struct IUnknown* this) ; 49 } ; 50 51 typedef struct IUnknown 52 { 53 struct IUnknown_vt* vt; 54 } IUnknown; 55 56 struct IClassFactory_vt 57 { 58 long STDCALL (*QueryInterface)(struct IUnknown* this, const GUID* iid, void** ppv); 59 long STDCALL (*AddRef)(struct IUnknown* this) ; 60 long STDCALL (*Release)(struct IUnknown* this) ; 61 long STDCALL (*CreateInstance)(struct IClassFactory* this, struct IUnknown* pUnkOuter, const GUID* riid, void** ppvObject); 62 }; 63 64 struct IClassFactory 65 { 66 struct IClassFactory_vt* vt; 67 }; 68 69 #ifdef WIN32_LOADER 70 long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter, 71 long dwClsContext, const GUID* riid, void** ppv); 72 void* CoTaskMemAlloc(unsigned long cb); 73 void CoTaskMemFree(void* cb); 74 #else 75 long STDCALL CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter, 76 long dwClsContext, const GUID* riid, void** ppv); 77 void* STDCALL CoTaskMemAlloc(unsigned long); 78 void STDCALL CoTaskMemFree(void*); 79 #endif 80 81 #endif /* MPLAYER_COM_H */ 82