From 615c5232c7b2e51f9722fdff58e04ae53c043797 Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Sun, 22 Mar 2009 19:19:21 +0000 Subject: [PATCH] == FFMPEG == Updated ffmpeg to release version 0.5 updated x264 to today's daily build thanks to ben2610 for first patches (but you got hddaudio.c wrong :) --- config/darwin-config.py | 6 +--- config/linux2-config.py | 7 +---- .../blender/blenkernel/intern/writeffmpeg.c | 28 ++++++++++--------- source/blender/imbuf/intern/IMB_anim.h | 6 ++-- source/blender/imbuf/intern/anim.c | 8 +++--- source/blender/imbuf/intern/util.c | 8 +++--- source/blender/src/buttons_scene.c | 6 ++-- source/blender/src/hddaudio.c | 12 ++++---- source/gameengine/VideoTexture/VideoFFmpeg.h | 8 +++--- 9 files changed, 42 insertions(+), 47 deletions(-) diff --git a/config/darwin-config.py b/config/darwin-config.py index cfd6a9395bb..39c9b9df4ff 100644 --- a/config/darwin-config.py +++ b/config/darwin-config.py @@ -40,11 +40,7 @@ else: # enable ffmpeg support WITH_BF_FFMPEG = True # -DWITH_FFMPEG BF_FFMPEG = "#extern/ffmpeg" -# trick : The version of ffmpeg in extern/ffmpeg uses explicit libav.. directory in #include statements -# To keep Blender compatible with older versions, I add ${BF_FFMPEG} to the inc dir so that ffmpeg -# finds the files directly in extern/ffmpeg/libav... while blender finds them in -# extern/ffmpeg/include. -BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}' +BF_FFMPEG_INC = '${BF_FFMPEG}' if USE_SDK==True: BF_FFMPEG_EXTRA = '-isysroot '+MACOSX_SDK+' -mmacosx-version-min='+MAC_MIN_VERS #BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib' diff --git a/config/linux2-config.py b/config/linux2-config.py index 6ba3052048d..102bb2e5e4c 100644 --- a/config/linux2-config.py +++ b/config/linux2-config.py @@ -140,12 +140,7 @@ BF_FFMPEG_LIB = '' # Uncomment the following two lines to use system's ffmpeg # BF_FFMPEG = '/usr' # BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice' -# trick : The version of ffmpeg in extern/ffmpeg uses explicit libav.. directory in #include statements -# To keep Blender compatible with older version, I add ${BF_FFMPEG} to the inc dir so that ffmpeg -# finds the files directly in extern/ffmpeg/libav... while blender finds them in -# extern/ffmpeg/include. When using system ffmpeg, you don't need that, assuming the system library -# still use the flat directory model, otherwise will not compile anyway -BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}' +BF_FFMPEG_INC = '${BF_FFMPEG}' BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib' # enable ogg, vorbis and theora in ffmpeg diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index cef6f802729..378e4319223 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -29,11 +29,11 @@ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #if LIBAVFORMAT_VERSION_INT < (49 << 16) #define FFMPEG_OLD_FRAME_RATE 1 @@ -290,8 +290,8 @@ static AVFrame* generate_video_frame(uint8_t* pixels) int height = c->height; AVFrame* rgb_frame; - if (c->pix_fmt != PIX_FMT_RGBA32) { - rgb_frame = alloc_picture(PIX_FMT_RGBA32, width, height); + if (c->pix_fmt != PIX_FMT_BGR32) { + rgb_frame = alloc_picture(PIX_FMT_BGR32, width, height); if (!rgb_frame) { G.afbreek=1; error("Couldn't allocate temporary frame"); @@ -342,7 +342,7 @@ static AVFrame* generate_video_frame(uint8_t* pixels) } } - if (c->pix_fmt != PIX_FMT_RGBA32) { + if (c->pix_fmt != PIX_FMT_BGR32) { sws_scale(img_convert_ctx, rgb_frame->data, rgb_frame->linesize, 0, c->height, current_frame->data, current_frame->linesize); @@ -498,9 +498,11 @@ static AVStream* alloc_video_stream(int codec_id, AVFormatContext* of, c->pix_fmt = PIX_FMT_YUV420P; } - if (!strcmp(of->oformat->name, "mp4") || - !strcmp(of->oformat->name, "mov") || - !strcmp(of->oformat->name, "3gp")) { + if ((of->oformat->flags & AVFMT_GLOBALHEADER) +// || !strcmp(of->oformat->name, "mp4") +// || !strcmp(of->oformat->name, "mov") +// || !strcmp(of->oformat->name, "3gp") + ) { fprintf(stderr, "Using global header\n"); c->flags |= CODEC_FLAG_GLOBAL_HEADER; } @@ -514,7 +516,7 @@ static AVStream* alloc_video_stream(int codec_id, AVFormatContext* of, /* xasp & yasp got float lately... */ - c->sample_aspect_ratio = av_d2q( + st->sample_aspect_ratio = c->sample_aspect_ratio = av_d2q( ((double) G.scene->r.xasp / (double) G.scene->r.yasp), 255); set_ffmpeg_properties(c, "video"); @@ -531,7 +533,7 @@ static AVStream* alloc_video_stream(int codec_id, AVFormatContext* of, current_frame = alloc_picture(c->pix_fmt, c->width, c->height); img_convert_ctx = sws_getContext(c->width, c->height, - PIX_FMT_RGBA32, + PIX_FMT_BGR32, c->width, c->height, c->pix_fmt, SWS_BICUBIC, diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h index 745248d3218..7e99df8237a 100644 --- a/source/blender/imbuf/intern/IMB_anim.h +++ b/source/blender/imbuf/intern/IMB_anim.h @@ -76,9 +76,9 @@ #endif /* WITH_QUICKTIME */ #ifdef WITH_FFMPEG -#include -#include -#include +#include +#include +#include #endif #ifdef WITH_REDCODE diff --git a/source/blender/imbuf/intern/anim.c b/source/blender/imbuf/intern/anim.c index 80bf401bec0..42fe47cc5e9 100644 --- a/source/blender/imbuf/intern/anim.c +++ b/source/blender/imbuf/intern/anim.c @@ -83,10 +83,10 @@ #include "IMB_anim5.h" #ifdef WITH_FFMPEG -#include -#include -#include -#include +#include +#include +#include +#include #if LIBAVFORMAT_VERSION_INT < (49 << 16) #define FFMPEG_OLD_FRAME_RATE 1 diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index 15d1d031dbd..ffd5d3431af 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -73,10 +73,10 @@ #endif #ifdef WITH_FFMPEG -#include -#include -#include -#include +#include +#include +#include +#include #if LIBAVFORMAT_VERSION_INT < (49 << 16) #define FFMPEG_OLD_FRAME_RATE 1 diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c index 376a57b11e9..be988c5a68a 100644 --- a/source/blender/src/buttons_scene.c +++ b/source/blender/src/buttons_scene.c @@ -109,9 +109,9 @@ #ifdef WITH_FFMPEG -#include /* for PIX_FMT_* and CODEC_ID_* */ -#include -#include +#include /* for PIX_FMT_* and CODEC_ID_* */ +#include +#include static int ffmpeg_preset_sel = 0; diff --git a/source/blender/src/hddaudio.c b/source/blender/src/hddaudio.c index 7e6b314f296..7175f140b09 100644 --- a/source/blender/src/hddaudio.c +++ b/source/blender/src/hddaudio.c @@ -33,9 +33,9 @@ #endif #ifdef WITH_FFMPEG -#include -#include -#include +#include +#include +#include #if LIBAVFORMAT_VERSION_INT < (49 << 16) #define FFMPEG_OLD_FRAME_RATE 1 #else @@ -311,7 +311,8 @@ static void sound_hdaudio_extract_small_block( audio_pkt_size = packet.size; while (audio_pkt_size > 0) { - len = avcodec_decode_audio( + data_size=AVCODEC_MAX_AUDIO_FRAME_SIZE; + len = avcodec_decode_audio2( hdaudio->pCodecCtx, hdaudio->decode_cache + decode_pos, @@ -478,7 +479,8 @@ static void sound_hdaudio_extract_small_block( } while (audio_pkt_size > 0) { - len = avcodec_decode_audio( + data_size=AVCODEC_MAX_AUDIO_FRAME_SIZE; + len = avcodec_decode_audio2( hdaudio->pCodecCtx, hdaudio->decode_cache + decode_pos, diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.h b/source/gameengine/VideoTexture/VideoFFmpeg.h index 51ce2c4eebe..51f1067c466 100644 --- a/source/gameengine/VideoTexture/VideoFFmpeg.h +++ b/source/gameengine/VideoTexture/VideoFFmpeg.h @@ -25,10 +25,10 @@ http://www.gnu.org/copyleft/lesser.txt. #ifdef WITH_FFMPEG extern "C" { #include -#include -#include -#include -#include +#include +#include +#include +#include #include "DNA_listBase.h" #include "BLI_threads.h" #include "BLI_blenlib.h"