include/mp4v2/platform.h Source File
platform.h
1#ifndef MP4V2_PLATFORM_H
2#define MP4V2_PLATFORM_H
3
4/*****************************************************************************/
5
6#include <stddef.h>
7#include <stdio.h>
8#include <stdarg.h>
9
10// Thanks, MSFT, for making C99 a total PITA. Declare this not to define any stdint stuff; this is useful
11// if you're going to be using mp4v2 on windows with some other library that defines its own stdint.
12// The 1600 version check is for Visual Studio 2010 which has stdint once again.
13#ifndef MP4V2_NO_STDINT_DEFS
14 #if defined( _WIN32 ) && !defined( __MINGW32__ ) && !(defined(_MSC_VER) && _MSC_VER >= 1600)
15 typedef char int8_t;
16 typedef short int16_t;
17 typedef int int32_t;
18 typedef long long int64_t;
19
20 typedef unsigned char uint8_t;
21 typedef unsigned short uint16_t;
22 typedef unsigned int uint32_t;
23 typedef unsigned long long uint64_t;
24 #else
25 #include <stdint.h>
26 #endif
27#endif
28
29#if defined( _WIN32 ) || defined( __MINGW32__ )
30# if defined( MP4V2_EXPORTS )
31# define MP4V2_EXPORT __declspec(dllexport)
32# elif defined( MP4V2_USE_DLL_IMPORT ) || !defined( MP4V2_USE_STATIC_LIB )
33# define MP4V2_EXPORT __declspec(dllimport)
34# else
35# define MP4V2_EXPORT
36# endif
37#else
38# define MP4V2_EXPORT __attribute__((visibility("default")))
39#endif
40
41#if defined( __GNUC__ )
42# define MP4V2_DEPRECATED __attribute__((deprecated))
43#else
44# define MP4V2_DEPRECATED
45#endif
46
47/******************************************************************************
48 *
49 * TODO-KB: cleanup -- absolutely no need for a C-API to fuss with reserved
50 * C++ keywords. This will involve changing the public interface and current
51 * plan of action:
52 *
53 * typdef enum {
54 * mp4_false,
55 * mp4_true,
56 * } mp4_bool_t;
57 *
58 * followed by updating all public signatures and implementation.
59 */
60
61#ifndef FALSE
62#define FALSE 0
63#endif
64
65#ifndef TRUE
66#define TRUE 1
67#endif
68
69#if !defined( __cplusplus )
70#ifndef bool
71#if SIZEOF_BOOL == 8
72typedef uint64_t bool;
73#else
74#if SIZEOF_BOOL == 4
75typedef uint32_t bool;
76#else
77#if SIZEOF_BOOL == 2
78typedef uint16_t bool;
79#else
80typedef unsigned char bool;
81#endif
82#endif
83#endif
84#ifndef false
85#define false FALSE
86#endif
87#ifndef true
88#define true TRUE
89#endif
90#endif
91#endif
92
93/*****************************************************************************/
94
95#endif /* MP4V2_PLATFORM_H */