• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* -LICENSE-START-
2 ** Copyright (c) 2009 Blackmagic Design
3 **
4 ** Permission is hereby granted, free of charge, to any person or organization
5 ** obtaining a copy of the software and accompanying documentation covered by
6 ** this license (the "Software") to use, reproduce, display, distribute,
7 ** execute, and transmit the Software, and to prepare derivative works of the
8 ** Software, and to permit third-parties to whom the Software is furnished to
9 ** do so, all subject to the following:
10 **
11 ** The copyright notices in the Software and this entire statement, including
12 ** the above license grant, this restriction and the following disclaimer,
13 ** must be included in all copies of the Software, in whole or in part, and
14 ** all derivative works of the Software, unless such copies or derivative
15 ** works are solely in the form of machine-executable object code generated by
16 ** a source language processor.
17 **
18 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
21 ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
22 ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
23 ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 ** DEALINGS IN THE SOFTWARE.
25 ** -LICENSE-END-
26 */
27 
28 #ifndef __LINUX_COM_H_
29 #define __LINUX_COM_H_
30 
31 struct REFIID
32 {
33 	unsigned char byte0;
34 	unsigned char byte1;
35 	unsigned char byte2;
36 	unsigned char byte3;
37 	unsigned char byte4;
38 	unsigned char byte5;
39 	unsigned char byte6;
40 	unsigned char byte7;
41 	unsigned char byte8;
42 	unsigned char byte9;
43 	unsigned char byte10;
44 	unsigned char byte11;
45 	unsigned char byte12;
46 	unsigned char byte13;
47 	unsigned char byte14;
48 	unsigned char byte15;
49 };
50 
51 typedef REFIID CFUUIDBytes;
52 #define CFUUIDGetUUIDBytes(x)	x
53 
54 typedef int HRESULT;
55 typedef unsigned long ULONG;
56 typedef void *LPVOID;
57 
58 #define SUCCEEDED(Status) ((HRESULT)(Status) >= 0)
59 #define FAILED(Status) ((HRESULT)(Status)<0)
60 
61 #define IS_ERROR(Status) ((unsigned long)(Status) >> 31 == SEVERITY_ERROR)
62 #define HRESULT_CODE(hr) ((hr) & 0xFFFF)
63 #define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1fff)
64 #define HRESULT_SEVERITY(hr) (((hr) >> 31) & 0x1)
65 #define SEVERITY_SUCCESS 0
66 #define SEVERITY_ERROR 1
67 
68 #define MAKE_HRESULT(sev,fac,code) ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
69 
70 #define S_OK ((HRESULT)0x00000000L)
71 #define S_FALSE ((HRESULT)0x00000001L)
72 #define E_UNEXPECTED ((HRESULT)0x8000FFFFL)
73 #define E_NOTIMPL ((HRESULT)0x80000001L)
74 #define E_OUTOFMEMORY ((HRESULT)0x80000002L)
75 #define E_INVALIDARG ((HRESULT)0x80000003L)
76 #define E_NOINTERFACE ((HRESULT)0x80000004L)
77 #define E_POINTER ((HRESULT)0x80000005L)
78 #define E_HANDLE ((HRESULT)0x80000006L)
79 #define E_ABORT ((HRESULT)0x80000007L)
80 #define E_FAIL ((HRESULT)0x80000008L)
81 #define E_ACCESSDENIED ((HRESULT)0x80000009L)
82 
83 #define STDMETHODCALLTYPE
84 
85 #define IID_IUnknown		(REFIID){0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}
86 #define IUnknownUUID		IID_IUnknown
87 
88 #ifndef BMD_PUBLIC
89 	#define BMD_PUBLIC
90 #endif
91 
92 #ifdef __cplusplus
93 class BMD_PUBLIC IUnknown
94 {
95     public:
96     	virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) = 0;
97     	virtual ULONG STDMETHODCALLTYPE AddRef(void) = 0;
98     	virtual ULONG STDMETHODCALLTYPE Release(void) = 0;
99 };
100 #endif
101 
102 #endif
103 
104