From a6ff2942d1d0df6217e0a7abde9cae6c42daee6a Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Wed, 14 Oct 2026 20:23:11 +0100 Subject: [PATCH] Fix FFMpeg 6 compatibility. --- sdrgui/dtv/dtvstreamremuxer.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sdrgui/dtv/dtvstreamremuxer.cpp b/sdrgui/dtv/dtvstreamremuxer.cpp index 53a357c80..db4e64127 100644 --- a/sdrgui/dtv/dtvstreamremuxer.cpp +++ b/sdrgui/dtv/dtvstreamremuxer.cpp @@ -195,7 +195,13 @@ void DTVStreamRemuxer::run() } uint8_t *ioBuffer = (uint8_t *) av_malloc(m_ioBufferSize); - out->pb = avio_alloc_context(ioBuffer, m_ioBufferSize, 1, this, nullptr, &DTVStreamRemuxer::writePacket, nullptr); + // FFmpeg 7 (libavformat 61) made the buffer const +#if LIBAVFORMAT_VERSION_MAJOR >= 61 + int (*write)(void *, const uint8_t *, int) = &DTVStreamRemuxer::writePacket; +#else + int (*write)(void *, uint8_t *, int) = [](void *opaque, uint8_t *buf, int size) { return writePacket(opaque, buf, size); }; +#endif + out->pb = avio_alloc_context(ioBuffer, m_ioBufferSize, 1, this, nullptr, write, nullptr); out->flags |= AVFMT_FLAG_CUSTOM_IO; AVDictionary *muxOptions = nullptr; av_dict_set(&muxOptions, "mpegts_flags", "resend_headers", 0);