win32.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*!
  2. ************************************************************************
  3. * \file
  4. * win32.h
  5. *
  6. * \brief
  7. * win32 definitions for H.264 encoder.
  8. *
  9. * \author
  10. *
  11. ************************************************************************
  12. */
  13. #ifndef _H264_WIN32_H_
  14. #define _H264_WIN32_H_
  15. #pragma once
  16. # include <fcntl.h>
  17. # include <stdlib.h>
  18. # include <stdio.h>
  19. # include <string.h>
  20. # include <assert.h>
  21. #if defined(WIN32)
  22. # include <io.h>
  23. # include <sys/types.h>
  24. # include <sys/stat.h>
  25. # include <windows.h>
  26. #ifndef strcasecmp
  27. # define strcasecmp _strcmpi
  28. #endif
  29. # define snprintf _snprintf
  30. # define open _open
  31. # define close _close
  32. # define read _read
  33. # define write _write
  34. #ifndef lseek
  35. # define lseek _lseeki64
  36. #endif
  37. # define fsync _commit
  38. # define tell _telli64
  39. # define TIMEB _timeb
  40. # define TIME_T LARGE_INTEGER
  41. # define OPENFLAGS_WRITE _O_WRONLY|_O_CREAT|_O_BINARY|_O_TRUNC
  42. # define OPEN_PERMISSIONS _S_IREAD | _S_IWRITE
  43. # define OPENFLAGS_READ _O_RDONLY|_O_BINARY
  44. # define inline _inline
  45. # define forceinline __forceinline
  46. #else
  47. # include <unistd.h>
  48. # include <sys/time.h>
  49. # include <sys/stat.h>
  50. # include <time.h>
  51. # define TIMEB timeb
  52. # define TIME_T struct timeval
  53. # define tell(fd) lseek(fd, 0, SEEK_CUR)
  54. # define OPENFLAGS_WRITE O_WRONLY|O_CREAT|O_TRUNC
  55. # define OPENFLAGS_READ O_RDONLY
  56. # define OPEN_PERMISSIONS S_IRUSR | S_IWUSR
  57. # if __STDC_VERSION__ >= 199901L
  58. /* "inline" is a keyword */
  59. # else
  60. # define inline /* nothing */
  61. # endif
  62. # define forceinline inline
  63. #endif
  64. #if defined(WIN32) && !defined(__GNUC__)
  65. typedef __int64 int64;
  66. typedef unsigned __int64 uint64;
  67. # define FORMAT_OFF_T "I64d"
  68. # ifndef INT64_MIN
  69. # define INT64_MIN (-9223372036854775807i64 - 1i64)
  70. # endif
  71. #else
  72. typedef long long int64;
  73. typedef unsigned long long uint64;
  74. # define FORMAT_OFF_T "lld"
  75. # ifndef INT64_MIN
  76. # define INT64_MIN (-9223372036854775807LL - 1LL)
  77. # endif
  78. #endif
  79. void gettime(TIME_T* time);
  80. int64 timediff(TIME_T* start, TIME_T* end);
  81. int64 timenorm(int64 cur_time);
  82. #endif