Merge pull request #5070 from Memphiz/osx_fix_devicechanged_recursionbp
[vuplus_xbmc] / xbmc / system.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2013 Team XBMC
5  *      http://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  * Additional platform specific includes
203  ****************************************/
204
205 #if defined(TARGET_WINDOWS)
206 #include <windows.h>
207 #define DIRECTINPUT_VERSION 0x0800
208 #include "mmsystem.h"
209 #include "DInput.h"
210 #include "DSound.h"
211 #define DSSPEAKER_USE_DEFAULT DSSPEAKER_STEREO
212 #define LPDIRECTSOUND8 LPDIRECTSOUND
213 #undef GetFreeSpace
214 #include "PlatformInclude.h"
215 #ifdef HAS_DX
216 #include "D3D9.h"   // On Win32, we're always using DirectX for something, whether it be the actual rendering
217 #include "D3DX9.h"  // or the reference video clock.
218 #else
219 #include <d3d9types.h>
220 #endif
221 #ifdef HAS_SDL
222 #include "SDL\SDL.h"
223 #endif
224 #endif
225
226 #if defined(TARGET_POSIX)
227 #include <time.h>
228 #include <sys/time.h>
229 #include <sys/types.h>
230 #include <errno.h>
231 #include "PlatformInclude.h"
232 #endif
233
234 #if defined(TARGET_ANDROID)
235 #undef HAS_LINUX_EVENTS
236 #undef HAS_LIRC
237 #endif
238
239 // EGL detected. Dont use GLX!
240 #ifdef HAVE_LIBEGL
241 #undef HAS_GLX
242 #define HAS_EGL
243 #endif
244
245 // GLES2.0 detected. Dont use GL!
246 #ifdef HAVE_LIBGLESV2
247 #undef HAS_GL
248 #define HAS_GLES 2
249 #endif
250
251 // GLES1.0 detected. Dont use GL!
252 #ifdef HAVE_LIBGLES
253 #undef HAS_GL
254 #define HAS_GLES 1
255 #endif
256
257 #ifdef HAS_DVD_DRIVE
258 #define HAS_CDDA_RIPPER
259 #endif
260
261 #define SAFE_DELETE(p)       do { delete (p);     (p)=NULL; } while (0)
262 #define SAFE_DELETE_ARRAY(p) do { delete[] (p);   (p)=NULL; } while (0)
263 #define SAFE_RELEASE(p)      do { if(p) { (p)->Release(); (p)=NULL; } } while (0)
264
265 // Useful pixel colour manipulation macros
266 #define GET_A(color)            ((color >> 24) & 0xFF)
267 #define GET_R(color)            ((color >> 16) & 0xFF)
268 #define GET_G(color)            ((color >>  8) & 0xFF)
269 #define GET_B(color)            ((color >>  0) & 0xFF)
270
271 /****************
272  * default skin
273  ****************/
274 #if defined(HAS_SKIN_TOUCHED) && defined(TARGET_DARWIN_IOS) && !defined(TARGET_DARWIN_IOS_ATV2)
275 #define DEFAULT_SKIN          "skin.touched"
276 #else
277 #define DEFAULT_SKIN          "skin.confluence"
278 #endif