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