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