From 3f3c3859c1c5f92937bef5d3398a37605e9c16ec Mon Sep 17 00:00:00 2001 From: "Markus Kitsinger (SwooshyCueb)" Date: Tue, 26 Apr 2016 21:32:38 -0500 Subject: [PATCH] Add some defines for ffmpeg 3.0 compatibility --- src/common/ffmpeg.cpp | 20 ++++++++++++++++++++ src/wx/cmdevents.cpp | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/src/common/ffmpeg.cpp b/src/common/ffmpeg.cpp index 9dd9b02b..aecdf650 100644 --- a/src/common/ffmpeg.cpp +++ b/src/common/ffmpeg.cpp @@ -53,6 +53,26 @@ static void avformat_free_context(AVFormatContext *ctx) #endif } +// For compatibility with 3.0+ ffmpeg +#include +#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_AVStream AVStream #define priv_AVOutputFormat AVOutputFormat diff --git a/src/wx/cmdevents.cpp b/src/wx/cmdevents.cpp index b315afed..b64f90fb 100644 --- a/src/wx/cmdevents.cpp +++ b/src/wx/cmdevents.cpp @@ -18,6 +18,11 @@ extern "C" { #include } +// For compatibility with 3.0+ ffmpeg +#include +#if LIBAVCODEC_VERSION_MAJOR > 56 +#define CODEC_ID_NONE AV_CODEC_ID_NONE +#endif #endif #include "../common/ConfigManager.h" #include "../gb/gbPrinter.h"