Merge pull request #2810 from jmarshallnz/eval_conditions_before_actions
[vuplus_xbmc] / xbmc / system.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2013 Team XBMC
5  *      http://www.xbmc.org
6  *
7  *  This Program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  This Program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with XBMC; see the file COPYING.  If not, see
19  *  <http://www.gnu.org/licenses/>.
20  *
21  */
22
23 #if defined(HAVE_CONFIG_H) && !defined(TARGET_WINDOWS)
24 #include "config.h"
25 #define DECLARE_UNUSED(a,b) a __attribute__((unused)) b;
26 #endif
27
28 #define PRE_SKIN_VERSION_9_10_COMPATIBILITY 1
29 #define PRE_SKIN_VERSION_11_COMPATIBILITY 1
30
31 /*****************
32  * All platforms
33  *****************/
34 #define HAS_DVD_SWSCALE
35 #define HAS_DVDPLAYER
36 #define HAS_EVENT_SERVER
37 #define HAS_KARAOKE
38 #define HAS_SCREENSAVER
39 #define HAS_PYTHON
40 #define HAS_SYSINFO
41 #define HAS_VIDEO_PLAYBACK
42 #define HAS_VISUALISATION
43 #define HAS_PVRCLIENTS
44
45 #ifdef HAVE_LIBMICROHTTPD
46 #define HAS_WEB_SERVER
47 #define HAS_WEB_INTERFACE
48 #endif
49
50 #define HAS_JSONRPC
51
52 #ifdef USE_ASAP_CODEC
53 #define HAS_ASAP_CODEC
54 #endif
55
56 #define HAS_FILESYSTEM
57 #define HAS_FILESYSTEM_CDDA
58 #define HAS_FILESYSTEM_RTV
59 #define HAS_FILESYSTEM_DAAP
60 #define HAS_FILESYSTEM_SAP
61 #define HAS_FILESYSTEM_VTP
62 #define HAS_FILESYSTEM_HTSP
63
64 #ifdef HAVE_LIBSMBCLIENT
65   #define HAS_FILESYSTEM_SMB
66 #endif
67
68 #ifdef HAVE_LIBNFS
69   #define HAS_FILESYSTEM_NFS
70 #endif
71
72 #ifdef HAVE_LIBAFPCLIENT
73   #define HAS_FILESYSTEM_AFP
74 #endif
75
76 #ifdef HAVE_LIBPLIST
77   #define HAS_AIRPLAY
78 #endif
79
80 #if defined(HAVE_LIBSHAIRPORT) || defined(HAVE_LIBSHAIRPLAY)
81   #define HAS_AIRTUNES
82 #endif
83
84 #ifdef HAVE_MYSQL
85   #define HAS_MYSQL
86 #endif
87
88 #if defined(USE_UPNP)
89   #define HAS_UPNP
90 #endif
91
92 #if defined(HAVE_LIBMDNSEMBEDDED)
93   #define HAS_ZEROCONF
94   #define HAS_MDNS
95   #define HAS_MDNS_EMBEDDED
96 #endif
97
98 /**********************
99  * Non-free Components
100  **********************/
101
102 #if defined(TARGET_WINDOWS)
103   #define HAS_FILESYSTEM_RAR
104 #else
105   #if defined(HAVE_XBMC_NONFREE)
106     #define HAS_FILESYSTEM_RAR
107   #endif
108 #endif
109
110 /*****************
111  * Win32 Specific
112  *****************/
113
114 #if defined(TARGET_WINDOWS)
115 #define HAS_SDL_JOYSTICK
116 #define HAS_DVD_DRIVE
117 #define HAS_WIN32_NETWORK
118 #define HAS_IRSERVERSUITE
119 #define HAS_AUDIO
120 #define HAVE_LIBCRYSTALHD 2
121 #define HAS_WEB_SERVER
122 #define HAS_WEB_INTERFACE
123 #define HAVE_LIBSSH
124 #define HAS_LIBRTMP
125 #define HAVE_LIBBLURAY
126 #define HAS_ASAP_CODEC
127 #define HAVE_YAJL_YAJL_VERSION_H
128 #define HAS_FILESYSTEM_SMB
129 #define HAS_FILESYSTEM_NFS
130 #define HAS_ZEROCONF
131 #define HAS_MDNS
132 #define HAS_AIRPLAY
133 #define HAS_AIRTUNES
134 #define HAVE_LIBSHAIRPLAY
135 #define HAVE_LIBCEC
136 #define HAVE_LIBMP3LAME
137 #define HAVE_LIBVORBISENC
138 #define HAS_MYSQL
139 #define HAS_UPNP
140
141 #define DECLARE_UNUSED(a,b) a b;
142 #endif
143
144 /*****************
145  * Mac Specific
146  *****************/
147
148 #if defined(TARGET_DARWIN)
149   #if defined(TARGET_DARWIN_OSX)
150     #define HAS_GL
151     #define HAS_SDL
152     #define HAS_SDL_OPENGL
153     #define HAS_SDL_WIN_EVENTS
154   #endif
155   #define HAS_ZEROCONF
156   #define HAS_LINUX_NETWORK
157 #endif
158
159 /*****************
160  * Linux Specific
161  *****************/
162
163 #if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
164 #if defined(HAVE_LIBAVAHI_COMMON) && defined(HAVE_LIBAVAHI_CLIENT)
165 #define HAS_ZEROCONF
166 #define HAS_AVAHI
167 #endif
168 #ifdef HAVE_DBUS
169 #define HAS_DBUS
170 #endif
171 #define HAS_GL
172 #ifdef HAVE_X11
173 #define HAS_GLX
174 #endif
175 #ifdef HAVE_SDL
176 #define HAS_SDL
177 #ifndef HAS_SDL_OPENGL
178 #define HAS_SDL_OPENGL
179 #endif
180 #define HAS_SDL_WIN_EVENTS
181 #else
182 #define HAS_LINUX_EVENTS
183 #endif
184 #define HAS_LINUX_NETWORK
185 #define HAS_LIRC
186 #ifdef HAVE_LIBPULSE
187 #define HAS_PULSEAUDIO
188 #endif
189 #ifdef HAVE_LIBXRANDR
190 #define HAS_XRANDR
191 #endif
192 #ifdef HAVE_ALSA
193 #define HAS_ALSA
194 #endif
195 #endif
196
197 #ifdef HAVE_LIBSSH
198 #define HAS_FILESYSTEM_SFTP
199 #endif
200
201 /*****************
202  * Git revision
203  *****************/
204
205 #if defined(TARGET_DARWIN)
206 #include "../git_revision.h"
207 #endif
208
209 #ifndef GIT_REV
210 #define GIT_REV "Unknown"
211 #endif
212
213 /****************************************
214  * Additional platform specific includes
215  ****************************************/
216
217 #if defined(TARGET_WINDOWS)
218 #include <windows.h>
219 #define DIRECTINPUT_VERSION 0x0800
220 #include "mmsystem.h"
221 #include "DInput.h"
222 #include "DSound.h"
223 #define DSSPEAKER_USE_DEFAULT DSSPEAKER_STEREO
224 #define LPDIRECTSOUND8 LPDIRECTSOUND
225 #undef GetFreeSpace
226 #include "PlatformInclude.h"
227 #ifdef HAS_DX
228 #include "D3D9.h"   // On Win32, we're always using DirectX for something, whether it be the actual rendering
229 #include "D3DX9.h"  // or the reference video clock.
230 #else
231 #include <d3d9types.h>
232 #endif
233 #ifdef HAS_SDL
234 #include "SDL\SDL.h"
235 #endif
236 #endif
237
238 #if defined(TARGET_POSIX)
239 #include <time.h>
240 #include <sys/time.h>
241 #include <sys/types.h>
242 #include <errno.h>
243 #include "PlatformInclude.h"
244 #endif
245
246 #if defined(TARGET_ANDROID)
247 #undef HAS_LINUX_EVENTS
248 #undef HAS_LIRC
249 #endif
250
251 // EGL detected. Dont use GLX!
252 #ifdef HAVE_LIBEGL
253 #undef HAS_GLX
254 #define HAS_EGL
255 #endif
256
257 // GLES2.0 detected. Dont use GL!
258 #ifdef HAVE_LIBGLESV2
259 #undef HAS_GL
260 #define HAS_GLES 2
261 #endif
262
263 // GLES1.0 detected. Dont use GL!
264 #ifdef HAVE_LIBGLES
265 #undef HAS_GL
266 #define HAS_GLES 1
267 #endif
268
269 #ifdef HAS_DVD_DRIVE
270 #define HAS_CDDA_RIPPER
271 #endif
272
273 #define SAFE_DELETE(p)       do { delete (p);     (p)=NULL; } while (0)
274 #define SAFE_DELETE_ARRAY(p) do { delete[] (p);   (p)=NULL; } while (0)
275 #define SAFE_RELEASE(p)      do { if(p) { (p)->Release(); (p)=NULL; } } while (0)
276
277 // Useful pixel colour manipulation macros
278 #define GET_A(color)            ((color >> 24) & 0xFF)
279 #define GET_R(color)            ((color >> 16) & 0xFF)
280 #define GET_G(color)            ((color >>  8) & 0xFF)
281 #define GET_B(color)            ((color >>  0) & 0xFF)
282
283 /****************
284  * default skin
285  ****************/
286 #if defined(HAS_SKIN_TOUCHED) && defined(TARGET_DARWIN_IOS) && !defined(TARGET_DARWIN_IOS_ATV2)
287 #define DEFAULT_SKIN          "skin.touched"
288 #else
289 #define DEFAULT_SKIN          "skin.confluence"
290 #endif