From a13fb0e8ca4c6e04e4a7a9937e8a6c88758cef1b Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 21 Dec 2016 17:33:22 +0100 Subject: [PATCH] Fix compilation issue with older ffmpeg versions --- panda/src/ffmpeg/ffmpegVideoCursor.cxx | 6 +++++- panda/src/ffmpeg/ffmpegVideoCursor.h | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.cxx b/panda/src/ffmpeg/ffmpegVideoCursor.cxx index 1829e003de..77598a3644 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.cxx +++ b/panda/src/ffmpeg/ffmpegVideoCursor.cxx @@ -46,6 +46,10 @@ PStatCollector FfmpegVideoCursor::_export_frame_pcollector("*:FFMPEG Convert Vid #define AV_PIX_FMT_BGRA PIX_FMT_BGRA #endif +#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 32, 100) +#define AV_PIX_FMT_FLAG_ALPHA PIX_FMT_FLAG_ALPHA +#endif + /** * This constructor is only used when reading from a bam file. */ @@ -512,7 +516,7 @@ open_stream() { AVCodec *pVideoCodec = NULL; if (ffmpeg_prefer_libvpx) { - if (_video_ctx->codec_id == AV_CODEC_ID_VP9) { + if ((int)_video_ctx->codec_id == 168) { // AV_CODEC_ID_VP9 pVideoCodec = avcodec_find_decoder_by_name("libvpx-vp9"); } else if (_video_ctx->codec_id == AV_CODEC_ID_VP8) { pVideoCodec = avcodec_find_decoder_by_name("libvpx"); diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.h b/panda/src/ffmpeg/ffmpegVideoCursor.h index 199b533f47..23cfda389b 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.h +++ b/panda/src/ffmpeg/ffmpegVideoCursor.h @@ -104,7 +104,12 @@ private: int _max_readahead_frames; ThreadPriority _thread_priority; PT(GenericThread) _thread; + +#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 74, 100) + PixelFormat _pixel_format; +#else AVPixelFormat _pixel_format; +#endif // This global Mutex protects calls to avcodec_opencloseetc. static ReMutex _av_lock;