|
From: Yoda-JM <yo...@us...> - 2011-06-21 23:41:03
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Wed Jun 22 01:39:54 2011 +0200
Fixed compile failure on newest ffmpeg version (once again)
---
game/ffmpeg.cc | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index e565a04..61138cf 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -47,6 +47,12 @@ double FFmpeg::duration() const {
return d >= 0.0 ? d : getInf();
}
+// FFMPEG has fluctuating API
+#if LIBAVCODEC_VERSION_INT < ((52<<16)+(64<<8)+0)
+#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
+#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
+#endif
+
void FFmpeg::open() {
boost::mutex::scoped_lock l(s_avcodec_mutex);
av_register_all();
@@ -60,8 +66,8 @@ void FFmpeg::open() {
for (unsigned int i=0; i<pFormatCtx->nb_streams; i++) {
AVCodecContext* cc = pFormatCtx->streams[i]->codec;
cc->workaround_bugs = FF_BUG_AUTODETECT;
- if (videoStream == -1 && cc->codec_type==CODEC_TYPE_VIDEO) videoStream = i;
- if (audioStream == -1 && cc->codec_type==CODEC_TYPE_AUDIO) audioStream = i;
+ if (videoStream == -1 && cc->codec_type==AVMEDIA_TYPE_VIDEO) videoStream = i;
+ if (audioStream == -1 && cc->codec_type==AVMEDIA_TYPE_AUDIO) audioStream = i;
}
if (videoStream == -1 && decodeVideo) throw std::runtime_error("No video stream found");
if (audioStream == -1 && decodeAudio) throw std::runtime_error("No audio stream found");
|