Skip to content

Commit

Permalink
Support C++98.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hacklin committed May 27, 2018
1 parent c6b56a8 commit 2c4a570
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 7 deletions.
8 changes: 7 additions & 1 deletion atom.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@

#include <vector>
#include <string>
#include <cstdint>
#if (__cplusplus >= 201103L)
# include <cstdint>
#else
extern "C" {
# include <stdint.h>
};
#endif

#include "file.h"

Expand Down
8 changes: 7 additions & 1 deletion file.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@

#include <vector>
#include <string>
#include <cstdint>
#if (__cplusplus >= 201103L)
# include <cstdint>
#else
extern "C" {
# include <stdint.h>
};
#endif
#include <cstdio>

uint16_t swap16(uint16_t us);
Expand Down
18 changes: 15 additions & 3 deletions mp4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,27 @@
#ifndef __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS 1
#endif
#include <cstdint>
#if (__cplusplus >= 201103L)
# include <cstdint>
#else
extern "C" {
# include <stdint.h>
};
#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 <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
}

#include "mp4.h"
Expand Down
15 changes: 13 additions & 2 deletions track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,25 @@
#ifndef __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS 1
#endif
#include <cstdint>
#if (__cplusplus >= 201103L)
# include <cstdint>
#else
extern "C" {
# include <stdint.h>
};
#endif
#ifndef INT64_C
# define INT64_C(c) (c ## LL)
# define UINT64_C(c) (c ## ULL)
#endif
#include <cstdbool> // 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 <libavcodec/avcodec.h>
#include <libavformat/avformat.h>

Expand Down

0 comments on commit 2c4a570

Please sign in to comment.