git: 5dcd28ad454c - main - emulators/dosbox-x: Unbreak with FFmpeg9

Nuno Teixeira <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.ports
Message-ID <[email protected]>
The branch main has been updated by eduardo:

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

commit 5dcd28ad454cb138bc216e54a684aaa2ea094e2e
Author:     Nuno Teixeira <[email protected]>
AuthorDate: 2026-08-16 16:37:35 +0000
Commit:     Nuno Teixeira <[email protected]>
CommitDate: 2026-08-16 16:38:28 +0000

    emulators/dosbox-x: Unbreak with FFmpeg9
    
    PR:             297377
---
 emulators/dosbox-x/files/patch-fix-ffmpeg9 | 44 ++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/emulators/dosbox-x/files/patch-fix-ffmpeg9 b/emulators/dosbox-x/files/patch-fix-ffmpeg9
new file mode 100644
index 000000000000..9e4c2a9bbbef
--- /dev/null
+++ b/emulators/dosbox-x/files/patch-fix-ffmpeg9
@@ -0,0 +1,44 @@
+From 18062c0ffb33db35fa52ce937ce25223140c0293 Mon Sep 17 00:00:00 2001
+From: maron2000 <[email protected]>
+Date: Thu, 13 Aug 2026 18:02:16 +0900
+Subject: [PATCH 1/2] Fix build error on FFmpeg 9
+
+---
+ src/hardware/hardware.cpp | 21 +++++++++++++++++++--
+ 1 file changed, 19 insertions(+), 2 deletions(-)
+
+diff --git src/hardware/hardware.cpp src/hardware/hardware.cpp
+index 79de484d2a..8cf82a3446 100644
+--- src/hardware/hardware.cpp
++++ src/hardware/hardware.cpp
+@@ -1288,10 +1288,27 @@ void CAPTURE_AddImage(Bitu width, Bitu height, Bitu bpp, Bitu pitch, Bitu flags,
+ 			#else
+ 			ffmpeg_aud_ctx->ch_layout = AV_CHANNEL_LAYOUT_STEREO;
+ 			#endif
+-
++#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
++            // Legacy support for FFmpeg not supporting avcodec_get_supported_config()
+ 			if (ffmpeg_aud_codec->sample_fmts != NULL)
+ 				ffmpeg_aud_ctx->sample_fmt = (ffmpeg_aud_codec->sample_fmts)[0];
+-			else
++#else
++            // For FFmpeg supporting avcodec_get_supported_config()
++            const enum AVSampleFormat* formats = NULL;
++
++            const int ret = avcodec_get_supported_config(
++                NULL,
++                ffmpeg_aud_codec,
++                AV_CODEC_CONFIG_SAMPLE_FORMAT,
++                0,
++                reinterpret_cast<const void**>(&formats),
++                NULL
++            );
++
++            if(ret >= 0 && formats != NULL)
++                ffmpeg_aud_ctx->sample_fmt = formats[0];
++#endif
++            else
+ 				ffmpeg_aud_ctx->sample_fmt = AV_SAMPLE_FMT_FLT;
+ 
+ 			if (avcodec_open2(ffmpeg_aud_ctx,ffmpeg_aud_codec,NULL) < 0) {
+
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.