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