git: 2cc7cf31f4a4 - main - multimedia/mlt7[*]: update to 7.40.0, unbreak with FFmpeg9

From: Dima Panov <fluffy_at_FreeBSD.org>
Date: Mon, 07 Sep 2026 05:40:58 UTC
The branch main has been updated by fluffy:

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

commit 2cc7cf31f4a4c1703f896b656665e7188101b0bd
Author:     Dima Panov <fluffy@FreeBSD.org>
AuthorDate: 2026-09-07 05:39:06 +0000
Commit:     Dima Panov <fluffy@FreeBSD.org>
CommitDate: 2026-09-07 05:39:06 +0000

    multimedia/mlt7[*]: update to 7.40.0, unbreak with FFmpeg9
    
    PR:             297364
    Release notes:  https://github.com/mltframework/mlt/releases/tag/v7.40.0
---
 multimedia/mlt7-glaxnimate/Makefile |   2 +-
 multimedia/mlt7-qt/Makefile         |   2 +-
 multimedia/mlt7/Makefile            |  10 ++-
 multimedia/mlt7/distinfo            |   6 +-
 multimedia/mlt7/files/patch-ffmpeg9 | 153 ++++++++++++++++++++++++++++++++++++
 multimedia/mlt7/pkg-plist           |   4 +
 6 files changed, 168 insertions(+), 9 deletions(-)

diff --git a/multimedia/mlt7-glaxnimate/Makefile b/multimedia/mlt7-glaxnimate/Makefile
index 609f7618652a..7b120f7b5f4b 100644
--- a/multimedia/mlt7-glaxnimate/Makefile
+++ b/multimedia/mlt7-glaxnimate/Makefile
@@ -16,7 +16,7 @@ USE_XORG=	x11
 CMAKE_ON=	MOD_GLAXNIMATE_QT6
 CMAKE_OFF=	MOD_AVFORMAT MOD_DECKLINK MOD_FREI0R MOD_GDK MOD_JACKRACK \
 		MOD_KDENLIVE MOD_MOVIT MOD_NORMALIZE MOD_OLDFILM MOD_OPENCV \
-		MOD_PLUSGPL MOD_PLUS MOD_QT6 MOD_RESAMPLE MOD_RTAUDIO \
+		MOD_PLUSGPL MOD_PLUS MOD_QT6 MOD_RESAMPLE MOD_RNNOISE MOD_RTAUDIO \
 		MOD_RUBBERBAND MOD_SDL2 MOD_SOX MOD_VIDSTAB MOD_VORBIS \
 		MOD_XINE MOD_XML \
 		SWIG_CSHARP SWIG_JAVA SWIG_LUA SWIG_NODEJS \
diff --git a/multimedia/mlt7-qt/Makefile b/multimedia/mlt7-qt/Makefile
index 2e4cae9d5872..b88236a5a7ec 100644
--- a/multimedia/mlt7-qt/Makefile
+++ b/multimedia/mlt7-qt/Makefile
@@ -20,7 +20,7 @@ CMAKE_ON=	MOD_QT6
 CMAKE_OFF=	MOD_AVFORMAT MOD_DECKLINK MOD_FEEDS MOD_FREI0R MOD_GDK MOD_GTK2 \
 		MOD_JACKRACK MOD_KDENLIVE MOD_LUMAS MOD_MOTION_EST MOD_MOVIT MOD_NORMALIZE \
 		MOD_OLDFILM MOD_OPENCV MOD_OPENGL MOD_PLUSGPL MOD_PLUS MOD_RESAMPLE \
-		MOD_RTAUDIO MOD_RUBBERBAND MOD_SDL2 MOD_SOX MOD_VIDSTAB MOD_VMFX \
+		MOD_RNNOISE MOD_RTAUDIO MOD_RUBBERBAND MOD_SDL2 MOD_SOX MOD_VIDSTAB MOD_VMFX \
 		MOD_VORBIS MOD_XINE MOD_XML \
 		SWIG_CSHARP SWIG_JAVA SWIG_LUA SWIG_NODEJS SWIG_PERL \
 		SWIG_PHP SWIG_PYTHON SWIG_RUBY SWIG_TCL \
diff --git a/multimedia/mlt7/Makefile b/multimedia/mlt7/Makefile
index f743c983b909..ea361e792fa3 100644
--- a/multimedia/mlt7/Makefile
+++ b/multimedia/mlt7/Makefile
@@ -12,8 +12,6 @@ WWW=		https://www.mltframework.org/
 LICENSE?=	GPLv2 GPLv3 LGPL21
 LICENSE_COMB?=	multi
 
