git: 34000b5db585 - main - graphics/blender-lts29: update to 2.93.18 release (+)

From: Dima Panov <fluffy_at_FreeBSD.org>
Date: Fri, 26 May 2023 00:01:20 UTC
The branch main has been updated by fluffy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=34000b5db585a9662406e84f1e6473fa48672b18

commit 34000b5db585a9662406e84f1e6473fa48672b18
Author:     Dima Panov <fluffy@FreeBSD.org>
AuthorDate: 2023-05-25 23:55:02 +0000
Commit:     Dima Panov <fluffy@FreeBSD.org>
CommitDate: 2023-05-26 00:01:07 +0000

    graphics/blender-lts29: update to 2.93.18 release (+)
    
    Changelog:      https://www.blender.org/download/lts/2-93/
    Approved by:    maintainer (implicit)
    
    Sponsored by:   Serenity Cybersecurity, LLC
---
 graphics/blender-lts29/Makefile                    |  4 +-
 graphics/blender-lts29/Makefile.options            |  1 -
 graphics/blender-lts29/distinfo                    |  6 +-
 ...xtern_audaspace_plugins_ffmpeg_FFMPEGReader.cpp | 11 +++
 ...xtern_audaspace_plugins_ffmpeg_FFMPEGWriter.cpp | 28 +++++++
 .../files/patch-intern_cycles_CMakeLists.txt       |  4 +-
 .../files/patch-intern_ffmpeg_ffmpeg__compat.h     | 12 +++
 ...-source_blender_blenkernel_intern_writeffmpeg.c | 87 ++++++++++++++++++++--
 ...patch-source_blender_imbuf_intern_anim__movie.c |  4 +-
 .../patch-source_blender_imbuf_intern_indexer.c    | 32 ++++----
 10 files changed, 154 insertions(+), 35 deletions(-)

diff --git a/graphics/blender-lts29/Makefile b/graphics/blender-lts29/Makefile
index 5a2b1eadf526..bb5a991821b2 100644
--- a/graphics/blender-lts29/Makefile
+++ b/graphics/blender-lts29/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	blender
-DISTVERSION=	2.93.17
-PORTREVISION=	1
+DISTVERSION=	2.93.18
 CATEGORIES=	graphics multimedia
 MASTER_SITES=	http://download.blender.org/source/ \
 		http://mirror.cs.umn.edu/blender.org/source/ \
@@ -15,7 +14,6 @@ WWW=		https://www.blender.org/
 LICENSE=	GPLv3+
 LICENSE_FILE=	${WRKSRC}/doc/license/GPL3-license.txt
 
-#BROKEN=		fails to build
 NOT_FOR_ARCHS=	i386
 NOT_FOR_ARCHS_REASON=	uses 64bit atomic functions
 
diff --git a/graphics/blender-lts29/Makefile.options b/graphics/blender-lts29/Makefile.options
index 1cd86ee348f0..c14cad208a00 100644
--- a/graphics/blender-lts29/Makefile.options
+++ b/graphics/blender-lts29/Makefile.options
@@ -60,7 +60,6 @@ OPTIONS_DEFAULT=	\
 	DDS		\
 	DRACO		\
 	EBOOL		\
-	FFMPEG 		\
 	FFTW3		\
 	FRAMESERVER	\
 	FREESTYLE	\
