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