diff --git a/atom.h b/atom.h index 304d64c5..7e9a321c 100644 --- a/atom.h +++ b/atom.h @@ -3,7 +3,13 @@ #include #include -#include +#if (__cplusplus >= 201103L) +# include +#else +extern "C" { +# include +}; +#endif #include "file.h" diff --git a/file.h b/file.h index 087e65aa..227f6f35 100644 --- a/file.h +++ b/file.h @@ -23,7 +23,13 @@ #include #include -#include +#if (__cplusplus >= 201103L) +# include +#else +extern "C" { +# include +}; +#endif #include uint16_t swap16(uint16_t us); diff --git a/mp4.cpp b/mp4.cpp index 3ec2ebff..0940a357 100644 --- a/mp4.cpp +++ b/mp4.cpp @@ -27,15 +27,27 @@ #ifndef __STDC_CONSTANT_MACROS # define __STDC_CONSTANT_MACROS 1 #endif -#include +#if (__cplusplus >= 201103L) +# include +#else +extern "C" { +# include +}; +#endif #ifndef INT64_C # define INT64_C(c) (c ## LL) # define UINT64_C(c) (c ## ULL) #endif extern "C" { -#include "libavcodec/avcodec.h" -#include "libavformat/avformat.h" +#undef __bool_true_false_are_defined // Prevent #define of bool, true & false. +#define __bool_true_false_are_defined 1 +#ifndef _Bool +# define _Bool bool +#endif + +#include +#include } #include "mp4.h" diff --git a/track.cpp b/track.cpp index 3bf08e46..b56483ab 100644 --- a/track.cpp +++ b/track.cpp @@ -27,14 +27,25 @@ #ifndef __STDC_CONSTANT_MACROS # define __STDC_CONSTANT_MACROS 1 #endif -#include +#if (__cplusplus >= 201103L) +# include +#else +extern "C" { +# include +}; +#endif #ifndef INT64_C # define INT64_C(c) (c ## LL) # define UINT64_C(c) (c ## ULL) #endif -#include // Define C11 bool used in internal header included below. extern "C" { +#undef __bool_true_false_are_defined // Prevent #define of bool, true & false. +#define __bool_true_false_are_defined 1 +#ifndef _Bool +# define _Bool bool +#endif + #include #include