diff options
author | Peter Schlaile <peter@schlaile.de> | 2011-05-27 01:57:02 +0400 |
---|---|---|
committer | Peter Schlaile <peter@schlaile.de> | 2011-05-27 01:57:02 +0400 |
commit | 4b9a63c6d3b6fc90259bea708355d678d3681bc3 (patch) | |
tree | 383ebf3f75fdd8ef54103ccfd655f5a7cfd129c4 /source/gameengine | |
parent | 78b8e4a437b34a3956283dae08a6718a01b00e63 (diff) |
== FFMPEG ==
* removed a lot of old cruft code for ancient ffmpeg versions
* made it compile again against latest ffmpeg / libav GIT
(also shouldn't break distro ffmpegs, since those API changes
have been introduced over a year ago. If it nevertheless breaks,
please send me an email)
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/VideoTexture/VideoFFmpeg.cpp | 16 | ||||
-rw-r--r-- | source/gameengine/VideoTexture/VideoFFmpeg.h | 1 |
2 files changed, 9 insertions, 8 deletions
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp index 63dbc5bb7ba..f8274756c8b 100644 --- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp +++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp @@ -182,7 +182,7 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV { if(formatCtx->streams[i] && get_codec_from_stream(formatCtx->streams[i]) && - (get_codec_from_stream(formatCtx->streams[i])->codec_type==CODEC_TYPE_VIDEO)) + (get_codec_from_stream(formatCtx->streams[i])->codec_type==AVMEDIA_TYPE_VIDEO)) { videoStream=i; break; @@ -368,9 +368,9 @@ void *VideoFFmpeg::cacheThread(void *data) BLI_remlink(&video->m_packetCacheBase, cachePacket); // use m_frame because when caching, it is not used in main thread // we can't use currentFrame directly because we need to convert to RGB first - avcodec_decode_video(video->m_codecCtx, + avcodec_decode_video2(video->m_codecCtx, video->m_frame, &frameFinished, - cachePacket->packet.data, cachePacket->packet.size); + &cachePacket->packet); if(frameFinished) { AVFrame * input = video->m_frame; @@ -641,7 +641,7 @@ void VideoFFmpeg::openCam (char * file, short camIdx) if (m_captRate <= 0.f) m_captRate = defFrameRate; sprintf(rateStr, "%f", m_captRate); - av_parse_video_frame_rate(&frameRate, rateStr); + av_parse_video_rate(&frameRate, rateStr); // populate format parameters // need to specify the time base = inverse of rate formatParams.time_base.num = frameRate.den; @@ -924,10 +924,10 @@ AVFrame *VideoFFmpeg::grabFrame(long position) { if (packet.stream_index == m_videoStream) { - avcodec_decode_video( + avcodec_decode_video2( m_codecCtx, m_frame, &frameFinished, - packet.data, packet.size); + &packet); if (frameFinished) { m_curPosition = (long)((packet.dts-startTs) * (m_baseFrameRate*timeBase) + 0.5); @@ -999,9 +999,9 @@ AVFrame *VideoFFmpeg::grabFrame(long position) { if(packet.stream_index == m_videoStream) { - avcodec_decode_video(m_codecCtx, + avcodec_decode_video2(m_codecCtx, m_frame, &frameFinished, - packet.data, packet.size); + &packet); // remember dts to compute exact frame number dts = packet.dts; if (frameFinished && !posFound) diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.h b/source/gameengine/VideoTexture/VideoFFmpeg.h index 9b09c485329..f95c1198eaa 100644 --- a/source/gameengine/VideoTexture/VideoFFmpeg.h +++ b/source/gameengine/VideoTexture/VideoFFmpeg.h @@ -34,6 +34,7 @@ extern "C" { #include <libavformat/avformat.h> #include <libavcodec/avcodec.h> #include <libavutil/rational.h> +#include <libavutil/parseutils.h> #include <libswscale/swscale.h> #include "DNA_listBase.h" #include "BLI_threads.h" |