Control: tags 1144034 + patch
Control: tags 1144034 + pending

Dear maintainer,

I've prepared an NMU for kodi-inputstream-ffmpegdirect (versioned as 
21.3.8+ds-1.2)
and uploaded it to DELAYED/2. Please feel free to tell me if I should 
cancel it.

cu
Adrian
diffstat for kodi-inputstream-ffmpegdirect-21.3.8+ds kodi-inputstream-ffmpegdirect-21.3.8+ds

 changelog                                                               |    7 
 patches/0001-Fix-build-against-ffmpeg-9-by-using-av_parser_parse2.patch |   91 ++++++++++
 patches/series                                                          |    1 
 3 files changed, 99 insertions(+)

diff -Nru kodi-inputstream-ffmpegdirect-21.3.8+ds/debian/changelog kodi-inputstream-ffmpegdirect-21.3.8+ds/debian/changelog
--- kodi-inputstream-ffmpegdirect-21.3.8+ds/debian/changelog	2026-01-04 19:13:22.000000000 +0200
+++ kodi-inputstream-ffmpegdirect-21.3.8+ds/debian/changelog	2026-10-03 19:00:31.000000000 +0300
@@ -1,3 +1,10 @@
+kodi-inputstream-ffmpegdirect (21.3.8+ds-1.2) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Backport upstream fix for FTBFS with FFmpeg 9. (Closes: #1144034)
+
+ -- Adrian Bunk <[email protected]>  Sat, 03 Oct 2026 19:00:31 +0300
+
 kodi-inputstream-ffmpegdirect (21.3.8+ds-1.1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru kodi-inputstream-ffmpegdirect-21.3.8+ds/debian/patches/0001-Fix-build-against-ffmpeg-9-by-using-av_parser_parse2.patch kodi-inputstream-ffmpegdirect-21.3.8+ds/debian/patches/0001-Fix-build-against-ffmpeg-9-by-using-av_parser_parse2.patch
--- kodi-inputstream-ffmpegdirect-21.3.8+ds/debian/patches/0001-Fix-build-against-ffmpeg-9-by-using-av_parser_parse2.patch	1970-01-01 02:00:00.000000000 +0200
+++ kodi-inputstream-ffmpegdirect-21.3.8+ds/debian/patches/0001-Fix-build-against-ffmpeg-9-by-using-av_parser_parse2.patch	2026-10-03 19:00:04.000000000 +0300
@@ -0,0 +1,91 @@
+From 06af182e3bccc409025992e6f6ef6367c61b20b3 Mon Sep 17 00:00:00 2001
+From: Kel Modderman <[email protected]>
+Date: Mon, 10 Aug 2026 23:27:47 +1000
+Subject: Fix build against ffmpeg 9 by using av_parser_parse2()
+
+ffmpeg 9 made AVCodecParser::parser_parse private, so the direct call in
+FFmpegStream::ParsePacket() no longer compiles.
+
+Kodi core hit this in the same function and moved to the public
+av_parser_parse2() in xbmc/xbmc@c4913a2 (the ffmpeg 8.1 bump). This code
+came from core originally (07ea26d), so do the same here: drop the
+parser_parse guard, check m_codecCtx in the outer if instead, and bail
+out if av_parser_parse2() fails. PARSER_FLAG_COMPLETE_FRAMES stays set,
+so behaviour is unchanged.
+
+Fixes #381
+
+Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
+---
+ src/stream/FFmpegStream.cpp | 47 ++++++++++++++++++++-----------------
+ 1 file changed, 25 insertions(+), 22 deletions(-)
+
+diff --git a/src/stream/FFmpegStream.cpp b/src/stream/FFmpegStream.cpp
+index 64838dd..8a39fc9 100644
+--- a/src/stream/FFmpegStream.cpp
++++ b/src/stream/FFmpegStream.cpp
+@@ -1669,6 +1669,7 @@ void FFmpegStream::ParsePacket(AVPacket* pkt)
+ 
+     if (parser->second->m_parserCtx &&
+         parser->second->m_parserCtx->parser &&
++        parser->second->m_codecCtx &&
+         !st->codecpar->extradata)
+     {
+       FFmpegExtraData retExtraData = GetPacketExtradata(pkt, st->codecpar);
+@@ -1677,29 +1678,31 @@ void FFmpegStream::ParsePacket(AVPacket* pkt)
+         st->codecpar->extradata_size = retExtraData.GetSize();
+         st->codecpar->extradata = retExtraData.TakeData();
+ 
+-        if (parser->second->m_parserCtx->parser->parser_parse)
++        parser->second->m_codecCtx->extradata = st->codecpar->extradata;
++        parser->second->m_codecCtx->extradata_size = st->codecpar->extradata_size;
++        uint8_t* outbufptr;
++        int bufSize;
++        parser->second->m_parserCtx->flags |= PARSER_FLAG_COMPLETE_FRAMES;
++        int ret = av_parser_parse2(parser->second->m_parserCtx, parser->second->m_codecCtx,
++                                   &outbufptr, &bufSize, pkt->data, pkt->size,
++                                   pkt->pts, pkt->dts, pkt->pos);
++        parser->second->m_codecCtx->extradata = nullptr;
++        parser->second->m_codecCtx->extradata_size = 0;
++
++        if (ret < 0)
+         {
+-          parser->second->m_codecCtx->extradata = st->codecpar->extradata;
+-          parser->second->m_codecCtx->extradata_size = st->codecpar->extradata_size;
+-          const uint8_t* outbufptr;
+-          int bufSize;
+-          parser->second->m_parserCtx->flags |= PARSER_FLAG_COMPLETE_FRAMES;
+-          parser->second->m_parserCtx->parser->parser_parse(parser->second->m_parserCtx,
+-                                                            parser->second->m_codecCtx,
+-                                                            &outbufptr, &bufSize,
+-                                                            pkt->data, pkt->size);
+-          parser->second->m_codecCtx->extradata = nullptr;
+-          parser->second->m_codecCtx->extradata_size = 0;
+-
+-          if (parser->second->m_parserCtx->width != 0)
+-          {
+-            st->codecpar->width = parser->second->m_parserCtx->width;
+-            st->codecpar->height = parser->second->m_parserCtx->height;
+-          }
+-          else
+-          {
+-            Log(LOGLEVEL_ERROR, "CDVDDemuxFFmpeg::ParsePacket() invalid width/height");
+-          }
++          Log(LOGLEVEL_ERROR, "%s - error parsing packet: %d", __FUNCTION__, ret);
++          return;
++        }
++
++        if (parser->second->m_parserCtx->width != 0)
++        {
++          st->codecpar->width = parser->second->m_parserCtx->width;
++          st->codecpar->height = parser->second->m_parserCtx->height;
++        }
++        else
++        {
++          Log(LOGLEVEL_ERROR, "CDVDDemuxFFmpeg::ParsePacket() invalid width/height");
+         }
+       }
+     }
+-- 
+2.47.3
+
diff -Nru kodi-inputstream-ffmpegdirect-21.3.8+ds/debian/patches/series kodi-inputstream-ffmpegdirect-21.3.8+ds/debian/patches/series
--- kodi-inputstream-ffmpegdirect-21.3.8+ds/debian/patches/series	2026-01-04 19:13:22.000000000 +0200
+++ kodi-inputstream-ffmpegdirect-21.3.8+ds/debian/patches/series	2026-10-03 19:00:31.000000000 +0300
@@ -1,3 +1,4 @@
 0000-ffmpeg7.patch
 0001-pr320.patch
 0001-depends-switch-to-ffmpeg8.patch
+0001-Fix-build-against-ffmpeg-9-by-using-av_parser_parse2.patch

Reply via email to