|
From: Tapio V. <aa...@us...> - 2011-10-04 18:12:58
|
Author: Tapio Vierros <tap...@gm...>
Date: Tue Oct 4 21:11:14 2011 +0300
Fixed compile failure on newest ffmpeg version.
Courtesy of Vincent.
---
ffmpeg.cc | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/ffmpeg.cc b/ffmpeg.cc
index 7ae263a..365de0c 100644
--- a/ffmpeg.cc
+++ b/ffmpeg.cc
@@ -57,6 +57,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() {
QMutexLocker l(&s_avcodec_mutex);
av_register_all();
@@ -69,7 +75,7 @@ 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 (audioStream == -1 && cc->codec_type==CODEC_TYPE_AUDIO) audioStream = i;
+ if (audioStream == -1 && cc->codec_type==AVMEDIA_TYPE_AUDIO) audioStream = i;
}
if (audioStream == -1) throw std::runtime_error("No audio stream found");
AVCodecContext* cc = pFormatCtx->streams[audioStream]->codec;
|