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