]> git.vomp.tv Git - vompclient.git/blob - defines.h
Fixes for Windows
[vompclient.git] / defines.h
1 /*
2     Copyright 2004-2020 Chris Tallon
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
18 */
19
20 #ifndef DEFINES_H
21 #define DEFINES_H
22
23 typedef unsigned char UCHAR;
24 typedef unsigned short USHORT;
25 typedef unsigned int UINT;
26 typedef unsigned long ULONG;
27 typedef unsigned long long ULLONG;
28
29 #define OPTIONTYPE_TEXT 1
30 #define OPTIONTYPE_INT 2
31
32 #define BENCHMARK_FPS
33
34
35 // Global useful functions
36
37 //ULLONG htonll(ULLONG a);
38 //ULLONG ntohll(ULLONG a);
39 void MILLISLEEP(ULONG a);
40 long long getTimeMS();
41
42 #include <string>
43
44
45 int getClockRealTime(struct timespec *tp);
46
47 const std::string& getCommandLineServer();
48
49 //#define WINDOWS_LEGACY
50
51 #ifdef WIN32
52
53
54   #define Thread_TYPE ThreadWin
55   #define ThreadID_TYPE unsigned int
56   #define VectorHandle void* 
57   #define VECTOR_HANDLE_INIT NULL
58 #ifndef WINDOWS_LEGACY
59   #define Osd_TYPE OsdWinVector
60   #define Surface_TYPE SurfaceVector
61   #define GRADIENT_DRAWING
62   #define ADVANCED_MENUES // This is for special HD versions of our menus
63 #else
64   #define Osd_TYPE OsdWinPixel
65   #define Surface_TYPE SurfaceWin
66 #endif
67
68   #define RemoteStartDev ""//No devices passed
69
70 // FIXME - check C++ - I think some of these are in std:: now ?
71 // FIXME - Not on Windows. Obviously. Also _snprintf doesn't guarantee null termination.
72 // FIXME When the Windows code is upped to VS2015 use snprintf instead of _snprintf.
73   #define SNPRINTF _snprintf
74   #define VSNPRINTF _vsnprintf
75   #define STRCASECMP _stricmp
76   #define STRCASESTR StrStrI
77 /*  #define STRTOULL _strtoui64 */
78   #define STRTOUL strtoul
79   #define STRTOKR strtok_s
80   #define LOCALTIME_R(time, tm) (localtime_s(tm,time)) 
81
82   #define CLOSESOCKET closesocket
83   #define DEFAULT_TCP_WINDOWSIZE 2048
84   #define DEFAULT_TCP_WINDOWSIZENR 2  /*=2048*/
85   #define PLAYER_MAX_STREAMING_BUFFERS 120 // for video in uints of 50000 KB
86
87   #define VOMP_HAS_EXIT
88
89   #define FALLTHROUGH
90
91 #else
92
93   int max(int, int);
94   int min(UINT, int);
95 /*#ifdef _MIPS_ARCH
96   #define Surface_TYPE SurfaceDirectFB
97 #else
98   #define Surface_TYPE
99 #endif*/
100 #ifdef __ANDROID__
101   #define Thread_TYPE ThreadPAndroid
102
103 #else
104   #define Thread_TYPE ThreadP
105
106 #endif
107   #include <pthread.h>
108   #define ThreadID_TYPE pthread_t
109
110   #define SNPRINTF snprintf
111   #define VSNPRINTF vsnprintf
112   #define STRCASECMP strcasecmp
113   #define STRCASESTR strcasestr
114   #define STRTOUL strtoul
115   #define STRTOKR strtok_r
116   #define LOCALTIME_R(time, tm) (localtime_r(time, tm)) 
117
118
119   #define CLOSESOCKET close
120
121 // add here defines for plattform specific objects
122 #ifdef VOMP_PLATFORM_RASPBERRY
123   #define Remote_TYPE InputLinux  // Generic Remote under Linux (Konsole!, not X) will support in the end:
124   #define RemoteStartDev ""//No devices passed
125
126   // Keyboard
127   // remotes under /dev/event
128   // HDMI CEC
129   //lirc?
130   #define Led_TYPE LedRaspberry  //this is device dependent
131   #define Osd_TYPE OsdOpenVG   // This OpenGL ES 2.0, in the moment only for raspberry, but might be splitted for other devices
132   #define Audio_TYPE AudioOMX   // This is Audio based on OpenMax and libav for decoding
133   #define Video_TYPE VideoOMX   // This is Video based on OpenMax
134
135
136
137   #define VPE_OMX_SUPPORT // Activate support for hardware codec using openmax il
138   #define VPE_OMX_H264_DECODER "OMX.broadcom.video_decode"
139   #define VPE_OMX_MPEG2_DECODER "OMX.broadcom.video_decode"
140   #define VPE_OMX_VIDEO_SCHED "OMX.broadcom.video_scheduler"
141   #define VPE_OMX_VIDEO_REND "OMX.broadcom.video_render"
142   #define VPE_OMX_VIDEO_DEINTERLACE "OMX.broadcom.image_fx"
143   #define VPE_OMX_CLOCK "OMX.broadcom.clock"
144   #define VPE_OMX_AUDIO_DECODER "OMX.broadcom.audio_decode"
145   #define VPE_OMX_AUDIO_REND "OMX.broadcom.audio_render"
146   #define VPE_OMX_IMAGE_DECODER "OMX.broadcom.image_decode"
147   #define VPE_OMX_EGL_REND "OMX.broadcom.egl_render"
148
149    //#define  VPE_LIBAV_SUPPORT
150   // #define  VPE_LIBAV_MPEG2_TRANSCODING
151
152   #define DEFAULT_TCP_WINDOWSIZE 0
153   #define DEFAULT_TCP_WINDOWSIZENR 0  /*=2048*/
154   #define PLAYER_MAX_STREAMING_BUFFERS 120 // for video in uints of 50000 KB
155   #define TV_NORM_SWITCHABLE
156   #define HANDLE_VT_SWITCHING
157   #define GRADIENT_DRAWING
158   #define ADVANCED_MENUES // This is for special HD versions of our menus
159   #define VectorHandle unsigned int 
160   #define VECTOR_HANDLE_INIT 0
161
162
163   #define PICTURE_DECODER_MAGICK
164   #define PICTURE_DECODER_OMX
165
166   #define VOMP_LINUX_CLOCK  CLOCK_MONOTONIC
167
168 #define FALLTHROUGH [[fallthrough]];
169
170 #endif
171 #ifdef VOMP_PLATTFORM_MVP                   // FIXME OBSOLETE
172   #define Remote_TYPE RemoteMVP
173   #define RemoteStartDev "/dev/rawir"
174   #define Led_TYPE
175   #define Osd_TYPE
176   #define Audio_TYPE
177   #define Video_TYPE
178   #define Surface_TYPE
179   #define DEFAULT_TCP_WINDOWSIZE 2048  /*=2048*/
180   #define DEFAULT_TCP_WINDOWSIZENR 2  /*=2048*/
181   #define PLAYER_MAX_STREAMING_BUFFERS 11 // for video in uints of 50000 KB
182   #define PAL_WSS
183
184   #define VOMP_MEDIAPLAYER
185   #define VOMP_LINUX_CLOCK  CLOCK_REALTIME
186
187   #define VectorHandle void*
188   #define VECTOR_HANDLE_INIT NULL
189
190 #endif
191
192 #ifdef VOMP_PLATTFORM_NMT // This was the attempt to port vomp to nmt, it failed but maybe the code is useful at some time
193   #define Remote_TYPE RemoteLirc
194   #define RemoteStartDev "/dev/lircd"
195   #define Led_TYPE LedMVP
196   #define Osd_TYPE OsdDirectFB
197   #define Audio_TYPE AudioNMT
198   #define Video_TYPE VideoNMT
199   #define Surface_TYPE SurfaceDirectFB //deprecated
200   #define DEFAULT_TCP_WINDOWSIZE 2048
201   #define DEFAULT_TCP_WINDOWSIZENR 2  /*=2048*/
202   #define PLAYER_MAX_STREAMING_BUFFERS 11 // for video in uints of 50000 KB
203
204   #define VOMP_LINUX_CLOCK  CLOCK_REALTIME
205
206 #endif
207
208 #endif
209
210 /*
211 typedef struct
212 {
213   UINT id;               // Used for working out what has changed at the end
214   char *title;           // Name of the option
215   char *configSection;   // Which section of the config file
216   char *configParam;     // Parameter name in the config file
217   UINT optionType;       // 1 for text, 2 for int
218   UINT optionCount;      // How many choices?
219   UINT defaultOption;    // Serial of the default choice (base 0), or actual option in int mode
220   int startInt;          // Starting int for int mode
221   const char * const * options;  // Text for the options (null for int mode)
222 } OPTIONDATA;
223 */
224
225 #endif