|
From: Yoda-JM <yo...@us...> - 2009-10-09 09:40:13
|
Module: performous
Branch: master
Commit: 20144c78f4469978a537738519d1c4bf47b83d3c
Author: Vincent Le Ligeour <yo...@us...>
Date: Fri Oct 9 11:39:54 2009 +0200
Patched for yet another ffmpeg API change
---
editor/ffmpeg.cc | 8 ++++++++
game/ffmpeg.cc | 8 ++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/editor/ffmpeg.cc b/editor/ffmpeg.cc
index 1c167f4..1f0d80b 100644
--- a/editor/ffmpeg.cc
+++ b/editor/ffmpeg.cc
@@ -231,7 +231,11 @@ void FFmpeg::decodeNextFrame() {
while (packetSize) {
if (packetSize < 0) throw std::logic_error("negative video packet size?!");
if (m_quit || m_seekTarget == m_seekTarget) return;
+#if LIBAVCODEC_VERSION_INT > ((52<<16)+(25<<8)+0)
+ int decodeSize = avcodec_decode_video2(pVideoCodecCtx, videoFrame, &frameFinished, &packet);
+#else
int decodeSize = avcodec_decode_video(pVideoCodecCtx, videoFrame, &frameFinished, packetData, packetSize);
+#endif
if (decodeSize < 0) throw std::runtime_error("cannot decode video frame");
// Move forward within the packet
packetSize -= decodeSize;
@@ -259,7 +263,11 @@ void FFmpeg::decodeNextFrame() {
if (m_quit || m_seekTarget == m_seekTarget) return;
AudioBuffer audioFrames(AVCODEC_MAX_AUDIO_FRAME_SIZE);
int outsize = AVCODEC_MAX_AUDIO_FRAME_SIZE*sizeof(int16_t);
+#if LIBAVCODEC_VERSION_INT > ((52<<16)+(25<<8)+0)
+ int decodeSize = avcodec_decode_audio3(pAudioCodecCtx, audioFrames, &outsize, &packet);
+#else
int decodeSize = avcodec_decode_audio2(pAudioCodecCtx, audioFrames, &outsize, packetData, packetSize);
+#endif
// Handle special cases
if (decodeSize == 0) break;
if (outsize == 0) continue;
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 1c167f4..1f0d80b 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -231,7 +231,11 @@ void FFmpeg::decodeNextFrame() {
while (packetSize) {
if (packetSize < 0) throw std::logic_error("negative video packet size?!");
if (m_quit || m_seekTarget == m_seekTarget) return;
+#if LIBAVCODEC_VERSION_INT > ((52<<16)+(25<<8)+0)
+ int decodeSize = avcodec_decode_video2(pVideoCodecCtx, videoFrame, &frameFinished, &packet);
+#else
int decodeSize = avcodec_decode_video(pVideoCodecCtx, videoFrame, &frameFinished, packetData, packetSize);
+#endif
if (decodeSize < 0) throw std::runtime_error("cannot decode video frame");
// Move forward within the packet
packetSize -= decodeSize;
@@ -259,7 +263,11 @@ void FFmpeg::decodeNextFrame() {
if (m_quit || m_seekTarget == m_seekTarget) return;
AudioBuffer audioFrames(AVCODEC_MAX_AUDIO_FRAME_SIZE);
int outsize = AVCODEC_MAX_AUDIO_FRAME_SIZE*sizeof(int16_t);
+#if LIBAVCODEC_VERSION_INT > ((52<<16)+(25<<8)+0)
+ int decodeSize = avcodec_decode_audio3(pAudioCodecCtx, audioFrames, &outsize, &packet);
+#else
int decodeSize = avcodec_decode_audio2(pAudioCodecCtx, audioFrames, &outsize, packetData, packetSize);
+#endif
// Handle special cases
if (decodeSize == 0) break;
if (outsize == 0) continue;
|