source: extensions/gsdl-video/trunk/installed/cmdline/include/mpeg4ip.h@ 18425

Last change on this file since 18425 was 18425, checked in by davidb, 15 years ago

Video extension to Greenstone

File size: 7.7 KB
Line 
1/*
2 * The contents of this file are subject to the Mozilla Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/MPL/
6 *
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
11 *
12 * The Original Code is MPEG4IP.
13 *
14 * The Initial Developer of the Original Code is Cisco Systems Inc.
15 * Portions created by Cisco Systems Inc. are
16 * Copyright (C) Cisco Systems Inc. 2000, 2001. All Rights Reserved.
17 *
18 * Contributor(s):
19 * Dave Mackie [email protected]
20 */
21
22#ifndef __MPEG4IP_INCLUDED__
23#define __MPEG4IP_INCLUDED__
24
25/* project wide applicable stuff here */
26
27
28#ifdef WIN32
29#define HAVE_IN_PORT_T
30#define HAVE_SOCKLEN_T
31#define NEED_SDL_VIDEO_IN_MAIN_THREAD
32#else
33#undef PACKAGE
34#undef VERSION
35#include <mpeg4ip_config.h>
36#undef PACKAGE
37#undef VERSION
38// so these don't propogate
39#endif
40
41// the mpeg4ip_package and mpeg4ip_version are always in this
42// file
43#include "mpeg4ip_version.h"
44
45
46
47
48#ifdef WIN32
49
50#define _WIN32_WINNT 0x0400
51#define _WINSOCKAPI_
52#include <windows.h>
53#include <winsock2.h>
54#include <stdio.h>
55#include <errno.h>
56#include <stdlib.h>
57#include <time.h>
58#include <limits.h>
59
60typedef unsigned __int64 uint64_t;
61typedef unsigned __int32 uint32_t;
62typedef unsigned __int16 uint16_t;
63typedef unsigned __int8 uint8_t;
64typedef unsigned __int64 u_int64_t;
65typedef unsigned __int32 u_int32_t;
66typedef unsigned __int16 u_int16_t;
67typedef unsigned __int8 u_int8_t;
68typedef __int64 int64_t;
69typedef __int32 int32_t;
70typedef __int16 int16_t;
71typedef __int8 int8_t;
72typedef unsigned short in_port_t;
73typedef int socklen_t;
74typedef int ssize_t;
75#define snprintf _snprintf
76#define strncasecmp _strnicmp
77#define strcasecmp _stricmp
78
79#include <io.h>
80#include <fcntl.h>
81#include <sys/types.h>
82#include <sys/stat.h>
83#define write _write
84#define lseek _lseek
85#define close _close
86#define open _open
87#define access _access
88#define vsnprintf _vsnprintf
89#define F_OK 0
90#define OPEN_RDWR (_O_RDWR | _O_BINARY)
91#define OPEN_CREAT (_O_CREAT | _O_BINARY)
92#define OPEN_RDONLY (_O_RDONLY | _O_BINARY)
93#define srandom srand
94#define random rand
95
96#define IOSBINARY ios::binary
97
98#ifdef __cplusplus
99extern "C" {
100#endif
101int gettimeofday(struct timeval *t, void *);
102#ifdef __cplusplus
103}
104#endif
105
106#define PATH_MAX MAX_PATH
107#define MAX_UINT64 -1
108#define D64F "I64d"
109#define U64F "I64u"
110#define X64F "I64x"
111
112#define TO_D64(a) (a##I64)
113#define TO_U64(a) (a##UI64)
114
115#define LOG_EMERG 0
116#define LOG_ALERT 1
117#define LOG_CRIT 2
118#define LOG_ERR 3
119#define LOG_WARNING 4
120#define LOG_NOTICE 5
121#define LOG_INFO 6
122#define LOG_DEBUG 7
123
124#if !__STDC__ && _INTEGRAL_MAX_BITS >= 64
125#define VAR_TO_FPOS(fpos, var) (fpos) = (var)
126#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)(_FPOSOFF(fpos))
127#else
128#define VAR_TO_FPOS(fpos, var) (fpos).lopart = ((var) & UINT_MAX); (fpos).hipart = ((var) >> 32)
129#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)((uint64_t)((fpos).hipart ) << 32 | (fpos).lopart)
130#endif
131
132#define __STRING(expr) #expr
133
134#define FOPEN_READ_BINARY "rb"
135#define FOPEN_WRITE_BINARY "wb"
136
137#define UINT64_TO_DOUBLE(a) ((double)((int64_t)(a)))
138#else /* UNIX */
139/*****************************************************************************
140 * UNIX LIKE DEFINES BELOW THIS POINT
141 *****************************************************************************/
142#ifdef sun
143#include <sys/feature_tests.h>
144#endif
145
146#ifndef _FILE_OFFSET_BITS
147#define _FILE_OFFSET_BITS 64
148#else
149#ifndef sun
150#if _FILE_OFFSET_BITS < 64
151 #error File offset bits is already set to non-64 value
152#endif
153#endif
154#endif
155
156#ifndef _LARGEFILE_SOURCE
157#define _LARGEFILE_SOURCE
158#endif
159#include <stdio.h>
160#include <errno.h>
161#include <stdlib.h>
162
163#ifdef HAVE_INTTYPES_H
164#include <inttypes.h>
165#endif
166#ifdef HAVE_STDINT_H
167#include <stdint.h>
168#endif
169#if !defined(HAVE_INTTYPES_H) || !defined(HAVE_STDINT_H)
170#error "Don't have stdint.h or inttypes.h - no way to get uint8_t"
171#endif
172
173#include <unistd.h>
174#include <fcntl.h>
175#include <netinet/in.h>
176#include <sys/types.h>
177#include <sys/socket.h>
178#include <netinet/in.h>
179#include <arpa/inet.h>
180#include <syslog.h>
181#include <string.h>
182#include <ctype.h>
183#include <netdb.h>
184#include <sys/stat.h>
185#ifdef TIME_WITH_SYS_TIME
186#include <sys/time.h>
187#include <time.h>
188#else
189#ifdef HAVE_SYS_TIME_H
190#include <sys/time.h>
191#else
192#include <time.h>
193#endif
194#endif
195#include <sys/param.h>
196
197#define OPEN_RDWR O_RDWR
198#define OPEN_CREAT O_CREAT
199#define OPEN_RDONLY O_RDONLY
200
201#define closesocket close
202#define IOSBINARY ios::bin
203
204#if SIZEOF_LONG == 8
205#define MAX_UINT64 -1LU
206#define D64F "ld"
207#define U64F "lu"
208#define X64F "lx"
209
210#define TO_D64(a) (a##LD)
211#define TO_U64(a) (a##LU)
212#else
213#define MAX_UINT64 -1LLU
214#define D64F "lld"
215#define U64F "llu"
216#define X64F "llx"
217
218#define TO_D64(a) (a##LLD)
219#define TO_U64(a) (a##LLU)
220#endif
221
222#ifdef HAVE_FPOS_T___POS
223#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)((fpos).__pos)
224#define VAR_TO_FPOS(fpos, var) (fpos).__pos = (var)
225#else
226#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)(fpos)
227#define VAR_TO_FPOS(fpos, var) (fpos) = (var)
228#endif
229
230#define FOPEN_READ_BINARY "r"
231#define FOPEN_WRITE_BINARY "w"
232#define UINT64_TO_DOUBLE(a) ((double)(a))
233#endif /* define unix */
234
235/*****************************************************************************
236 * Generic type includes used in the whole package *
237 *****************************************************************************/
238#define D64 "%"D64F
239#define U64 "%"U64F
240#define X64 "%"X64F
241
242#define M_LLU TO_U64(1000)
243#define M_64 TO_U64(1000)
244#define LLU U64
245
246#include <stdarg.h>
247typedef void (*error_msg_func_t)(int loglevel,
248 const char *lib,
249 const char *fmt,
250 va_list ap);
251typedef void (*lib_message_func_t)(int loglevel,
252 const char *lib,
253 const char *fmt,
254 ...);
255#ifndef HAVE_IN_PORT_T
256typedef uint16_t in_port_t;
257#endif
258
259#ifndef HAVE_SOCKLEN_T
260typedef unsigned int socklen_t;
261#endif
262
263#ifdef sun
264#include <limits.h>
265#define u_int8_t uint8_t
266#define u_int16_t uint16_t
267#define u_int32_t uint32_t
268#define u_int64_t uint64_t
269#define __STRING(expr) #expr
270#endif
271
272#ifndef HAVE_STRSEP
273#ifdef __cplusplus
274extern "C" {
275#endif
276char *strsep(char **strp, const char *delim);
277#ifdef __cplusplus
278}
279#endif
280#endif
281
282#ifndef MIN
283#define MIN(a,b) ((a) < (b) ? (a) : (b))
284#endif
285
286#ifndef MAX
287#define MAX(a,b) ((a) > (b) ? (a) : (b))
288#endif
289
290#ifndef INADDR_NONE
291#define INADDR_NONE (-1)
292#endif
293
294#define MALLOC_STRUCTURE(a) ((a *)malloc(sizeof(a)))
295
296#define CHECK_AND_FREE(a) if ((a) != NULL) { free((void *)(a)); (a) = NULL;}
297
298#define NUM_ELEMENTS_IN_ARRAY(name) ((sizeof((name))) / (sizeof(*(name))))
299
300#define ADV_SPACE(a) {while (isspace(*(a)) && (*(a) != '\0'))(a)++;}
301
302#ifndef HAVE_GTK
303typedef char gchar;
304typedef unsigned char guchar;
305
306typedef int gint;
307typedef unsigned int guint;
308
309typedef long glong;
310typedef unsigned long gulong;
311
312typedef double gdouble;
313
314typedef int gboolean;
315
316typedef int16_t gint16;
317typedef uint16_t guint16;
318
319typedef int32_t gint32;
320typedef uint32_t guint32;
321
322typedef int64_t gint64;
323typedef uint64_t guint64;
324
325typedef uint8_t guint8;
326typedef int8_t gint8;
327
328#endif
329
330#ifndef FALSE
331#define FALSE 0
332#endif
333
334#ifndef TRUE
335#define TRUE 1
336#endif
337
338#ifndef __cplusplus
339#ifndef bool
340typedef unsigned char bool;
341#endif
342#endif
343
344#ifndef ROUND
345# ifdef HAVE_RINT
346# define ROUND(f) rint(f)
347# else
348# define ROUND(f) (int)(floor((f) + 0.5))
349# endif
350#endif
351
352#ifndef INT16_MAX
353# define INT16_MAX (32767)
354#endif
355#ifndef INT16_MIN
356# define INT16_MIN (-32767-1)
357#endif
358
359#ifndef UINT32_MAX
360# define UINT32_MAX (4294967295U)
361#endif
362
363#ifndef UINT64_MAX
364# define UINT64_MAX TO_U64(0xffffffffffffffff)
365#endif
366
367#endif /* __MPEG4IP_INCLUDED__ */
368
Note: See TracBrowser for help on using the repository browser.