-BROKEN=		Fails to build with FFmpeg 9
-
 USES+=		cmake localbase pathfix pkgconfig
 USE_LDCONFIG=	yes
 
@@ -46,8 +44,8 @@ OPTIONS_DEFAULT=	AVFORMAT FREI0R GDK MOVIT KDENLIVE NORMALIZE OPENFX PLUS \
 
 OPTIONS_GROUP=		MODULES
 OPTIONS_GROUP_MODULES=	AVFORMAT FREI0R GDK JACKRACK KDENLIVE MOVIT NORMALIZE \
-			OLDFILM OPENCV OPENFX PLUS PLUSGPL RESAMPLE RTAUDIO RUBBERBAND \
-			SDL2 SOX VIDSTAB VORBIS XINE
+			OLDFILM OPENCV OPENFX PLUS PLUSGPL RESAMPLE RNNOISE \
+			RTAUDIO RUBBERBAND SDL2 SOX VIDSTAB VORBIS XINE
 OPTIONS_SUB=		yes
 
 AVFORMAT_DESC=		Enable avformat module
@@ -108,6 +106,10 @@ RESAMPLE_DESC=		Enable resample module
 RESAMPLE_LIB_DEPENDS=	libsamplerate.so:audio/libsamplerate
 RESAMPLE_CMAKE_BOOL=	MOD_RESAMPLE
 
+RNNOISE_DESC=		Enable rnnoise module
+RNNOISE_LIB_DEPENDS=	librnnoise.so:audio/rnnoise
+RNNOISE_CMAKE_BOOL=	MOD_RNNOISE
+
 RTAUDIO_DESC=		Enable RtAudio module
 RTAUDIO_LIB_DEPENDS=	librtaudio.so:audio/rtaudio
 RTAUDIO_CMAKE_BOOL=	MOD_RTAUDIO
