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/blender/imbuf/intern | |
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/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/anim_movie.c | 14 | ||||
-rw-r--r-- | source/blender/imbuf/intern/util.c | 28 |
2 files changed, 11 insertions, 31 deletions
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 4de96bb17bc..ba7d2541cae 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -559,14 +559,14 @@ static int startffmpeg(struct anim * anim) { return -1; } - dump_format(pFormatCtx, 0, anim->name, 0); + av_dump_format(pFormatCtx, 0, anim->name, 0); /* Find the first video stream */ videoStream=-1; for(i=0; i<pFormatCtx->nb_streams; i++) if(get_codec_from_stream(pFormatCtx->streams[i])->codec_type - == CODEC_TYPE_VIDEO) { + == AVMEDIA_TYPE_VIDEO) { videoStream=i; break; } @@ -830,10 +830,10 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) { && position - (anim->curposition + 1) < anim->preseek) { while(av_read_frame(anim->pFormatCtx, &packet)>=0) { if (packet.stream_index == anim->videoStream) { - avcodec_decode_video( + avcodec_decode_video2( anim->pCodecCtx, anim->pFrame, &frameFinished, - packet.data, packet.size); + &packet); if (frameFinished) { anim->curposition++; @@ -915,9 +915,9 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) { while(av_read_frame(anim->pFormatCtx, &packet)>=0) { if(packet.stream_index == anim->videoStream) { - avcodec_decode_video(anim->pCodecCtx, - anim->pFrame, &frameFinished, - packet.data, packet.size); + avcodec_decode_video2(anim->pCodecCtx, + anim->pFrame, &frameFinished, + &packet); if (seek_by_bytes && preseek_count > 0) { preseek_count--; diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index 3e4136cbef9..879ed37cc50 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -62,13 +62,6 @@ #include <libavformat/avformat.h> #include <libavdevice/avdevice.h> #include <libavutil/log.h> - -#if LIBAVFORMAT_VERSION_INT < (49 << 16) -#define FFMPEG_OLD_FRAME_RATE 1 -#else -#define FFMPEG_CODEC_IS_POINTER 1 -#endif - #endif #define UTIL_DEBUG 0 @@ -241,19 +234,6 @@ void do_init_ffmpeg(void) } } -#ifdef FFMPEG_CODEC_IS_POINTER -static AVCodecContext* get_codec_from_stream(AVStream* stream) -{ - return stream->codec; -} -#else -static AVCodecContext* get_codec_from_stream(AVStream* stream) -{ - return &stream->codec; -} -#endif - - static int isffmpeg (const char *filename) { AVFormatContext *pFormatCtx; unsigned int i; @@ -284,15 +264,15 @@ static int isffmpeg (const char *filename) { return 0; } - if(UTIL_DEBUG) dump_format(pFormatCtx, 0, filename, 0); + if(UTIL_DEBUG) av_dump_format(pFormatCtx, 0, filename, 0); /* Find the first video stream */ videoStream=-1; for(i=0; i<pFormatCtx->nb_streams; i++) if(pFormatCtx->streams[i] && - get_codec_from_stream(pFormatCtx->streams[i]) && - (get_codec_from_stream(pFormatCtx->streams[i])->codec_type==CODEC_TYPE_VIDEO)) + pFormatCtx->streams[i]->codec && + (pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO)) { videoStream=i; break; @@ -303,7 +283,7 @@ static int isffmpeg (const char *filename) { return 0; } - pCodecCtx = get_codec_from_stream(pFormatCtx->streams[videoStream]); + pCodecCtx = pFormatCtx->streams[videoStream]->codec; /* Find the decoder for the video stream */ pCodec=avcodec_find_decoder(pCodecCtx->codec_id); |