libplatform/platform_posix.h Source File
platform_posix.h
1 #ifndef MP4V2_PLATFORM_POSIX_H
2 #define MP4V2_PLATFORM_POSIX_H
3 
5 
6 #include "libplatform/config.h"
7 
9 
10 // constant macros are not usually used with C++ so the standard mechanism to
11 // activate it is to define before stdint.h
12 #ifndef __STDC_CONSTANT_MACROS
13 # define __STDC_CONSTANT_MACROS
14 #endif
15 
16 // format macros are not usually used with C++ so the standard mechanism to
17 // activate it is to define before inttypes.h
18 #ifndef __STDC_FORMAT_MACROS
19 # define __STDC_FORMAT_MACROS
20 #endif
21 
22 #ifdef NEED_LFS_ACTIVATION
23 # ifndef _LARGEFILE_SOURCE
24 # define _LARGEFILE_SOURCE
25 # define _FILE_OFFSET_BITS 64
26 # endif
27 #endif
28 
30 
31 #include "libplatform/platform_base.h"
32 #include <inttypes.h>
33 #include <stdint.h>
34 #include <fcntl.h>
35 #include <unistd.h>
36 
37 #include <mp4v2/mp4v2.h>
38 
40 
41 namespace mp4v2 { namespace platform {
42  using namespace std;
43 
44  using ::int8_t;
45  using ::int16_t;
46  using ::int32_t;
47  using ::int64_t;
48 
49  using ::uint8_t;
50  using ::uint16_t;
51  using ::uint32_t;
52  using ::uint64_t;
53 }} // namespace mp4v2::platform
54 
56 
57 // win32 platform requires O_BINARY when using old open() calls so we add
58 // this harmless bit-flag for posix to avoid .cpp platform conditionals
59 #ifndef O_BINARY
60 # define O_BINARY 0
61 #endif
62 
64 
65 // ARM seems to require integer instructions operands to have 4-byte alignment
66 // so we set this macro to for some int<->string code to manually copy string
67 // bytes into an int which aligns it. This is much easier than trying to
68 // align pertinent string data (constants) from in text sections.
69 #if defined( __arm__ )
70 # define MP4V2_INTSTRING_ALIGNMENT 1
71 #else
72 # undef MP4V2_INTSTRING_ALIGNMENT
73 #endif
74 
76 
77 #endif // MP4V2_PLATFORM_POSIX_H