From 72a1a9820baf640fc9d06d6fd73f7f4785d4ce07 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 8 Jan 2017 17:50:48 -0500 Subject: [PATCH] Fix issues in ancient ffmpeg versions (Eg. Ubuntu Precise) --- panda/src/ffmpeg/ffmpegVideoCursor.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.cxx b/panda/src/ffmpeg/ffmpegVideoCursor.cxx index 8e2d0b0e47..c9cee499cd 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.cxx +++ b/panda/src/ffmpeg/ffmpegVideoCursor.cxx @@ -40,6 +40,10 @@ PStatCollector FfmpegVideoCursor::_export_frame_pcollector("*:FFMPEG Convert Vid #define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO #endif +#if LIBAVCODEC_VERSION_MAJOR < 54 +#define AV_CODEC_ID_VP8 CODEC_ID_VP8 +#endif + #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 74, 100) #define AV_PIX_FMT_NONE PIX_FMT_NONE #define AV_PIX_FMT_BGR24 PIX_FMT_BGR24 @@ -116,6 +120,7 @@ init_from(FfmpegVideo *source) { _eof_known = false; _eof_frame = 0; +#if LIBAVUTIL_VERSION_MAJOR >= 52 // Check if we got an alpha format. Please note that some video codecs // (eg. libvpx) change the pix_fmt after decoding the first frame, which is // why we didn't do this earlier. @@ -123,7 +128,9 @@ init_from(FfmpegVideo *source) { if (desc && (desc->flags & AV_PIX_FMT_FLAG_ALPHA) != 0) { _num_components = 4; _pixel_format = (int)AV_PIX_FMT_BGRA; - } else { + } else +#endif + { _num_components = 3; _pixel_format = (int)AV_PIX_FMT_BGR24; }