Browse Source

Fix compilation issue with older ffmpeg versions

rdb 9 years ago
parent
commit
a13fb0e8ca
2 changed files with 10 additions and 1 deletions
  1. 5 1
      panda/src/ffmpeg/ffmpegVideoCursor.cxx
  2. 5 0
      panda/src/ffmpeg/ffmpegVideoCursor.h

+ 5 - 1
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");

+ 5 - 0
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;