From e20f861727332264fe9a8758e32acc486a02c642 Mon Sep 17 00:00:00 2001 From: AlexVinS Date: Wed, 11 Nov 2015 15:44:17 +0300 Subject: [PATCH] try to fix travis build. What an ancient version of ffmpeg does it have? --- client/CVideoHandler.cpp | 10 ---------- client/CVideoHandler.h | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/client/CVideoHandler.cpp b/client/CVideoHandler.cpp index 4c2cdb123..2be6eed85 100644 --- a/client/CVideoHandler.cpp +++ b/client/CVideoHandler.cpp @@ -142,14 +142,9 @@ bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay, bool scal return false; } // Allocate video frame -#ifdef VCMI_USE_OLD_AVUTIL - frame = avcodec_alloc_frame(); -#else frame = av_frame_alloc(); -#endif //setup scaling - if(scale) { pos.w = screen->w; @@ -362,12 +357,7 @@ void CVideoPlayer::close() if (frame) { -#ifdef VCMI_USE_OLD_AVUTIL - av_free(frame); - frame = nullptr; -#else av_frame_free(&frame);//will be set to null -#endif } if (codec) diff --git a/client/CVideoHandler.h b/client/CVideoHandler.h index 86a94b3e8..df3da0984 100644 --- a/client/CVideoHandler.h +++ b/client/CVideoHandler.h @@ -58,6 +58,30 @@ extern "C" { #define VCMI_USE_OLD_AVUTIL #endif // LIBSWSCALE_VERSION_INT +#ifdef VCMI_USE_OLD_AVUTIL + +#define AVPixelFormat PixelFormat +#define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P +#define AV_PIX_FMT_BGR565 PIX_FMT_BGR565 +#define AV_PIX_FMT_BGR24 PIX_FMT_BGR24 +#define AV_PIX_FMT_BGR32 PIX_FMT_BGR32 +#define AV_PIX_FMT_RGB565 PIX_FMT_RGB565 +#define AV_PIX_FMT_RGB24 PIX_FMT_RGB24 +#define AV_PIX_FMT_RGB32 PIX_FMT_RGB32 + +inline AVFrame * av_frame_alloc() +{ + return avcodec_alloc_frame(); +} + +inline void av_frame_free(AVFrame ** frame) +{ + av_free(*frame); + *frame = nullptr; +} + +#endif // VCMI_USE_OLD_AVUTIL + class CVideoPlayer : public IMainVideoPlayer { int stream; // stream index in video