git: b91a02f9430f - main - multimedia/olive: Unbreak

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 15 Sep 2026 23:28:50 UTC
The branch main has been updated by yuri:

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

commit b91a02f9430f3619edd85e6511dfa2b0c43abd26
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-09-15 23:06:55 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-09-15 23:28:45 +0000

    multimedia/olive: Unbreak
    
    Patches for ffmpeg-9.x compatibility are added.
---
 multimedia/olive/Makefile                          |  9 +--
 multimedia/olive/distinfo                          |  4 +-
 .../files/patch-app_codec_ffmpeg_ffmpegencoder.cpp | 68 +++++++++++++++++++++-
 .../olive/files/patch-app_render_renderer.cpp      | 25 ++++++++
 4 files changed, 96 insertions(+), 10 deletions(-)

diff --git a/multimedia/olive/Makefile b/multimedia/olive/Makefile
index 8711c8d6d04d..13417c671856 100644
--- a/multimedia/olive/Makefile
+++ b/multimedia/olive/Makefile
@@ -1,13 +1,10 @@
 PORTNAME=	olive
 DISTVERSION=	0.2.0
 DISTVERSIONSUFFIX=	-nightly
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	multimedia
 PKGNAMESUFFIX=	-video-editor
 
-PATCH_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
-PATCHFILES=	311eeb72944f93f873d1cd1784ee2bf423e1e7c2.patch:-p1 # https://github.com/olive-editor/olive/pull/2294, OpenColorIO 2.3 compatibility
-
 MAINTAINER=	yuri@FreeBSD.org
 COMMENT=	Non-linear video editor
 WWW=		https://olivevideoeditor.org/ \
@@ -16,7 +13,6 @@ WWW=		https://olivevideoeditor.org/ \
 LICENSE=	GPLv3
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-BROKEN=		Fails to build with FFmpeg 9
 #BROKEN_armv7=	compilation fails: error: unknown type name '__m128'
 #BROKEN_i386=	compilation fails, see https://github.com/olive-editor/olive/issues/2364
 #BROKEN_powerpc=compilation fails, see https://github.com/olive-editor/olive/issues/2364
@@ -27,7 +23,8 @@ LIB_DEPENDS=	libavcodec.so:multimedia/ffmpeg \
 		libOpenColorIO.so:graphics/opencolorio \
 		libOpenEXR.so:graphics/openexr \
 		libOpenImageIO.so:graphics/openimageio \
-		libportaudio.so:audio/portaudio
+		libportaudio.so:audio/portaudio \
+		libxkbcommon.so:x11/libxkbcommon
 RUN_DEPENDS=	frei0r>0:graphics/frei0r
 #		libopentimelineio.so:multimedia/opentimelineio
 
diff --git a/multimedia/olive/distinfo b/multimedia/olive/distinfo
index c53ecf53e1ad..48df272a0523 100644
--- a/multimedia/olive/distinfo
+++ b/multimedia/olive/distinfo
@@ -1,9 +1,7 @@
-TIMESTAMP = 1733649622
+TIMESTAMP = 1789503696
 SHA256 (olive-editor-olive-0.2.0-nightly_GH0.tar.gz) = 0c82e35b862f8eb2afcf30e6529b155f709c59668d1f13d475b9aa32a62fa8b6
 SIZE (olive-editor-olive-0.2.0-nightly_GH0.tar.gz) = 8155942
 SHA256 (olive-editor-core-2777928_GH0.tar.gz) = 2a7f57fcf782d62d9a40a3c51a1cb7d5f87aaf20952402d9d52bdbafddbaec6c
 SIZE (olive-editor-core-2777928_GH0.tar.gz) = 76380
 SHA256 (KDAB-KDDockWidgets-8d2d0a5_GH0.tar.gz) = 5d6d40c8a3f128ce61769c2bcb01b89dfd92460779e63cde40d8068647157705
 SIZE (KDAB-KDDockWidgets-8d2d0a5_GH0.tar.gz) = 3930847
-SHA256 (311eeb72944f93f873d1cd1784ee2bf423e1e7c2.patch) = 776c164ae6b4fb1a861b56b78b7277cde9cb8d52ef759dba8fe3981832783add
-SIZE (311eeb72944f93f873d1cd1784ee2bf423e1e7c2.patch) = 1547
diff --git a/multimedia/olive/files/patch-app_codec_ffmpeg_ffmpegencoder.cpp b/multimedia/olive/files/patch-app_codec_ffmpeg_ffmpegencoder.cpp
index 943c59accca8..dfe7c0ee288d 100644
--- a/multimedia/olive/files/patch-app_codec_ffmpeg_ffmpegencoder.cpp
+++ b/multimedia/olive/files/patch-app_codec_ffmpeg_ffmpegencoder.cpp
@@ -1,5 +1,71 @@
---- app/codec/ffmpeg/ffmpegencoder.cpp.orig	2024-12-04 17:13:33 UTC
+-- Fix build with FFmpeg 9 (libavcodec 61+) where AVCodec::pix_fmts and
+-- AVCodec::sample_fmts are no longer directly accessible. Use the new
+-- avcodec_get_supported_config() API instead.
+-- See: https://github.com/olive-editor/olive/issues/2387
+
+--- app/codec/ffmpeg/ffmpegencoder.cpp.orig
 +++ app/codec/ffmpeg/ffmpegencoder.cpp