diff --git a/graphics/blender-lts29/distinfo b/graphics/blender-lts29/distinfo
index bb4094d283f7..0771c541f379 100644
--- a/graphics/blender-lts29/distinfo
+++ b/graphics/blender-lts29/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1682621230
-SHA256 (blender-2.93.17.tar.xz) = 040e1381c8a37bb22e684b15ba4fecb78817fd13f1e4709d6d8c20800ac7cbfb
-SIZE (blender-2.93.17.tar.xz) = 43033860
+TIMESTAMP = 1685053190
+SHA256 (blender-2.93.18.tar.xz) = f485da9fa9bdaabb7c1133e74e717d09468feec6db455595b03c02201a2081dd
+SIZE (blender-2.93.18.tar.xz) = 43030152
diff --git a/graphics/blender-lts29/files/patch-extern_audaspace_plugins_ffmpeg_FFMPEGReader.cpp b/graphics/blender-lts29/files/patch-extern_audaspace_plugins_ffmpeg_FFMPEGReader.cpp
new file mode 100644
index 000000000000..515c8b00191c
--- /dev/null
+++ b/graphics/blender-lts29/files/patch-extern_audaspace_plugins_ffmpeg_FFMPEGReader.cpp
@@ -0,0 +1,11 @@
+--- extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp.orig	2023-05-12 23:31:30 UTC
++++ extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp
+@@ -182,7 +182,7 @@ void FFMPEGReader::init()
+ 
+ 	// get a decoder and open it
+ #ifndef FFMPEG_OLD_CODE
+-	AVCodec* aCodec = avcodec_find_decoder(m_formatCtx->streams[m_stream]->codecpar->codec_id);
++	const AVCodec* aCodec = avcodec_find_decoder(m_formatCtx->streams[m_stream]->codecpar->codec_id);
+ 
+ 	if(!aCodec)
+ 		AUD_THROW(FileException, "File couldn't be read, no decoder found with ffmpeg.");
diff --git a/graphics/blender-lts29/files/patch-extern_audaspace_plugins_ffmpeg_FFMPEGWriter.cpp b/graphics/blender-lts29/files/patch-extern_audaspace_plugins_ffmpeg_FFMPEGWriter.cpp
new file mode 100644
index 000000000000..8a95a35b12cf
--- /dev/null
+++ b/graphics/blender-lts29/files/patch-extern_audaspace_plugins_ffmpeg_FFMPEGWriter.cpp
@@ -0,0 +1,28 @@
+--- extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp.orig	2023-05-12 23:31:30 UTC
++++ extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp
+@@ -23,6 +23,7 @@ extern "C" {
+ extern "C" {
+ #include <libavcodec/avcodec.h>
+ #include <libavformat/avio.h>
++#include <libavutil/channel_layout.h>
+ }
+ 
+ AUD_NAMESPACE_BEGIN
+@@ -171,7 +172,7 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, Devic
+ 	if(avformat_alloc_output_context2(&m_formatCtx, nullptr, formats[format], filename.c_str()) < 0)
+ 		AUD_THROW(FileException, "File couldn't be written, format couldn't be found with ffmpeg.");
+ 
+-	AVOutputFormat* outputFmt = m_formatCtx->oformat;
++	AVOutputFormat* outputFmt = const_cast<AVOutputFormat*>(m_formatCtx->oformat);
+ 
+ 	if(!outputFmt) {
+ 		avformat_free_context(m_formatCtx);
+@@ -271,7 +272,7 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, Devic
+ 		if(outputFmt->audio_codec == AV_CODEC_ID_NONE)
+ 			AUD_THROW(FileException, "File couldn't be written, audio codec not found with ffmpeg.");
+ 
+-		AVCodec* codec = avcodec_find_encoder(outputFmt->audio_codec);
++		const AVCodec* codec = avcodec_find_encoder(outputFmt->audio_codec);
+ 		if(!codec)
+ 			AUD_THROW(FileException, "File couldn't be written, audio encoder couldn't be found with ffmpeg.");
+ 
diff --git a/graphics/blender-lts29/files/patch-intern_cycles_CMakeLists.txt b/graphics/blender-lts29/files/patch-intern_cycles_CMakeLists.txt
index 0c94a20879db..620be16a2b15 100644
--- a/graphics/blender-lts29/files/patch-intern_cycles_CMakeLists.txt
+++ b/graphics/blender-lts29/files/patch-intern_cycles_CMakeLists.txt
@@ -1,6 +1,6 @@
---- intern/cycles/CMakeLists.txt.orig	2019-07-31 13:03:30 UTC
+--- intern/cycles/CMakeLists.txt.orig	2023-05-12 23:31:31 UTC
 +++ intern/cycles/CMakeLists.txt
-@@ -260,9 +260,9 @@ if(WITH_CYCLES_DEBUG)
+@@ -312,9 +312,9 @@ endif()
    add_definitions(-DWITH_CYCLES_DEBUG)
  endif()
  
diff --git a/graphics/blender-lts29/files/patch-intern_ffmpeg_ffmpeg__compat.h b/graphics/blender-lts29/files/patch-intern_ffmpeg_ffmpeg__compat.h
new file mode 100644
index 000000000000..2557a06bd68f
--- /dev/null
+++ b/graphics/blender-lts29/files/patch-intern_ffmpeg_ffmpeg__compat.h
@@ -0,0 +1,12 @@
+--- intern/ffmpeg/ffmpeg_compat.h.orig	2023-05-12 23:31:31 UTC
++++ intern/ffmpeg/ffmpeg_compat.h
+@@ -20,7 +20,9 @@
+ #ifndef __FFMPEG_COMPAT_H__
+ #define __FFMPEG_COMPAT_H__
+ 
++#include <libavcodec/avcodec.h>
+ #include <libavformat/avformat.h>
++#define AV_CODEC_CAP_AUTO_THREADS        AV_CODEC_CAP_OTHER_THREADS
+ 
+ /* Check if our ffmpeg is new enough, avoids user complaints.
+  * Minimum supported version is currently 3.2.0 which mean the following library versions:
diff --git a/graphics/blender-lts29/files/patch-source_blender_blenkernel_intern_writeffmpeg.c b/graphics/blender-lts29/files/patch-source_blender_blenkernel_intern_writeffmpeg.c
index 5c4ce5259791..1f738c6e485b 100644
--- a/graphics/blender-lts29/files/patch-source_blender_blenkernel_intern_writeffmpeg.c
+++ b/graphics/blender-lts29/files/patch-source_blender_blenkernel_intern_writeffmpeg.c
@@ -1,11 +1,82 @@
---- source/blender/blenkernel/intern/writeffmpeg.c.orig	2022-11-08 13:50:16 UTC
+--- source/blender/blenkernel/intern/writeffmpeg.c.orig	2023-05-25 22:43:31 UTC
 +++ source/blender/blenkernel/intern/writeffmpeg.c
-@@ -855,7 +855,7 @@ static AVStream *alloc_video_stream(FFMpegContext *con
-                                                             255);
-   st->avg_frame_rate = av_inv_q(c->time_base);
+@@ -59,6 +59,7 @@
+ #  include <libavutil/opt.h>
+ #  include <libavutil/rational.h>
+ #  include <libavutil/samplefmt.h>
++#  include <libavutil/channel_layout.h>
+ #  include <libswscale/swscale.h>
  
--  if (codec->capabilities & AV_CODEC_CAP_AUTO_THREADS) {
-+  if (codec->capabilities & AV_CODEC_CAP_OTHER_THREADS) {
-     c->thread_count = 0;
+ #  include "ffmpeg_compat.h"
+@@ -574,7 +575,7 @@ static AVStream *alloc_video_stream(FFMpegContext *con
+                                     int error_size)
+ {
+   AVStream *st;
+-  AVCodec *codec;
++  const AVCodec *codec;
+   AVDictionary *opts = NULL;
+ 
+   error[0] = '\0';
+@@ -601,7 +602,7 @@ static AVStream *alloc_video_stream(FFMpegContext *con
+   }
+ 
+   /* Load codec defaults into 'c'. */
+-  avcodec_get_context_defaults3(c, codec);
++  //avcodec_get_context_defaults3(c, codec);
+ 
+   /* Get some values from the current render settings */
+ 
+@@ -814,7 +815,7 @@ static AVStream *alloc_audio_stream(FFMpegContext *con
+                                     int error_size)
+ {
+   AVStream *st;
+-  AVCodec *codec;
++  const AVCodec *codec;
+   AVDictionary *opts = NULL;
+ 
+   error[0] = '\0';
+@@ -842,7 +843,7 @@ static AVStream *alloc_audio_stream(FFMpegContext *con
    }
-   else {
+ 
+   /* Load codec defaults into 'c'. */
+-  avcodec_get_context_defaults3(c, codec);
++  //avcodec_get_context_defaults3(c, codec);
+ 
+   c->sample_rate = rd->ffcodecdata.audio_mixrate;
+   c->bit_rate = context->ffmpeg_audio_bitrate * 1000;
+@@ -1038,7 +1039,7 @@ static int start_ffmpeg_impl(FFMpegContext *context,
+     BKE_report(reports, RPT_ERROR, "No valid formats found");
+     return 0;
+   }
+-  fmt = av_guess_format(NULL, exts[0], NULL);
++  fmt = (AVOutputFormat*)(av_guess_format(NULL, exts[0], NULL));
+   if (!fmt) {
+     BKE_report(reports, RPT_ERROR, "No valid formats found");
+     return 0;
+@@ -1554,7 +1555,7 @@ static IDProperty *BKE_ffmpeg_property_add(RenderData 
+                                            const AVOption *o,
+                                            const AVOption *parent)
+ {
+-  AVCodecContext c;
++  //AVCodecContext c;
+   IDProperty *group;
+   IDProperty *prop;
+   IDPropertyTemplate val;
+@@ -1563,7 +1564,7 @@ static IDProperty *BKE_ffmpeg_property_add(RenderData 
+ 
+   val.i = 0;
+ 
+-  avcodec_get_context_defaults3(&c, NULL);
++  //avcodec_get_context_defaults3(&c, NULL);
+ 
+   if (!rd->ffcodecdata.properties) {
+     rd->ffcodecdata.properties = IDP_New(IDP_GROUP, &val, "ffmpeg");
+@@ -1632,7 +1633,7 @@ int BKE_ffmpeg_property_add_string(RenderData *rd, con
+   char *param;
+   IDProperty *prop = NULL;
+ 
+-  avcodec_get_context_defaults3(&c, NULL);
++  //avcodec_get_context_defaults3(&c, NULL);
+ 
+   BLI_strncpy(name_, str, sizeof(name_));
+ 
diff --git a/graphics/blender-lts29/files/patch-source_blender_imbuf_intern_anim__movie.c b/graphics/blender-lts29/files/patch-source_blender_imbuf_intern_anim__movie.c
index eff908405e1e..db8863597462 100644
--- a/graphics/blender-lts29/files/patch-source_blender_imbuf_intern_anim__movie.c
+++ b/graphics/blender-lts29/files/patch-source_blender_imbuf_intern_anim__movie.c
@@ -1,6 +1,6 @@
---- source/blender/imbuf/intern/anim_movie.c.orig	2022-11-04 00:33:07 UTC
+--- source/blender/imbuf/intern/anim_movie.c.orig	2023-05-12 23:31:38 UTC
 +++ source/blender/imbuf/intern/anim_movie.c
-@@ -554,7 +554,7 @@ static int startffmpeg(struct anim *anim)
+@@ -574,7 +574,7 @@ static int startffmpeg(struct anim *anim)
    avcodec_parameters_to_context(pCodecCtx, video_stream->codecpar);
    pCodecCtx->workaround_bugs = FF_BUG_AUTODETECT;
  
diff --git a/graphics/blender-lts29/files/patch-source_blender_imbuf_intern_indexer.c b/graphics/blender-lts29/files/patch-source_blender_imbuf_intern_indexer.c
index 401562c353dd..79b4b3f6f3eb 100644
--- a/graphics/blender-lts29/files/patch-source_blender_imbuf_intern_indexer.c
+++ b/graphics/blender-lts29/files/patch-source_blender_imbuf_intern_indexer.c
@@ -1,20 +1,20 @@
---- source/blender/imbuf/intern/indexer.c.orig	2022-11-04 00:33:07 UTC
+--- source/blender/imbuf/intern/indexer.c.orig	2023-05-25 22:43:31 UTC
 +++ source/blender/imbuf/intern/indexer.c
-@@ -559,7 +559,7 @@ static struct proxy_output_ctx *alloc_proxy_output_ffm
-   av_dict_set(&codec_opts, "preset", "veryfast", 0);
-   av_dict_set(&codec_opts, "tune", "fastdecode", 0);
+@@ -527,7 +527,7 @@ static struct proxy_output_ctx *alloc_proxy_output_ffm
+   rv->c->codec_type = AVMEDIA_TYPE_VIDEO;
+   rv->c->codec_id = AV_CODEC_ID_H264;
  
--  if (rv->codec->capabilities & AV_CODEC_CAP_AUTO_THREADS) {
-+  if (rv->codec->capabilities & AV_CODEC_CAP_OTHER_THREADS) {
-     rv->c->thread_count = 0;
-   }
-   else {
-@@ -872,7 +872,7 @@ static IndexBuildContext *index_ffmpeg_create_context(
-   avcodec_parameters_to_context(context->iCodecCtx, context->iStream->codecpar);
-   context->iCodecCtx->workaround_bugs = FF_BUG_AUTODETECT;
+-  rv->of->oformat->video_codec = rv->c->codec_id;
++  ((struct AVOutputFormat*)(rv->of->oformat))->video_codec = rv->c->codec_id;
+   rv->codec = avcodec_find_encoder(rv->c->codec_id);
  
--  if (context->iCodec->capabilities & AV_CODEC_CAP_AUTO_THREADS) {
-+  if (context->iCodec->capabilities & AV_CODEC_CAP_OTHER_THREADS) {
-     context->iCodecCtx->thread_count = 0;
+   if (!rv->codec) {
+@@ -540,7 +540,7 @@ static struct proxy_output_ctx *alloc_proxy_output_ffm
+     return NULL;
    }
-   else {
+ 
+-  avcodec_get_context_defaults3(rv->c, rv->codec);
++  //avcodec_get_context_defaults3(rv->c, rv->codec);
+ 
+   rv->c->width = width;
+   rv->c->height = height;