[packages/blender] - partial fix for ffmpeg 3 - fix building on x32
baggins
baggins at pld-linux.org
Mon Mar 21 13:42:52 CET 2016
commit 33b0904f1ccb57e147a980f1775611c2c2acb01b
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Mon Mar 21 13:41:47 2016 +0100
- partial fix for ffmpeg 3
- fix building on x32
Example solution for remaining ffmpeg problems:
https://tvheadend.org/projects/tvheadend/repository/revisions/c63371c8bf51928a6c965bdf17dd73555b7b9d54/diff/
blender.spec | 4 +
ffmpeg3.patch | 299 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
x32.patch | 29 ++++++
3 files changed, 332 insertions(+)
---
diff --git a/blender.spec b/blender.spec
index 9ac66d9..c2e18bd 100644
--- a/blender.spec
+++ b/blender.spec
@@ -14,6 +14,8 @@ Source1: %{name}.desktop
Source2: %{name}.png
Source3: %{name}.manpage
Patch0: %{name}-2.76-droid.patch
+Patch1: x32.patch
+Patch2: ffmpeg3.patch
URL: http://www.blender.org/
BuildRequires: OpenAL-devel
BuildRequires: OpenEXR-devel
@@ -62,6 +64,8 @@ Blender to darmowy i w pełni funkcjonalny pakiet do tworzenia animacji
%prep
%setup -q
%patch0 -p1
+%patch1 -p1
+%patch2 -p1
%build
install -d build
diff --git a/ffmpeg3.patch b/ffmpeg3.patch
new file mode 100644
index 0000000..c2a793a
--- /dev/null
+++ b/ffmpeg3.patch
@@ -0,0 +1,299 @@
+--- blender-2.76/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp~ 2015-10-07 02:09:33.000000000 +0200
++++ blender-2.76/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp 2016-03-21 12:54:10.943584079 +0100
+@@ -58,9 +58,9 @@
+ got_frame = 0;
+
+ if(!frame)
+- frame = avcodec_alloc_frame();
++ frame = av_frame_alloc();
+ else
+- avcodec_get_frame_defaults(frame);
++ av_frame_unref(frame);
+
+ read_length = avcodec_decode_audio4(m_codecCtx, frame, &got_frame, &packet);
+ if(read_length < 0)
+--- blender-2.76/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp~ 2015-10-07 02:09:33.000000000 +0200
++++ blender-2.76/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp 2016-03-21 12:54:54.334128942 +0100
+@@ -202,7 +202,7 @@
+ m_frame = av_frame_alloc();
+ if (!m_frame)
+ AUD_THROW(AUD_ERROR_FFMPEG, codec_error);
+- avcodec_get_frame_defaults(m_frame);
++ av_frame_unref(m_frame);
+ m_frame->linesize[0] = m_input_size * samplesize;
+ m_frame->format = m_codecCtx->sample_fmt;
+ m_frame->nb_samples = m_input_size;
+--- blender-2.76/source/blender/blenkernel/intern/writeffmpeg.c.orig 2016-03-21 13:17:27.104210256 +0100
++++ blender-2.76/source/blender/blenkernel/intern/writeffmpeg.c 2016-03-21 13:19:51.459372230 +0100
+@@ -138,8 +138,8 @@
+ context->audio_time += (double) context->audio_input_samples / (double) c->sample_rate;
+
+ #ifdef FFMPEG_HAVE_ENCODE_AUDIO2
+- frame = avcodec_alloc_frame();
+- avcodec_get_frame_defaults(frame);
++ frame = av_frame_alloc();
++ av_frame_unref(frame);
+ frame->pts = context->audio_time / av_q2d(c->time_base);
+ frame->nb_samples = context->audio_input_samples;
+ frame->format = c->sample_fmt;
+@@ -172,7 +172,7 @@
+ }
+
+ if (!got_output) {
+- avcodec_free_frame(&frame);
++ av_frame_free(&frame);
+ return 0;
+ }
+ #else
+@@ -202,7 +202,7 @@
+ if (av_interleaved_write_frame(context->outfile, &pkt) != 0) {
+ fprintf(stderr, "Error writing audio packet!\n");
+ if (frame)
+- avcodec_free_frame(&frame);
++ av_frame_free(&frame);
+ return -1;
+ }
+
+@@ -210,7 +210,7 @@
+ }
+
+ if (frame)
+- avcodec_free_frame(&frame);
++ av_frame_free(&frame);
+
+ return 0;
+ }
+@@ -224,7 +224,7 @@
+ int size;
+
+ /* allocate space for the struct */
+- f = avcodec_alloc_frame();
++ f = av_frame_alloc();
+ if (!f) return NULL;
+ size = avpicture_get_size(pix_fmt, width, height);
+ /* allocate the actual picture buffer */
+@@ -363,8 +363,8 @@
+ int height = c->height;
+ AVFrame *rgb_frame;
+
+- if (c->pix_fmt != PIX_FMT_BGR32) {
+- rgb_frame = alloc_picture(PIX_FMT_BGR32, width, height);
++ if (c->pix_fmt != AV_PIX_FMT_BGR32) {
++ rgb_frame = alloc_picture(AV_PIX_FMT_BGR32, width, height);
+ if (!rgb_frame) {
+ BKE_report(reports, RPT_ERROR, "Could not allocate temporary frame");
+ return NULL;
+@@ -414,14 +414,14 @@
+ }
+ }
+
+- if (c->pix_fmt != PIX_FMT_BGR32) {
++ if (c->pix_fmt != AV_PIX_FMT_BGR32) {
+ sws_scale(context->img_convert_ctx, (const uint8_t *const *) rgb_frame->data,
+ rgb_frame->linesize, 0, c->height,
+ context->current_frame->data, context->current_frame->linesize);
+ delete_picture(rgb_frame);
+ }
+
+- context->current_frame->format = PIX_FMT_BGR32;
++ context->current_frame->format = AV_PIX_FMT_BGR32;
+ context->current_frame->width = width;
+ context->current_frame->height = height;
+
+@@ -586,12 +586,12 @@
+ }
+ else {
+ /* makes HuffYUV happy ... */
+- c->pix_fmt = PIX_FMT_YUV422P;
++ c->pix_fmt = AV_PIX_FMT_YUV422P;
+ }
+
+ if (context->ffmpeg_type == FFMPEG_XVID) {
+ /* arghhhh ... */
+- c->pix_fmt = PIX_FMT_YUV420P;
++ c->pix_fmt = AV_PIX_FMT_YUV420P;
+ c->codec_tag = (('D' << 24) + ('I' << 16) + ('V' << 8) + 'X');
+ }
+
+@@ -604,26 +604,26 @@
+ /* Keep lossless encodes in the RGB domain. */
+ if (codec_id == AV_CODEC_ID_HUFFYUV) {
+ if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
+- c->pix_fmt = PIX_FMT_BGRA;
++ c->pix_fmt = AV_PIX_FMT_BGRA;
+ }
+ else {
+- c->pix_fmt = PIX_FMT_RGB32;
++ c->pix_fmt = AV_PIX_FMT_RGB32;
+ }
+ }
+
+ if (codec_id == AV_CODEC_ID_FFV1) {
+- c->pix_fmt = PIX_FMT_RGB32;
++ c->pix_fmt = AV_PIX_FMT_RGB32;
+ }
+
+ if (codec_id == AV_CODEC_ID_QTRLE) {
+ if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
+- c->pix_fmt = PIX_FMT_ARGB;
++ c->pix_fmt = AV_PIX_FMT_ARGB;
+ }
+ }
+
+ if (codec_id == AV_CODEC_ID_PNG) {
+ if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
+- c->pix_fmt = PIX_FMT_RGBA;
++ c->pix_fmt = AV_PIX_FMT_RGBA;
+ }
+ }
+
+@@ -661,7 +661,7 @@
+
+ context->current_frame = alloc_picture(c->pix_fmt, c->width, c->height);
+
+- context->img_convert_ctx = sws_getContext(c->width, c->height, PIX_FMT_BGR32, c->width, c->height, c->pix_fmt, SWS_BICUBIC,
++ context->img_convert_ctx = sws_getContext(c->width, c->height, AV_PIX_FMT_BGR32, c->width, c->height, c->pix_fmt, SWS_BICUBIC,
+ NULL, NULL, NULL);
+ return st;
+ }
+--- blender-2.76/source/blender/imbuf/intern/anim_movie.c.orig 2016-03-21 13:22:18.224607392 +0100
++++ blender-2.76/source/blender/imbuf/intern/anim_movie.c 2016-03-21 13:34:53.607491392 +0100
+@@ -562,12 +562,12 @@
+ anim->next_pts = -1;
+ anim->next_packet.stream_index = -1;
+
+- anim->pFrame = avcodec_alloc_frame();
++ anim->pFrame = av_frame_alloc();
+ anim->pFrameComplete = false;
+- anim->pFrameDeinterlaced = avcodec_alloc_frame();
+- anim->pFrameRGB = avcodec_alloc_frame();
++ anim->pFrameDeinterlaced = av_frame_alloc();
++ anim->pFrameRGB = av_frame_alloc();
+
+- if (avpicture_get_size(PIX_FMT_RGBA, anim->x, anim->y) !=
++ if (avpicture_get_size(AV_PIX_FMT_RGBA, anim->x, anim->y) !=
+ anim->x * anim->y * 4)
+ {
+ fprintf(stderr,
+@@ -606,7 +606,7 @@
+ anim->pCodecCtx->pix_fmt,
+ anim->x,
+ anim->y,
+- PIX_FMT_RGBA,
++ AV_PIX_FMT_RGBA,
+ SWS_FAST_BILINEAR | SWS_PRINT_INFO | SWS_FULL_CHR_H_INT,
+ NULL, NULL, NULL);
+
+@@ -692,7 +692,7 @@
+
+ avpicture_fill((AVPicture *) anim->pFrameRGB,
+ (unsigned char *) ibuf->rect,
+- PIX_FMT_RGBA, anim->x, anim->y);
++ AV_PIX_FMT_RGBA, anim->x, anim->y);
+
+ if (ENDIAN_ORDER == B_ENDIAN) {
+ int *dstStride = anim->pFrameRGB->linesize;
+--- blender-2.76/source/blender/imbuf/intern/indexer.c~ 2015-10-07 02:09:33.000000000 +0200
++++ blender-2.76/source/blender/imbuf/intern/indexer.c 2016-03-21 13:36:25.235302331 +0100
+@@ -519,7 +519,7 @@
+ rv->c->pix_fmt = rv->codec->pix_fmts[0];
+ }
+ else {
+- rv->c->pix_fmt = PIX_FMT_YUVJ420P;
++ rv->c->pix_fmt = AV_PIX_FMT_YUVJ420P;
+ }
+
+ rv->c->sample_aspect_ratio =
+@@ -554,7 +554,7 @@
+ if (st->codec->width != width || st->codec->height != height ||
+ st->codec->pix_fmt != rv->c->pix_fmt)
+ {
+- rv->frame = avcodec_alloc_frame();
++ rv->frame = av_frame_alloc();
+ avpicture_fill((AVPicture *) rv->frame,
+ MEM_mallocN(avpicture_get_size(
+ rv->c->pix_fmt,
+@@ -905,7 +905,7 @@
+
+ memset(&next_packet, 0, sizeof(AVPacket));
+
+- in_frame = avcodec_alloc_frame();
++ in_frame = av_frame_alloc();
+
+ stream_size = avio_size(context->iFormatCtx->pb);
+
+--- blender-2.76/source/gameengine/VideoTexture/VideoFFmpeg.cpp~ 2015-10-12 00:58:22.000000000 +0200
++++ blender-2.76/source/gameengine/VideoTexture/VideoFFmpeg.cpp 2016-03-21 13:38:33.813572152 +0100
+@@ -140,23 +140,23 @@
+ AVFrame *VideoFFmpeg::allocFrameRGB()
+ {
+ AVFrame *frame;
+- frame = avcodec_alloc_frame();
++ frame = av_frame_alloc();
+ if (m_format == RGBA32)
+ {
+ avpicture_fill((AVPicture*)frame,
+ (uint8_t*)MEM_callocN(avpicture_get_size(
+- PIX_FMT_RGBA,
++ AV_PIX_FMT_RGBA,
+ m_codecCtx->width, m_codecCtx->height),
+ "ffmpeg rgba"),
+- PIX_FMT_RGBA, m_codecCtx->width, m_codecCtx->height);
++ AV_PIX_FMT_RGBA, m_codecCtx->width, m_codecCtx->height);
+ } else
+ {
+ avpicture_fill((AVPicture*)frame,
+ (uint8_t*)MEM_callocN(avpicture_get_size(
+- PIX_FMT_RGB24,
++ AV_PIX_FMT_RGB24,
+ m_codecCtx->width, m_codecCtx->height),
+ "ffmpeg rgb"),
+- PIX_FMT_RGB24, m_codecCtx->width, m_codecCtx->height);
++ AV_PIX_FMT_RGB24, m_codecCtx->width, m_codecCtx->height);
+ }
+ return frame;
+ }
+@@ -236,8 +236,8 @@
+ m_codecCtx = codecCtx;
+ m_formatCtx = formatCtx;
+ m_videoStream = videoStream;
+- m_frame = avcodec_alloc_frame();
+- m_frameDeinterlaced = avcodec_alloc_frame();
++ m_frame = av_frame_alloc();
++ m_frameDeinterlaced = av_frame_alloc();
+
+ // allocate buffer if deinterlacing is required
+ avpicture_fill((AVPicture*)m_frameDeinterlaced,
+@@ -248,10 +248,10 @@
+ m_codecCtx->pix_fmt, m_codecCtx->width, m_codecCtx->height);
+
+ // check if the pixel format supports Alpha
+- if (m_codecCtx->pix_fmt == PIX_FMT_RGB32 ||
+- m_codecCtx->pix_fmt == PIX_FMT_BGR32 ||
+- m_codecCtx->pix_fmt == PIX_FMT_RGB32_1 ||
+- m_codecCtx->pix_fmt == PIX_FMT_BGR32_1)
++ if (m_codecCtx->pix_fmt == AV_PIX_FMT_RGB32 ||
++ m_codecCtx->pix_fmt == AV_PIX_FMT_BGR32 ||
++ m_codecCtx->pix_fmt == AV_PIX_FMT_RGB32_1 ||
++ m_codecCtx->pix_fmt == AV_PIX_FMT_BGR32_1)
+ {
+ // allocate buffer to store final decoded frame
+ m_format = RGBA32;
+@@ -262,7 +262,7 @@
+ m_codecCtx->pix_fmt,
+ m_codecCtx->width,
+ m_codecCtx->height,
+- PIX_FMT_RGBA,
++ AV_PIX_FMT_RGBA,
+ SWS_FAST_BILINEAR,
+ NULL, NULL, NULL);
+ } else
+@@ -276,7 +276,7 @@
+ m_codecCtx->pix_fmt,
+ m_codecCtx->width,
+ m_codecCtx->height,
+- PIX_FMT_RGB24,
++ AV_PIX_FMT_RGB24,
+ SWS_FAST_BILINEAR,
+ NULL, NULL, NULL);
+ }
diff --git a/x32.patch b/x32.patch
new file mode 100644
index 0000000..5eb3c7f
--- /dev/null
+++ b/x32.patch
@@ -0,0 +1,29 @@
+--- blender-2.76/intern/cycles/util/util_simd.h.orig 2016-03-21 13:06:35.312841949 +0100
++++ blender-2.76/intern/cycles/util/util_simd.h 2016-03-21 13:07:38.880293791 +0100
+@@ -229,7 +229,7 @@
+ int r = 0; asm ("btr %1,%0" : "=r"(r) : "r"(i), "0"(v) : "flags"); return r;
+ }
+
+-#if defined(__KERNEL_64_BIT__) || defined(__APPLE__)
++#if (defined(__KERNEL_64_BIT__) && !defined(__ILP32__)) || defined(__APPLE__)
+ __forceinline size_t __bsf(size_t v) {
+ size_t r = 0; asm ("bsf %1,%0" : "=r"(r) : "r"(v)); return r;
+ }
+@@ -271,7 +271,7 @@
+ #endif
+ }
+
+-#if defined(__KERNEL_64_BIT__) || defined(__APPLE__)
++#if (defined(__KERNEL_64_BIT__) && !defined(__ILP32__)) || defined(__APPLE__)
+ __forceinline size_t bitscan(size_t v) {
+ #if defined(__KERNEL_AVX2__)
+ #if defined(__KERNEL_64_BIT__)
+@@ -313,7 +313,7 @@
+ return i;
+ }
+
+-#if defined(__KERNEL_64_BIT__) || defined(__APPLE__)
++#if (defined(__KERNEL_64_BIT__) && !defined(__ILP32__)) || defined(__APPLE__)
+ __forceinline size_t __bscf(size_t& v)
+ {
+ size_t i = bitscan(v);
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/blender.git/commitdiff/33b0904f1ccb57e147a980f1775611c2c2acb01b
More information about the pld-cvs-commit
mailing list