From 48baa5c58e579d68b9a75dfeda6dcc90b5ffdee0 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 16 Sep 2013 07:21:06 +0000 Subject: [PATCH] ffmpeg compatibility fixes --- panda/src/ffmpeg/ffmpegAudioCursor.cxx | 8 ++++++-- panda/src/ffmpeg/ffmpegVirtualFile.cxx | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/panda/src/ffmpeg/ffmpegAudioCursor.cxx b/panda/src/ffmpeg/ffmpegAudioCursor.cxx index 4815ff5b14..022337da60 100644 --- a/panda/src/ffmpeg/ffmpegAudioCursor.cxx +++ b/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; } diff --git a/panda/src/ffmpeg/ffmpegVirtualFile.cxx b/panda/src/ffmpeg/ffmpegVirtualFile.cxx index 8cdb6edd60..e4be57b2ef 100644 --- a/panda/src/ffmpeg/ffmpegVirtualFile.cxx +++ b/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);