git: 4cf9230920f9 - main - multimedia/arcan: fix build with recent ffmpeg

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Fri, 19 Dec 2025 08:30:01 UTC
The branch main has been updated by bapt:

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

commit 4cf9230920f9de0bc9b6f08975c14697b153bf8b
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2025-12-19 08:24:51 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2025-12-19 08:29:43 +0000

    multimedia/arcan: fix build with recent ffmpeg
    
    Incorporate an upstream patch to build with recent ffmpeg
---
 multimedia/arcan/Makefile           |  2 ++
 multimedia/arcan/files/ffmpeg.patch | 57 +++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)

diff --git a/multimedia/arcan/Makefile b/multimedia/arcan/Makefile
index 2e1cfaaa9623..66617ffd2694 100644
--- a/multimedia/arcan/Makefile
+++ b/multimedia/arcan/Makefile
@@ -13,6 +13,8 @@ LICENSE_FILE_BSD3CLAUSE=${WRKSRC:H}/data/distr/LICENSE.BSD
 LICENSE_FILE_GPLv2+ =	${WRKSRC:H}/data/distr/LICENSE.GPL
 LICENSE_FILE_LGPL21+ =	${WRKSRC:H}/data/distr/LICENSE.LGPL
 
+EXTRA_PATCHES=	${FILESDIR}/ffmpeg.patch:-p1
+
 BUILD_DEPENDS=	evdev-proto>0:devel/evdev-proto
 LIB_DEPENDS=	libdrm.so:graphics/libdrm \
 		libfreetype.so:print/freetype2
diff --git a/multimedia/arcan/files/ffmpeg.patch b/multimedia/arcan/files/ffmpeg.patch
new file mode 100644
index 000000000000..c1038e0e3c90
--- /dev/null
+++ b/multimedia/arcan/files/ffmpeg.patch
@@ -0,0 +1,57 @@
+Index: src/frameserver/encode/default/encode_presets.c
+==================================================================
+--- src/frameserver/encode/default/encode_presets.c
++++ src/frameserver/encode/default/encode_presets.c
+@@ -61,11 +61,11 @@
+ 
+ 	if (avcodec_open2(dst->storage.video.context,
+ 		dst->storage.video.codec, NULL) != 0){
+ 		dst->storage.video.codec   = NULL;
+ 		dst->storage.video.context = NULL;
+-		avcodec_close(dst->storage.video.context);
++		avcodec_free_context(&dst->storage.video.context);
+ 		return false;
+ 	}
+ 
+ 	return true;
+ }
+@@ -89,11 +89,11 @@
+ 		"got %d kbit/s using %s\n", samplerate, abr,
+ 		(int)(ctx->bit_rate / 1000), codec->name);
+ 
+ 	if (avcodec_open2(
+ 		dst->storage.audio.context, dst->storage.audio.codec, NULL) != 0){
+-		avcodec_close(dst->storage.audio.context);
++		avcodec_free_context(&dst->storage.audio.context);
+ 		dst->storage.audio.context = NULL;
+ 		dst->storage.audio.codec   = NULL;
+ 		return false;
+ 	}
+ 
+@@ -179,11 +179,11 @@
+ 	LOG("(encode) video setup @ %d * %d, %f fps, %d kbit / s.\n",
+ 		width, height, fps, vbr / 1000);
+ 
+ 	if (avcodec_open2(dst->storage.video.context,
+ 		dst->storage.video.codec, &opts) != 0){
+-		avcodec_close(dst->storage.video.context);
++		avcodec_free_context(&dst->storage.video.context);
+ 		dst->storage.video.context = NULL;
+ 		dst->storage.video.codec   = NULL;
+ 		return false;
+ 	}
+ 
+@@ -245,11 +245,11 @@
+ 
+ 	LOG("(encode) video setup @ %d * %d, %f fps, %d kbit / s.\n",
+ 		width, height, fps, vbr / 1024);
+ 	if (avcodec_open2(dst->storage.video.context,
+ 		dst->storage.video.codec, &opts) != 0){
+-		avcodec_close(dst->storage.video.context);
++		avcodec_free_context(&dst->storage.video.context);
+ 		dst->storage.video.context = NULL;
+ 		dst->storage.video.codec   = NULL;
+ 		return false;
+ 	}
+ 
+