diff --git a/multimedia/mlt7/distinfo b/multimedia/mlt7/distinfo
index f0ae9bfe5bb0..ce8c6c18aac7 100644
--- a/multimedia/mlt7/distinfo
+++ b/multimedia/mlt7/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1777498330
-SHA256 (mlt-7.38.0.tar.gz) = b8f0a23c89e9250edc5038d745537c382367bf2ad3dad5d5c7cd13b0fe1c4144
-SIZE (mlt-7.38.0.tar.gz) = 6674009
+TIMESTAMP = 1788731262
+SHA256 (mlt-7.40.0.tar.gz) = f11c30e21670f62a3dfc56a31306ac02f3feea00908a2821a4a0bf3e989d3d6a
+SIZE (mlt-7.40.0.tar.gz) = 6775875
diff --git a/multimedia/mlt7/files/patch-ffmpeg9 b/multimedia/mlt7/files/patch-ffmpeg9
new file mode 100644
index 000000000000..71cb3167d95a
--- /dev/null
+++ b/multimedia/mlt7/files/patch-ffmpeg9
@@ -0,0 +1,153 @@
+From 06c4785f951c087c700de942362d1d1c68ffe500 Mon Sep 17 00:00:00 2001
+From: Dan Dennedy <dan@dennedy.org>
+Date: Thu, 6 Aug 2026 17:14:24 -0700
+Subject: [PATCH] Fix #1280 support for FFmpeg 9 (#1281)
+
+--- src/modules/avformat/consumer_avformat.c.orig	2026-06-25 00:09:29 UTC
++++ src/modules/avformat/consumer_avformat.c
+@@ -629,7 +629,8 @@ static void apply_properties(void *obj, mlt_properties
+                 || (opt_name[0] == 'a' && (flags & AV_OPT_FLAG_AUDIO_PARAM))))
+             opt = av_opt_find(obj, ++opt_name, NULL, flags, search_flags);
+         // Apply option if found
+-        if (opt && strcmp(opt_name, "channel_layout") && strcmp(opt_name, "frame_duration"))
++        if (opt && strcmp(opt_name, "channel_layout") && strcmp(opt_name, "frame_duration")
++            && strcmp(opt_name, "dc"))
+             av_opt_set(obj, opt_name, mlt_properties_get_value(properties, i), search_flags);
+     }
+ }
+@@ -680,7 +681,6 @@ static int pick_sample_fmt(mlt_properties properties, 
+ {
+     int sample_fmt = AV_SAMPLE_FMT_S16;
+     const char *format = mlt_properties_get(properties, "mlt_audio_format");
+-    const int *p = codec->sample_fmts;
+     const char *sample_fmt_str = mlt_properties_get(properties, "sample_fmt");
+ 
+     if (sample_fmt_str)
+@@ -699,13 +699,29 @@ static int pick_sample_fmt(mlt_properties properties, 
+         else if (!strcmp(format, "float"))
+             sample_fmt = AV_SAMPLE_FMT_FLTP;
+     }
++#if LIBAVCODEC_VERSION_INT >= ((61 << 16) + (13 << 8) + 100)
++    const enum AVSampleFormat *sample_fmts = NULL;
++    avcodec_get_supported_config(NULL,
++                                 codec,
++                                 AV_CODEC_CONFIG_SAMPLE_FORMAT,
++                                 0,
++                                 (const void **) &sample_fmts,
++                                 NULL);
++    const int *p = (const int *) sample_fmts;
++#else
++    const int *p = codec->sample_fmts;
++#endif
+     // check if codec supports our mlt_audio_format
+-    for (; *p != -1; p++) {
++    for (; p && *p != -1; p++) {
+         if (*p == sample_fmt)
+             return sample_fmt;
+     }
+     // no match - pick first one we support
++#if LIBAVCODEC_VERSION_INT >= ((61 << 16) + (13 << 8) + 100)
++    for (p = (const int *) sample_fmts; p && *p != -1; p++) {
++#else
+     for (p = codec->sample_fmts; *p != -1; p++) {
++#endif
+         switch (*p) {
+         case AV_SAMPLE_FMT_U8:
+         case AV_SAMPLE_FMT_S16:
+@@ -980,9 +996,25 @@ static AVStream *add_video_stream(mlt_consumer consume
+         c->framerate = av_inv_q(c->time_base);
+ 
+         // Default to the codec's first pix_fmt if possible.
++#if LIBAVCODEC_VERSION_INT >= ((61 << 16) + (13 << 8) + 100)
++        {
++            const enum AVPixelFormat *video_pix_fmts = NULL;
++            if (codec)
++                avcodec_get_supported_config(NULL,
++                                             codec,
++                                             AV_CODEC_CONFIG_PIX_FORMAT,
++                                             0,
++                                             (const void **) &video_pix_fmts,
++                                             NULL);
++            c->pix_fmt = pix_fmt ? av_get_pix_fmt(pix_fmt)
++                         : codec ? (video_pix_fmts ? video_pix_fmts[0] : AV_PIX_FMT_YUV422P)
++                                 : AV_PIX_FMT_YUV420P;
++        }
++#else
+         c->pix_fmt = pix_fmt ? av_get_pix_fmt(pix_fmt)
+                      : codec ? (codec->pix_fmts ? codec->pix_fmts[0] : AV_PIX_FMT_YUV422P)
+                              : AV_PIX_FMT_YUV420P;
++#endif
+ 
+         if (AV_PIX_FMT_VAAPI == c->pix_fmt) {
+             int result = init_vaapi(properties, c);
+@@ -1082,7 +1114,9 @@ static AVStream *add_video_stream(mlt_consumer consume
+         c->rc_override_count = i;
+         if (!c->rc_initial_buffer_occupancy)
+             c->rc_initial_buffer_occupancy = c->rc_buffer_size * 3 / 4;
++#if LIBAVCODEC_VERSION_INT < ((62 << 16) + (25 << 8) + 100)
+         c->intra_dc_precision = mlt_properties_get_int(properties, "dc") - 8;
++#endif
+ 
+         // Setup dual-pass
+         i = mlt_properties_get_int(properties, "pass");
+@@ -1199,6 +1233,26 @@ static int open_video(mlt_properties properties,
+                          AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
+     }
+ 
++#if LIBAVCODEC_VERSION_INT >= ((61 << 16) + (13 << 8) + 100)
++    if (codec) {
++        const enum AVPixelFormat *pix_fmts = NULL;
++        avcodec_get_supported_config(NULL,
++                                     codec,
++                                     AV_CODEC_CONFIG_PIX_FORMAT,
++                                     0,
++                                     (const void **) &pix_fmts,
++                                     NULL);
++        if (pix_fmts) {
++            const enum AVPixelFormat *p = pix_fmts;
++            for (; *p != -1; p++) {
++                if (*p == video_enc->pix_fmt)
++                    break;
++            }
++            if (*p == -1)
++                video_enc->pix_fmt = pix_fmts[0];
++        }
++    }
++#else
+     if (codec && codec->pix_fmts) {
+         const enum AVPixelFormat *p = codec->pix_fmts;
+         for (; *p != -1; p++) {
+@@ -1208,6 +1262,7 @@ static int open_video(mlt_properties properties,
+         if (*p == -1)
+             video_enc->pix_fmt = codec->pix_fmts[0];
+     }
++#endif
+ 
+     const AVPixFmtDescriptor *srcDesc = av_pix_fmt_desc_get(video_enc->pix_fmt);
+     if (srcDesc->flags & AV_PIX_FMT_FLAG_RGB) {
+ src/modules/avformat/consumer_avformat.c   | 61 ++++++++++++++++++++--
+ src/modules/avformat/consumer_avformat.yml |  6 ++-
+ 2 files changed, 63 insertions(+), 4 deletions(-)
+
+--- src/modules/avformat/consumer_avformat.yml.orig	2026-06-25 00:09:29 UTC
++++ src/modules/avformat/consumer_avformat.yml
+@@ -3,7 +3,7 @@ version: 7
+ identifier: avformat
+ title: FFmpeg Output
+ version: 7
+-copyright: Copyright (C) 2003-2019 Meltytech, LLC
++copyright: Copyright (C) 2003-2026 Meltytech, LLC
+ license: LGPL
+ language: en
+ url: http://www.ffmpeg.org/
+@@ -452,6 +452,10 @@ parameters:
+   - identifier: dc
+     title: Intra DC precision
+     type: integer
++    description: >
++      Sets intra_dc_precision for MPEG-2 encoding. The value is offset by 8,
++      so the default of 8 means precision 0 (8-bit). Only relevant for
++      MPEG-2; ignored on FFmpeg 8.0 and later.
+     default: 8
+ 
+   - identifier: muxdelay
diff --git a/multimedia/mlt7/pkg-plist b/multimedia/mlt7/pkg-plist
index ad7e30a058ae..efb12e14bd43 100644
--- a/multimedia/mlt7/pkg-plist
+++ b/multimedia/mlt7/pkg-plist
@@ -85,6 +85,7 @@ lib/mlt-7/libmltcore.so
 %%PLUS%%lib/mlt-7/libmltplus.so
 %%PLUSGPL%%lib/mlt-7/libmltplusgpl.so
 %%RESAMPLE%%lib/mlt-7/libmltresample.so
+%%RNNOISE%%lib/mlt-7/libmltrnnoise.so
 %%RTAUDIO%%lib/mlt-7/libmltrtaudio.so
 %%RUBBERBAND%%lib/mlt-7/libmltrubberband.so
 %%SDL2%%lib/mlt-7/libmltsdl2.so
@@ -100,6 +101,7 @@ share/man/man1/melt-7.1.gz
 %%AVFORMAT%%%%DATADIR%%/avformat/consumer_avformat.yml
 %%AVFORMAT%%%%DATADIR%%/avformat/filter_avcolour_space.yml
 %%AVFORMAT%%%%DATADIR%%/avformat/filter_avdeinterlace.yml
+%%AVFORMAT%%%%DATADIR%%/avformat/filter_info.yml
 %%AVFORMAT%%%%DATADIR%%/avformat/filter_swresample.yml
 %%AVFORMAT%%%%DATADIR%%/avformat/filter_sws_colortransform.yml
 %%AVFORMAT%%%%DATADIR%%/avformat/filter_swscale.yml
@@ -457,6 +459,8 @@ share/man/man1/melt-7.1.gz
 %%DATADIR%%/profiles/vertical_hd_60
 %%RESAMPLE%%%%DATADIR%%/resample/filter_resample.yml
 %%RESAMPLE%%%%DATADIR%%/resample/link_resample.yml
+%%RNNOISE%%%%DATADIR%%/rnnoise/filter_rnnoise.yml
+%%RNNOISE%%%%DATADIR%%/rnnoise/link_rnnoise.yml
 %%RTAUDIO%%%%DATADIR%%/rtaudio/consumer_rtaudio.yml
 %%RUBBERBAND%%%%DATADIR%%/rubberband/filter_rbpitch.yml
 %%SDL2%%%%DATADIR%%/sdl2/consumer_sdl2.yml