Add some defines for ffmpeg 3.0 compatibility

This commit is contained in:
Markus Kitsinger (SwooshyCueb) 2016-04-26 21:32:38 -05:00
parent 48770219fa
commit 3f3c3859c1
2 changed files with 25 additions and 0 deletions

View File

@ -53,6 +53,26 @@ static void avformat_free_context(AVFormatContext *ctx)
#endif #endif
} }
// For compatibility with 3.0+ ffmpeg
#include <libavutil/version.h>
#ifndef PixelFormat
#define PixelFormat AVPixelFormat
#endif
#if LIBAVCODEC_VERSION_MAJOR > 56
#define CODEC_ID_NONE AV_CODEC_ID_NONE
#define CODEC_ID_PCM_S16LE AV_CODEC_ID_PCM_S16LE
#define CODEC_ID_PCM_S16BE AV_CODEC_ID_PCM_S16BE
#define CODEC_ID_PCM_U16LE AV_CODEC_ID_PCM_U16LE
#define CODEC_ID_PCM_U16BE AV_CODEC_ID_PCM_U16BE
#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
#endif
#if LIBAVUTIL_VERSION_MAJOR > 54
#define avcodec_alloc_frame av_frame_alloc
#define PIX_FMT_RGB565LE AV_PIX_FMT_RGB565LE
#define PIX_FMT_RGB24 AV_PIX_FMT_RGB24
#define PIX_FMT_RGBA AV_PIX_FMT_RGBA
#endif
#define priv_AVFormatContext AVFormatContext #define priv_AVFormatContext AVFormatContext
#define priv_AVStream AVStream #define priv_AVStream AVStream
#define priv_AVOutputFormat AVOutputFormat #define priv_AVOutputFormat AVOutputFormat

View File

@ -18,6 +18,11 @@
extern "C" { extern "C" {
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
} }
// For compatibility with 3.0+ ffmpeg
#include <libavcodec/version.h>
#if LIBAVCODEC_VERSION_MAJOR > 56
#define CODEC_ID_NONE AV_CODEC_ID_NONE
#endif
#endif #endif
#include "../common/ConfigManager.h" #include "../common/ConfigManager.h"
#include "../gb/gbPrinter.h" #include "../gb/gbPrinter.h"