mpeg4ip_win32.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. 2005. All Rights Reserved.
  17. *
  18. * Contributor(s):
  19. * Bill May [email protected]
  20. */
  21. /* windows defines */
  22. #ifndef __MPEG4IP_WIN32_H__
  23. #define __MPEG4IP_WIN32_H__
  24. #define HAVE_IN_PORT_T
  25. #define HAVE_SOCKLEN_T
  26. #define NEED_SDL_VIDEO_IN_MAIN_THREAD
  27. #define WIN32_LEAN_AND_MEAN
  28. #include <windows.h>
  29. #include <winsock2.h>
  30. #include <stdio.h>
  31. #include <errno.h>
  32. #include <stdlib.h>
  33. #include <time.h>
  34. #include <limits.h>
  35. #ifdef __GNUC__
  36. #include <stdint.h>
  37. #include <ctype.h>
  38. typedef uint64_t u_int64_t;
  39. typedef uint32_t u_int32_t;
  40. typedef uint16_t u_int16_t;
  41. typedef uint8_t u_int8_t;
  42. #else
  43. #include <bfc/platform/types.h>
  44. typedef unsigned __int64 u_int64_t;
  45. typedef unsigned __int32 u_int32_t;
  46. typedef unsigned __int16 u_int16_t;
  47. typedef unsigned __int8 u_int8_t;
  48. typedef unsigned short in_port_t;
  49. typedef int socklen_t;
  50. typedef unsigned int uint;
  51. #define snprintf _snprintf
  52. #define strncasecmp _strnicmp
  53. #ifndef strcasecmp
  54. #define strcasecmp _stricmp
  55. #endif
  56. #endif
  57. #include <io.h>
  58. #include <fcntl.h>
  59. #include <sys/types.h>
  60. #include <sys/stat.h>
  61. //#define write _write
  62. #define close _close
  63. #define open _open
  64. #define access _access
  65. #define vsnprintf _vsnprintf
  66. #define stat _stati64
  67. #define fstat _fstati64
  68. #define F_OK 0
  69. #define OPEN_RDWR (_O_RDWR | _O_BINARY)
  70. #define OPEN_CREAT (_O_CREAT | _O_BINARY)
  71. #define OPEN_RDONLY (_O_RDONLY | _O_BINARY)
  72. #define srandom srand
  73. #define random rand
  74. #define IOSBINARY ios::binary
  75. #ifdef __cplusplus
  76. extern "C" {
  77. #endif
  78. int gettimeofday(struct timeval *t, void *);
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82. #undef PATH_MAX
  83. #define PATH_MAX MAX_PATH
  84. #define MAX_UINT64 -1
  85. #ifdef __GNUC__
  86. #define D64F "lld"
  87. #define U64F "llu"
  88. #define X64F "llx"
  89. #define TO_D64(a) (a##LL)
  90. #define TO_U64(a) (a##LLU)
  91. #else
  92. #define D64F "I64d"
  93. #define U64F "I64u"
  94. #define X64F "I64x"
  95. #define TO_D64(a) (a##I64)
  96. #define TO_U64(a) (a##UI64)
  97. #endif
  98. #define LOG_EMERG 0
  99. #define LOG_ALERT 1
  100. #define LOG_CRIT 2
  101. #define LOG_ERR 3
  102. #define LOG_WARNING 4
  103. #define LOG_NOTICE 5
  104. #define LOG_INFO 6
  105. #define LOG_DEBUG 7
  106. #if defined(__GNUC__) || (!__STDC__ && _INTEGRAL_MAX_BITS >= 64)
  107. #define VAR_TO_FPOS(fpos, var) (fpos) = (var)
  108. #define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)(fpos)
  109. #else
  110. #define VAR_TO_FPOS(fpos, var) (fpos).lopart = ((var) & UINT_MAX); (fpos).hipart = ((var) >> 32)
  111. #define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)((uint64_t)((fpos).hipart ) << 32 | (fpos).lopart)
  112. #endif
  113. #define __STRING(expr) #expr
  114. #define FOPEN_READ_BINARY "rb"
  115. #define FOPEN_WRITE_BINARY "wb"
  116. #define UINT64_TO_DOUBLE(a) ((double)((int64_t)(a)))
  117. #ifdef __cplusplus
  118. extern "C" {
  119. #endif
  120. char *strcasestr(const char *haystack, const char *needle);
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124. #define SIZEOF_BOOL 1
  125. #endif