From d5f2efa69c91d0df42d2e270f4cd65509591b206 Mon Sep 17 00:00:00 2001 From: "Jang,Pyohwan" Date: Tue, 14 Jul 2026 21:01:00 +0900 Subject: [PATCH 1/2] dosbox-x: fix build against ffmpeg 8.1.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #16042 bumped ffmpeg to 8.1.2 and updated Kodi/kodi-inputstream-ffmpegdirect patches accordingly, but dosbox-x also links against libavcodec directly and was missed. Its video capture code (src/hardware/hardware.cpp) still used APIs removed in ffmpeg 8: - avcodec_close() — removed; the surrounding avcodec_free_context() calls already close+free, so the redundant avcodec_close() calls are dropped - AVFrame::key_frame — removed; replaced with the AV_FRAME_FLAG_KEY flag - FF_PROFILE_AAC_LOW — renamed to AV_PROFILE_AAC_LOW Verified: dosbox-x (v2025.02.01) now builds and installs successfully for the rk3568 board with this patch applied. --- .../dosbox-x/005-ffmpeg8-api-fixes.patch | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 package/batocera/emulators/dosbox-x/005-ffmpeg8-api-fixes.patch diff --git a/package/batocera/emulators/dosbox-x/005-ffmpeg8-api-fixes.patch b/package/batocera/emulators/dosbox-x/005-ffmpeg8-api-fixes.patch new file mode 100644 index 00000000000..4d9130d2b30 --- /dev/null +++ b/package/batocera/emulators/dosbox-x/005-ffmpeg8-api-fixes.patch @@ -0,0 +1,61 @@ +--- a/src/hardware/hardware.cpp ++++ b/src/hardware/hardware.cpp +@@ -123,20 +123,16 @@ + ffmpeg_avformat_began = false; + } + avio_close(ffmpeg_fmt_ctx->pb); +- if (ffmpeg_vid_ctx != NULL) avcodec_close(ffmpeg_vid_ctx); +- if (ffmpeg_aud_ctx != NULL) avcodec_close(ffmpeg_aud_ctx); + avformat_free_context(ffmpeg_fmt_ctx); + ffmpeg_fmt_ctx = NULL; + ffmpeg_vid_ctx = NULL; // NTS: avformat_free_context() freed this for us, don't free again + ffmpeg_aud_ctx = NULL; // NTS: avformat_free_context() freed this for us, don't free again + } + if (ffmpeg_vid_ctx != NULL) { +- avcodec_close(ffmpeg_vid_ctx); + avcodec_free_context(&ffmpeg_vid_ctx); + ffmpeg_vid_ctx = NULL; + } + if (ffmpeg_aud_ctx != NULL) { +- avcodec_close(ffmpeg_aud_ctx); + avcodec_free_context(&ffmpeg_aud_ctx); + ffmpeg_aud_ctx = NULL; + } +@@ -171,7 +167,7 @@ + + if (!pkt) E_Exit("Error: Unable to alloc packet"); + +- ffmpeg_aud_frame->key_frame = 1; ++ ffmpeg_aud_frame->flags |= AV_FRAME_FLAG_KEY; + ffmpeg_aud_frame->pts = (int64_t)ffmpeg_audio_sample_counter; + r=avcodec_send_frame(ffmpeg_aud_ctx,ffmpeg_aud_frame); + if (r < 0 && r != AVERROR(EAGAIN)) +@@ -426,7 +422,6 @@ + + void ffmpeg_reopen_video(double fps,const int bpp) { + if (ffmpeg_vid_ctx != NULL) { +- avcodec_close(ffmpeg_vid_ctx); + avcodec_free_context(&ffmpeg_vid_ctx); + ffmpeg_vid_ctx = NULL; + } +@@ -1271,7 +1266,7 @@ + ffmpeg_aud_ctx->sample_rate = (int)capture.video.audiorate; + ffmpeg_aud_ctx->flags = 0; // do not use global headers + ffmpeg_aud_ctx->bit_rate = 320000; +- ffmpeg_aud_ctx->profile = FF_PROFILE_AAC_LOW; ++ ffmpeg_aud_ctx->profile = AV_PROFILE_AAC_LOW; + + #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,24,100) + ffmpeg_aud_ctx->channels = 2; +@@ -1531,7 +1526,10 @@ + + // encode it + ffmpeg_vid_frame->pts = (int64_t)capture.video.frames; // or else libx264 complains about non-monotonic timestamps +- ffmpeg_vid_frame->key_frame = ((capture.video.frames % 15) == 0)?1:0; ++ if ((capture.video.frames % 15) == 0) ++ ffmpeg_vid_frame->flags |= AV_FRAME_FLAG_KEY; ++ else ++ ffmpeg_vid_frame->flags &= ~AV_FRAME_FLAG_KEY; + + r=avcodec_send_frame(ffmpeg_vid_ctx,ffmpeg_vid_frame); + if (r < 0 && r != AVERROR(EAGAIN)) From ee19c7d6b87e833aafa5f003fde002b4fce9e6f2 Mon Sep 17 00:00:00 2001 From: "Jang,Pyohwan" Date: Fri, 17 Jul 2026 14:37:38 +0900 Subject: [PATCH 2/2] dosbox-x: disable avcodec capture instead of patching for ffmpeg 8.1.2 Per maintainer feedback: with the parallel build system, ffmpeg isn't actually present in dosbox-x's per-package host at build time, so it builds without capture support by default anyway - patching the source to compile against ffmpeg 8.1.2 was solving a problem the build doesn't actually have. --disable-avcodec matches what the build already does in practice, until ffmpeg is properly wired up as a dependency and dosbox-x gets updated. --- .../dosbox-x/005-ffmpeg8-api-fixes.patch | 61 ------------------- .../batocera/emulators/dosbox-x/dosbox-x.mk | 3 +- 2 files changed, 2 insertions(+), 62 deletions(-) delete mode 100644 package/batocera/emulators/dosbox-x/005-ffmpeg8-api-fixes.patch diff --git a/package/batocera/emulators/dosbox-x/005-ffmpeg8-api-fixes.patch b/package/batocera/emulators/dosbox-x/005-ffmpeg8-api-fixes.patch deleted file mode 100644 index 4d9130d2b30..00000000000 --- a/package/batocera/emulators/dosbox-x/005-ffmpeg8-api-fixes.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- a/src/hardware/hardware.cpp -+++ b/src/hardware/hardware.cpp -@@ -123,20 +123,16 @@ - ffmpeg_avformat_began = false; - } - avio_close(ffmpeg_fmt_ctx->pb); -- if (ffmpeg_vid_ctx != NULL) avcodec_close(ffmpeg_vid_ctx); -- if (ffmpeg_aud_ctx != NULL) avcodec_close(ffmpeg_aud_ctx); - avformat_free_context(ffmpeg_fmt_ctx); - ffmpeg_fmt_ctx = NULL; - ffmpeg_vid_ctx = NULL; // NTS: avformat_free_context() freed this for us, don't free again - ffmpeg_aud_ctx = NULL; // NTS: avformat_free_context() freed this for us, don't free again - } - if (ffmpeg_vid_ctx != NULL) { -- avcodec_close(ffmpeg_vid_ctx); - avcodec_free_context(&ffmpeg_vid_ctx); - ffmpeg_vid_ctx = NULL; - } - if (ffmpeg_aud_ctx != NULL) { -- avcodec_close(ffmpeg_aud_ctx); - avcodec_free_context(&ffmpeg_aud_ctx); - ffmpeg_aud_ctx = NULL; - } -@@ -171,7 +167,7 @@ - - if (!pkt) E_Exit("Error: Unable to alloc packet"); - -- ffmpeg_aud_frame->key_frame = 1; -+ ffmpeg_aud_frame->flags |= AV_FRAME_FLAG_KEY; - ffmpeg_aud_frame->pts = (int64_t)ffmpeg_audio_sample_counter; - r=avcodec_send_frame(ffmpeg_aud_ctx,ffmpeg_aud_frame); - if (r < 0 && r != AVERROR(EAGAIN)) -@@ -426,7 +422,6 @@ - - void ffmpeg_reopen_video(double fps,const int bpp) { - if (ffmpeg_vid_ctx != NULL) { -- avcodec_close(ffmpeg_vid_ctx); - avcodec_free_context(&ffmpeg_vid_ctx); - ffmpeg_vid_ctx = NULL; - } -@@ -1271,7 +1266,7 @@ - ffmpeg_aud_ctx->sample_rate = (int)capture.video.audiorate; - ffmpeg_aud_ctx->flags = 0; // do not use global headers - ffmpeg_aud_ctx->bit_rate = 320000; -- ffmpeg_aud_ctx->profile = FF_PROFILE_AAC_LOW; -+ ffmpeg_aud_ctx->profile = AV_PROFILE_AAC_LOW; - - #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,24,100) - ffmpeg_aud_ctx->channels = 2; -@@ -1531,7 +1526,10 @@ - - // encode it - ffmpeg_vid_frame->pts = (int64_t)capture.video.frames; // or else libx264 complains about non-monotonic timestamps -- ffmpeg_vid_frame->key_frame = ((capture.video.frames % 15) == 0)?1:0; -+ if ((capture.video.frames % 15) == 0) -+ ffmpeg_vid_frame->flags |= AV_FRAME_FLAG_KEY; -+ else -+ ffmpeg_vid_frame->flags &= ~AV_FRAME_FLAG_KEY; - - r=avcodec_send_frame(ffmpeg_vid_ctx,ffmpeg_vid_frame); - if (r < 0 && r != AVERROR(EAGAIN)) diff --git a/package/batocera/emulators/dosbox-x/dosbox-x.mk b/package/batocera/emulators/dosbox-x/dosbox-x.mk index 493cbee6970..dc40725f88d 100644 --- a/package/batocera/emulators/dosbox-x/dosbox-x.mk +++ b/package/batocera/emulators/dosbox-x/dosbox-x.mk @@ -18,7 +18,8 @@ DOSBOX_X_CONF_OPTS = --host="$(GNU_TARGET_NAME)" \ --prefix=/usr \ --disable-sdl \ --enable-sdl2 \ - --with-sdl2-prefix="$(STAGING_DIR)/usr" + --with-sdl2-prefix="$(STAGING_DIR)/usr" \ + --disable-avcodec define DOSBOX_X_CONFIGURE_CONFIG mkdir -p $(TARGET_DIR)/usr/share/batocera/datainit/system/configs/dosbox