Merge pull request #2659 from herrnst/isinternetstream
[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 /**********************
93  * Non-free Components
94  **********************/
95
96 #if defined(TARGET_WINDOWS)
97   #define HAS_FILESYSTEM_RAR
98 #else
99   #if defined(HAVE_XBMC_NONFREE)
100     #define HAS_FILESYSTEM_RAR
101   #endif
102 #endif
103
104 /*****************
105  * Win32 Specific
106  *****************/
107
108 #if defined(TARGET_WINDOWS)
109 #define HAS_SDL_JOYSTICK
110 #define HAS_DVD_DRIVE
111 #define HAS_WIN32_NETWORK
112 #define HAS_IRSERVERSUITE
113 #define HAS_AUDIO
114 #define HAVE_LIBCRYSTALHD 2
115 #define HAS_WEB_SERVER
116 #define HAS_WEB_INTERFACE
117 #define HAVE_LIBSSH
118 #define HAS_LIBRTMP
119 #define HAVE_LIBBLURAY
120 #define HAS_ASAP_CODEC
121 #define HAVE_YAJL_YAJL_VERSION_H
122 #define HAS_FILESYSTEM_SMB
123 #define HAS_FILESYSTEM_NFS
124 #define HAS_ZEROCONF
125 #define HAS_AIRPLAY
126 #define HAS_AIRTUNES
127 #define HAVE_LIBSHAIRPLAY
128 #define HAVE_LIBCEC
129 #define HAVE_LIBMP3LAME
130 #define HAVE_LIBVORBISENC
131 #define HAS_MYSQL
132 #define HAS_UPNP
133
134 #define DECLARE_UNUSED(a,b) a b;
135 #endif
136
137 /*****************
138  * Mac Specific
139  *****************/
140
141 #if defined(TARGET_DARWIN)
142   #if defined(TARGET_DARWIN_OSX)
143     #define HAS_GL
144     #define HAS_SDL
145     #define HAS_SDL_OPENGL
146     #define HAS_SDL_WIN_EVENTS
147   #endif
148   #define HAS_ZEROCONF
149   #define HAS_LINUX_NETWORK
150 #endif
151
152 /*****************
153  * Linux Specific
154  *****************/
155
156 #if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
157 #if defined(HAVE_LIBAVAHI_COMMON) && defined(HAVE_LIBAVAHI_CLIENT)
158 #define HAS_ZEROCONF
159 #define HAS_AVAHI
160 #endif
161 #ifdef HAVE_DBUS
162 #define HAS_DBUS
163 #endif
164 #define HAS_GL
165 #ifdef HAVE_X11
166 #define HAS_GLX
167 #endif
168 #ifdef HAVE_SDL
169 #define HAS_SDL
170 #ifndef HAS_SDL_OPENGL
171 #define HAS_SDL_OPENGL
172 #endif
173 #define HAS_SDL_WIN_EVENTS
174 #else
175 #define HAS_LINUX_EVENTS
176 #endif
177 #define HAS_LINUX_NETWORK
178 #define HAS_LIRC
179 #ifdef HAVE_LIBPULSE
180 #define HAS_PULSEAUDIO
181 #endif
182 #ifdef HAVE_LIBXRANDR
183 #define HAS_XRANDR
184 #endif
185 #ifdef HAVE_ALSA
186 #define HAS_ALSA
187 #endif
188 #endif
189
190 #ifdef HAVE_LIBSSH
191 #define HAS_FILESYSTEM_SFTP
192 #endif
193
194 /*****************
195  * Git revision
196  *****************/
197
198 #if defined(TARGET_DARWIN)
199 #include "../git_revision.h"
200 #endif
201
202 #ifndef GIT_REV
203 #define GIT_REV "Unknown"
204 #endif
205
206 /****************************************
207  * Additional platform specific includes
208  ****************************************/
209
210 #if defined(TARGET_WINDOWS)
211 #include <windows.h>
212 #define DIRECTINPUT_VERSION 0x0800
213 #include "mmsystem.h"
214 #include "DInput.h"
215 #include "DSound.h"
216 #define DSSPEAKER_USE_DEFAULT DSSPEAKER_STEREO
217 #define LPDIRECTSOUND8 LPDIRECTSOUND
218 #undef GetFreeSpace
219 #include "PlatformInclude.h"
220 #ifdef HAS_DX
221 #include "D3D9.h"   // On Win32, we're always using DirectX for something, whether it be the actual rendering
222 #include "D3DX9.h"  // or the reference video clock.
223 #else
224 #include <d3d9types.h>
225 #endif
226 #ifdef HAS_SDL
227 #include "SDL\SDL.h"
228 #endif
229 #endif
230
231 #if defined(TARGET_POSIX)
232 #include <time.h>
233 #include <sys/time.h>
234 #include <sys/types.h>
235 #include <errno.h>
236 #include "PlatformInclude.h"
237 #endif
238
239 #if defined(TARGET_ANDROID)
240 #undef HAS_LINUX_EVENTS
241 #undef HAS_LIRC
242 #endif
243
244 // EGL detected. Dont use GLX!
245 #ifdef HAVE_LIBEGL
246 #undef HAS_GLX
247 #define HAS_EGL
248 #endif
249
250 // GLES2.0 detected. Dont use GL!
251 #ifdef HAVE_LIBGLESV2
252 #undef HAS_GL
253 #define HAS_GLES 2
254 #endif
255
256 // GLES1.0 detected. Dont use GL!
257 #ifdef HAVE_LIBGLES
258 #undef HAS_GL
259 #define HAS_GLES 1
260 #endif
261
262 #ifdef HAS_DVD_DRIVE
263 #define HAS_CDDA_RIPPER
264 #endif
265
266 #define SAFE_DELETE(p)       do { delete (p);     (p)=NULL; } while (0)
267 #define SAFE_DELETE_ARRAY(p) do { delete[] (p);   (p)=NULL; } while (0)
268 #define SAFE_RELEASE(p)      do { if(p) { (p)->Release(); (p)=NULL; } } while (0)
269
270 // Useful pixel colour manipulation macros
271 #define GET_A(color)            ((color >> 24) & 0xFF)
272 #define GET_R(color)            ((color >> 16) & 0xFF)
273 #define GET_G(color)            ((color >>  8) & 0xFF)
274 #define GET_B(color)            ((color >>  0) & 0xFF)
275
276 /****************
277  * default skin
278  ****************/
279 #if defined(HAS_SKIN_TOUCHED) && defined(TARGET_DARWIN_IOS) && !defined(TARGET_DARWIN_IOS_ATV2)
280 #define DEFAULT_SKIN          "skin.touched"
281 #else
282 #define DEFAULT_SKIN          "skin.confluence"
283 #endif