* update blender to 17:4.1.1-9

This commit is contained in:
Alexander Baldeck 2024-07-10 12:29:38 +02:00
parent 3d77ea102d
commit 59646c4c2d
4 changed files with 296 additions and 11 deletions

View File

@ -10,7 +10,7 @@
pkgname=blender
pkgver=4.1.1
pkgrel=1
pkgrel=9
epoch=17
pkgdesc="A fully integrated 3D graphics creation suite"
arch=(x86_64 powerpc64le)
@ -98,6 +98,7 @@ makedepends=(
'boost'
'cmake'
'git'
'git-lfs'
'hip-runtime-amd'
'level-zero-headers'
'libdecor'
@ -126,27 +127,35 @@ options=('!lto')
source=("git+https://projects.blender.org/blender/blender.git#tag=v$pkgver"
"git+https://projects.blender.org/blender/blender-addons.git#tag=v$pkgver"
"git+https://projects.blender.org/blender/blender-addons-contrib#tag=v$pkgver"
"svn+https://svn.blender.org/svnroot/bf-blender/tags/blender-${pkgver%%.[^.]}-release/lib/assets"
"git+https://projects.blender.org/blender/blender-assets#tag=v$pkgver"
https://developer.download.nvidia.com/redist/optix/v8.0/OptiX-8.0-Include.zip
force-draco1.patch
force-draco2.patch)
force-draco2.patch
blender-4.11-mantaflow-python-3.12.patch
ffmpeg-7-1.patch
ffmpeg-7-2.patch)
sha512sums=('194274ee62c2a3b96e81af92520d424fb7bda24902cffcf2cd9a2e343c0627fe74cdd08d52709c8f181df72f7e36fc64f6144412c459f5a5a0b4497babd2fe07'
'4476c93942e5efc5a8ee7c4ef1caea2e77dc6e40eb825e35c0120f7e9f714ff8bdb873bb83d47ac27f8616eedac8e52f15804ed603c093044490f89e626baa80'
'877ed9ced417c5879b0bc6a7d3d87aa68a3e4015df9c08945c468dfab59a513bdd03523b7593e556fc9d0e22dbad25d980238e25583ea34a77ffcae3693cd0e7'
'SKIP'
'2eaa05da22d4a304d1db310bd8c04358e70fdd927cbaadd574e179a86bf288c7b4fa1188d15f1928788ce9c5d2b15b512d47743a230e703f44c07cb7bbc39c5b'
'5502d9df847de12badc702c0444bd4f1f7620460b2235026df2c3133da1e04c148af0f1fc7f345e9a0c009c32f905f66c8d427743445e8864d3a797cdce6a483'
'e239da4f3906f1b54265435181cf770bae3d269c8d915df9a73861e6ee71ec70bf2339426e7c81a91e5a567273b3b3742d7a99feefd3398d821b26e1ff3a56d0'
'c162646eba42ea7112cfb615466c2cbaddac8d254d4a9e91cf887c5bffef1325a983701163223a1fdee091310ac5574a400347aab7f52321825b5fa3d5a9036f')
'c162646eba42ea7112cfb615466c2cbaddac8d254d4a9e91cf887c5bffef1325a983701163223a1fdee091310ac5574a400347aab7f52321825b5fa3d5a9036f'
'59044954880ce94d7a1da78ccd03e61a9d23382281b2221ca5c9c7eec9caeecf810d10ee07940d5843b7540fa81c00df5a26e8076605410116815e73c60ab9b9'
'ce67f8cb4857f3cc98759f00c226e1e0f81578a656e5772bd016fd0eee387f1fc0bc8e44b54e4ddef4df226d416f4ba2f7ef9e7ad02db36c968e727c986e3c4e'
'e1522345d6119ad396f27293b5f67b3a6d1b7352791186a04aeb654f285eeae873937f124461ff8dc9fc8ac5ae820cd8254bd4c3b64dcc06f1e41bee45f9bbe9')
prepare() {
cd "$pkgname"
git submodule init
git config submodule.release/datafiles/assets.url "$srcdir/blender-assets"
git -c protocol.file.allow=always submodule update
# Create expected path for assets
mkdir -p "$srcdir"/lib
# Copy assets to expected location
cp -r "$srcdir"/assets "$srcdir"/lib/assets
# Remove this directory to prevent it being packaged
rm -r "$srcdir"/lib/assets/.makepkg/
# Fetch assets from git-lfs
git -C release/datafiles/assets lfs install --local
git -C release/datafiles/assets remote add network-origin https://projects.blender.org/blender/blender-assets
git -C release/datafiles/assets lfs fetch network-origin
git -C release/datafiles/assets lfs checkout
# Copy addons to expected location
cp -r "$srcdir"/blender-addons scripts/addons
@ -155,6 +164,14 @@ prepare() {
# fix draco
patch -p1 -i "$srcdir"/force-draco1.patch
patch -p1 -d scripts/addons -i "$srcdir"/force-draco2.patch
# fix fluid sim domain with python 3.12
# https://gitlab.archlinux.org/archlinux/packaging/packages/blender/-/issues/18
patch -p1 -i "$srcdir"/blender-4.11-mantaflow-python-3.12.patch
# fix build with ffmpeg 7
patch -p1 -i ../ffmpeg-7-1.patch
patch -p1 -i ../ffmpeg-7-2.patch
}
_get_pyver() {
@ -162,6 +179,9 @@ _get_pyver() {
}
build() {
# This should fix #13.
export CXXFLAGS=${CXXFLAGS/-Wp,-D_GLIBCXX_ASSERTIONS/}
local cmake_options=(
-B build
-C "$pkgname/build_files/cmake/config/blender_release.cmake"

View File

@ -0,0 +1,14 @@
diff --git a/extern/mantaflow/helper/pwrapper/registry.cpp b/extern/mantaflow/helper/pwrapper/registry.cpp
index b4206a41dea..bd83eb28116 100644
--- a/extern/mantaflow/helper/pwrapper/registry.cpp
+++ b/extern/mantaflow/helper/pwrapper/registry.cpp
@@ -576,7 +576,8 @@ void WrapperRegistry::construct(const string &scriptname, const vector<string> &
registerDummyTypes();
// work around for certain gcc versions, cast to char*
- PyImport_AppendInittab((char *)gDefaultModuleName.c_str(), PyInit_manta_main);
+ if (!Py_IsInitialized())
+ PyImport_AppendInittab((char *)gDefaultModuleName.c_str(), PyInit_manta_main);
}
inline PyObject *castPy(PyTypeObject *p)

67
blender/ffmpeg-7-1.patch Normal file
View File

@ -0,0 +1,67 @@
From c72dbeafffa5b3262e90023e092bb1f9928d7079 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
Date: Tue, 14 May 2024 11:03:49 +0200
Subject: [PATCH] Add compatibility with FFMPEG 7.0
key_frame was deprecated then remove, we should use AV_FRAME_FLAG_KEY
instead.
read_seek2 and read_seek were internalized and can't be used anymore, so
we check directly the return of av_seek_frame.
---
intern/ffmpeg/ffmpeg_compat.h | 9 +++++++++
source/blender/imbuf/intern/anim_movie.cc | 11 +++++------
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h
index 91ea1701db6..78778482e8d 100644
--- a/intern/ffmpeg/ffmpeg_compat.h
+++ b/intern/ffmpeg/ffmpeg_compat.h
@@ -141,6 +141,15 @@ int64_t av_get_frame_duration_in_pts_units(const AVFrame *picture)
#endif
}
+FFMPEG_INLINE
+bool av_get_cur_key_frame_pts(const AVFrame *picture) {
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(58, 29, 100)
+ return (picture->flags & AV_FRAME_FLAG_KEY);
+#else
+ return (picture->key_frame);
+#endif
+}
+
/* -------------------------------------------------------------------- */
/** \name Deinterlace code block
*
diff --git a/source/blender/imbuf/intern/anim_movie.cc b/source/blender/imbuf/intern/anim_movie.cc
index 3d51969dd46..bb07a8bb14c 100644
--- a/source/blender/imbuf/intern/anim_movie.cc
+++ b/source/blender/imbuf/intern/anim_movie.cc
@@ -653,7 +653,7 @@ static void ffmpeg_decode_store_frame_pts(ImBufAnim *anim)
{
anim->cur_pts = av_get_pts_from_frame(anim->pFrame);
- if (anim->pFrame->key_frame) {
+ if (av_get_cur_key_frame_pts(anim->pFrame)) {
anim->cur_key_frame_pts = anim->cur_pts;
}
@@ -1032,11 +1032,10 @@ static int ffmpeg_seek_to_key_frame(ImBufAnim *anim,
AVFormatContext *format_ctx = anim->pFormatCtx;
- if (format_ctx->iformat->read_seek2 || format_ctx->iformat->read_seek) {
- ret = av_seek_frame(anim->pFormatCtx, anim->videoStream, seek_pos, AVSEEK_FLAG_BACKWARD);
- }
- else {
- ret = ffmpeg_generic_seek_workaround(anim, &seek_pos, pts_to_search);
+ int ret = av_seek_frame(anim->pFormatCtx, anim->videoStream, seek_pos, AVSEEK_FLAG_BACKWARD);
+
+ if (ret < 0) {
+ ret = ffmpeg_generic_seek_workaround(anim, &seek_pos, pts_to_search);\
av_log(anim->pFormatCtx,
AV_LOG_DEBUG,
"Adjusted final seek seek_pos = %" PRId64 "\n",
--
2.30.2

184
blender/ffmpeg-7-2.patch Normal file
View File

@ -0,0 +1,184 @@
From fc8955ebbbb5d0afde2722b836dec8b4e07f2232 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
Date: Sat, 18 May 2024 22:08:34 +0200
Subject: [PATCH] Add compatibility with FFmpeg 7.0 within audaspace plugin
We backport changes specific to FFmpeg 7.0 in audaspace, behind
HAVE_CH_LAYOUT, ensuring compatibility with previous versions.
---
.../audaspace/plugins/ffmpeg/FFMPEGReader.cpp | 27 +++++++++--
.../audaspace/plugins/ffmpeg/FFMPEGWriter.cpp | 46 +++++++++++++++++++
2 files changed, 69 insertions(+), 4 deletions(-)
diff --git a/extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp b/extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp
index c0e16d6a887..3257daab442 100644
--- a/extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp
+++ b/extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp
@@ -31,6 +31,10 @@ AUD_NAMESPACE_BEGIN
#define FFMPEG_OLD_CODE
#endif
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100)
+#define HAVE_CH_LAYOUT
+#endif
+
SampleFormat FFMPEGReader::convertSampleFormat(AVSampleFormat format)
{
switch(av_get_packed_sample_fmt(format))
@@ -104,15 +108,22 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
packet.size = orig_size;
#else
avcodec_send_packet(m_codecCtx, &packet);
+
while(true)
{
auto ret = avcodec_receive_frame(m_codecCtx, m_frame);
+#ifdef HAVE_CH_LAYOUT
+ int nb_channels = m_codecCtx->ch_layout.nb_channels;
+#else
+ int nb_channels = m_codecCtx->channels;
+#endif
+
if(ret != 0)
break;
- int data_size = av_samples_get_buffer_size(nullptr, m_codecCtx->channels, m_frame->nb_samples, m_codecCtx->sample_fmt, 1);
+ int data_size = av_samples_get_buffer_size(nullptr, nb_channels, m_frame->nb_samples, m_codecCtx->sample_fmt, 1);
if(buf_size - buf_pos < data_size)
{
@@ -122,12 +133,12 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
if(m_tointerleave)
{
- int single_size = data_size / m_codecCtx->channels / m_frame->nb_samples;
- for(int channel = 0; channel < m_codecCtx->channels; channel++)
+ int single_size = data_size / nb_channels / m_frame->nb_samples;
+ for(int channel = 0; channel < nb_channels; channel++)
{
for(int i = 0; i < m_frame->nb_samples; i++)
{
- std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size,
+ std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((nb_channels * i) + channel) * single_size,
m_frame->data[channel] + i * single_size, single_size);
}
}
@@ -207,7 +218,11 @@ void FFMPEGReader::init(int stream)
if(avcodec_open2(m_codecCtx, aCodec, nullptr) < 0)
AUD_THROW(FileException, "File couldn't be read, ffmpeg codec couldn't be opened.");
+#ifdef HAVE_CH_LAYOUT
+ m_specs.channels = (Channels) m_codecCtx->ch_layout.nb_channels;
+#else
m_specs.channels = (Channels) m_codecCtx->channels;
+#endif
m_tointerleave = av_sample_fmt_is_planar(m_codecCtx->sample_fmt);
switch(av_get_packed_sample_fmt(m_codecCtx->sample_fmt))
@@ -344,8 +359,12 @@ std::vector<StreamInfo> FFMPEGReader::queryStreams()
info.specs.channels = Channels(m_formatCtx->streams[i]->codec->channels);
info.specs.rate = m_formatCtx->streams[i]->codec->sample_rate;
info.specs.format = convertSampleFormat(m_formatCtx->streams[i]->codec->sample_fmt);
+#else
+#ifdef HAVE_CH_LAYOUT
+ info.specs.channels = Channels(m_formatCtx->streams[i]->codecpar->ch_layout.nb_channels);
#else
info.specs.channels = Channels(m_formatCtx->streams[i]->codecpar->channels);
+#endif
info.specs.rate = m_formatCtx->streams[i]->codecpar->sample_rate;
info.specs.format = convertSampleFormat(AVSampleFormat(m_formatCtx->streams[i]->codecpar->format));
#endif
diff --git a/extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp b/extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp
index 9cadfe9c092..2f435c14b56 100644
--- a/extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp
+++ b/extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp
@@ -34,6 +34,10 @@ AUD_NAMESPACE_BEGIN
#define FFMPEG_OLD_CODE
#endif
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100)
+#define HAVE_CH_LAYOUT
+#endif
+
void FFMPEGWriter::encode()
{
sample_t* data = m_input_buffer.getBuffer();
@@ -77,8 +81,12 @@ void FFMPEGWriter::encode()
m_frame->nb_samples = m_input_samples;
m_frame->format = m_codecCtx->sample_fmt;
+#ifdef HAVE_CH_LAYOUT
+ av_channel_layout_copy(&m_frame->ch_layout, &m_codecCtx->ch_layout);
+#else
m_frame->channel_layout = m_codecCtx->channel_layout;
m_frame->channels = m_specs.channels;
+#endif
if(avcodec_fill_audio_frame(m_frame, m_specs.channels, m_codecCtx->sample_fmt, reinterpret_cast<data_t*>(data), m_input_buffer.getSize(), 0) < 0)
AUD_THROW(FileException, "File couldn't be written, filling the audio frame failed with ffmpeg.");
@@ -237,6 +245,39 @@ FFMPEGWriter::FFMPEGWriter(const std::string &filename, DeviceSpecs specs, Conta
break;
}
+#ifdef HAVE_CH_LAYOUT
+ AVChannelLayout channel_layout{};
+
+ switch(m_specs.channels)
+ {
+ case CHANNELS_MONO:
+ channel_layout = AV_CHANNEL_LAYOUT_MONO;
+ break;
+ case CHANNELS_STEREO:
+ channel_layout = AV_CHANNEL_LAYOUT_STEREO;
+ break;
+ case CHANNELS_STEREO_LFE:
+ channel_layout = AV_CHANNEL_LAYOUT_2POINT1;
+ break;
+ case CHANNELS_SURROUND4:
+ channel_layout = AV_CHANNEL_LAYOUT_QUAD;
+ break;
+ case CHANNELS_SURROUND5:
+ channel_layout = AV_CHANNEL_LAYOUT_5POINT0_BACK;
+ break;
+ case CHANNELS_SURROUND51:
+ channel_layout = AV_CHANNEL_LAYOUT_5POINT1_BACK;
+ break;
+ case CHANNELS_SURROUND61:
+ channel_layout = AV_CHANNEL_LAYOUT_6POINT1_BACK;
+ break;
+ case CHANNELS_SURROUND71:
+ channel_layout = AV_CHANNEL_LAYOUT_7POINT1;
+ break;
+ default:
+ AUD_THROW(FileException, "File couldn't be written, channel layout not supported.");
+ }
+#else
uint64_t channel_layout = 0;
switch(m_specs.channels)
@@ -268,6 +309,7 @@ FFMPEGWriter::FFMPEGWriter(const std::string &filename, DeviceSpecs specs, Conta
default:
AUD_THROW(FileException, "File couldn't be written, channel layout not supported.");
}
+#endif
try
{
@@ -405,8 +447,12 @@ FFMPEGWriter::FFMPEGWriter(const std::string &filename, DeviceSpecs specs, Conta
m_codecCtx->codec_type = AVMEDIA_TYPE_AUDIO;
m_codecCtx->bit_rate = bitrate;
+#ifdef HAVE_CH_LAYOUT
+ av_channel_layout_copy(&m_codecCtx->ch_layout, &channel_layout);
+#else
m_codecCtx->channel_layout = channel_layout;
m_codecCtx->channels = m_specs.channels;
+#endif
m_stream->time_base.num = m_codecCtx->time_base.num = 1;
m_stream->time_base.den = m_codecCtx->time_base.den = m_codecCtx->sample_rate;
--
2.30.2