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