+@@ -55,6 +55,22 @@ QStringList FFmpegEncoder::GetPixelFormatsForCodec(ExportCodec::Codec c) const
+   const AVCodec* codec_info = GetEncoder(c, SampleFormat::INVALID);
+
+   if (codec_info) {
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(61, 13, 100)
++    const AVPixelFormat* supported_pix_fmts = nullptr;
++    if (avcodec_get_supported_config(nullptr, codec_info, AV_CODEC_CONFIG_PIX_FORMAT, 0,
++                                     reinterpret_cast<const void**>(&supported_pix_fmts), nullptr) >= 0
++        && supported_pix_fmts) {
++      for (int i=0; supported_pix_fmts[i]!=AV_PIX_FMT_NONE; i++) {
++        if (FFmpegUtils::ConvertJPEGSpaceToRegularSpace(supported_pix_fmts[i]) != supported_pix_fmts[i]) {
++          // This is a deprecated "JPEG" space, skip it
++          continue;
++        }
++
++        const char* pix_fmt_name = av_get_pix_fmt_name(supported_pix_fmts[i]);
++        pix_fmts.append(pix_fmt_name);
++      }
++    }
++#else
+     for (int i=0; codec_info->pix_fmts[i]!=-1; i++) {
+       if (FFmpegUtils::ConvertJPEGSpaceToRegularSpace(codec_info->pix_fmts[i]) != codec_info->pix_fmts[i]) {
+         // This is a deprecated "JPEG" space, skip it
+@@ -64,6 +80,7 @@ QStringList FFmpegEncoder::GetPixelFormatsForCodec(ExportCodec::Codec c) const
+       const char* pix_fmt_name = av_get_pix_fmt_name(codec_info->pix_fmts[i]);
+       pix_fmts.append(pix_fmt_name);
+     }
++#endif
+   }
+
+   return pix_fmts;
+@@ -88,6 +105,21 @@ std::vector<SampleFormat> FFmpegEncoder::GetSampleFormatsForCodec(ExportCodec::Co
+   } else {
+     const AVCodec* codec_info = GetEncoder(c, SampleFormat::INVALID);
+
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(61, 13, 100)
++    if (codec_info) {
++      const AVSampleFormat* supported_sample_fmts = nullptr;
++      if (avcodec_get_supported_config(nullptr, codec_info, AV_CODEC_CONFIG_SAMPLE_FORMAT, 0,
++                                       reinterpret_cast<const void**>(&supported_sample_fmts), nullptr) >= 0
++          && supported_sample_fmts) {
++        for (int i=0; supported_sample_fmts[i]!=AV_SAMPLE_FMT_NONE; i++) {
++          SampleFormat this_format = FFmpegUtils::GetNativeSampleFormat(supported_sample_fmts[i]);
++          if (this_format != SampleFormat::INVALID) {
++            f.push_back(this_format);
++          }
++        }
++      }
++    }
++#else
+     if (codec_info && codec_info->sample_fmts) {
+       for (int i=0; codec_info->sample_fmts[i]!=-1; i++) {
+         SampleFormat this_format = FFmpegUtils::GetNativeSampleFormat(static_cast<AVSampleFormat>(codec_info->sample_fmts[i]));
+@@ -96,6 +128,7 @@ std::vector<SampleFormat> FFmpegEncoder::GetSampleFormatsForCodec(ExportCodec::Co
+         }
+       }
+     }
++#endif
+   }
+
+   return f;
 @@ -334,7 +334,11 @@ bool FFmpegEncoder::WriteAudioData(const AudioParams &
    int output_sample_count = input_sample_count ? swr_get_out_samples(audio_resample_ctx_, input_sample_count) : 102400;
    uint8_t** output_data = nullptr;
diff --git a/multimedia/olive/files/patch-app_render_renderer.cpp b/multimedia/olive/files/patch-app_render_renderer.cpp
new file mode 100644
index 000000000000..54430d0c53d8
--- /dev/null
+++ b/multimedia/olive/files/patch-app_render_renderer.cpp
@@ -0,0 +1,25 @@
+-- OpenColorIO 2.3+ changed GpuShaderDesc::getTexture to require a
+-- TextureDimensions argument. Add it with a version guard.
+-- Upstream: https://github.com/olive-editor/olive/pull/2294
+
+--- app/render/renderer.cpp.orig
++++ app/render/renderer.cpp
+@@ -240,9 +240,17 @@ bool Renderer::GetColorContext(const ColorTransformJob &color_job, Renderer::Co
+       const char* sampler_name = nullptr;
+       unsigned int width = 0, height = 0;
+       OCIO::GpuShaderDesc::TextureType channel = OCIO::GpuShaderDesc::TEXTURE_RGB_CHANNEL;
++#if OCIO_VERSION_HEX >= 0x02030000
++      OCIO::GpuShaderDesc::TextureDimensions dimensions = OCIO::GpuShaderDesc::TEXTURE_2D;
++#endif
+       OCIO::Interpolation interpolation = OCIO::INTERP_LINEAR;
+
+-      shader_desc->getTexture(i, tex_name, sampler_name, width, height, channel, interpolation);
++      shader_desc->getTexture(i, tex_name, sampler_name, width, height, channel,
++#if OCIO_VERSION_HEX >= 0x02030000
++                              // OCIO::GpuShaderDesc::TextureDimensions
++                              dimensions,
++#endif
++                              interpolation);
+
+       if (!tex_name || !*tex_name
+           || !sampler_name || !*sampler_name