Browse Source

ffmpeg compatibility fixes

rdb 12 years ago
parent
commit
48baa5c58e
2 changed files with 9 additions and 5 deletions
  1. 6 2
      panda/src/ffmpeg/ffmpegAudioCursor.cxx
  2. 3 3
      panda/src/ffmpeg/ffmpegVirtualFile.cxx

+ 6 - 2
panda/src/ffmpeg/ffmpegAudioCursor.cxx

@@ -146,7 +146,7 @@ FfmpegAudioCursor(FfmpegAudio *src) :
   _can_seek = true;
   _can_seek_fast = true;
 
-  _frame = av_frame_alloc();
+  _frame = avcodec_alloc_frame();
 
   _packet = new AVPacket;
   _buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE / 2;
@@ -192,7 +192,11 @@ FfmpegAudioCursor::
 void FfmpegAudioCursor::
 cleanup() {
   if (_frame) {
-    av_frame_free(&_frame);
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 59, 100)
+    avcodec_free_frame(&_frame);
+#else
+    av_free(&_frame);
+#endif
     _frame = NULL;
   }
 

+ 3 - 3
panda/src/ffmpeg/ffmpegVirtualFile.cxx

@@ -115,7 +115,7 @@ open_vfs(const Filename &filename) {
 
   // Now we can open the stream.
   int result =
-#if LIBAVFORMAT_VERSION_INT > AV_VERSION_INT(53, 3, 0)
+#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 4, 0)
     avformat_open_input(&_format_context, "", NULL, NULL);
 #else
     av_open_input_file(&_format_context, "", NULL, 0, NULL);
@@ -166,7 +166,7 @@ open_subfile(const SubfileInfo &info) {
 
   // Now we can open the stream.
   int result =
-#if LIBAVFORMAT_VERSION_INT > AV_VERSION_INT(53, 3, 0)
+#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 4, 0)
     avformat_open_input(&_format_context, fname.c_str(), NULL, NULL);
 #else
     av_open_input_file(&_format_context, fname.c_str(), NULL, 0, NULL);
@@ -188,7 +188,7 @@ open_subfile(const SubfileInfo &info) {
 void FfmpegVirtualFile::
 close() {
   if (_format_context != NULL) {
-#if LIBAVFORMAT_VERSION_MAJOR >= 54
+#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 25, 0)
     avformat_close_input(&_format_context);
 #else
     av_close_input_file(_format_context);