package/libcamera-apps: fix build with ffmpeg 7.0

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
Cc: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Bernd Kuhls
2026-10-13 23:50:26 +02:00
committed by Thomas Petazzoni
parent 4f526f47ac
commit f2b44208c1
2 changed files with 85 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
From d67bc17a420b6c3519d4cfa24b4b4e5c7293165b Mon Sep 17 00:00:00 2001
From: Naushir Patuck <naush@raspberrypi.com>
Date: Wed, 8 Oct 2025 10:51:46 +0100
Subject: [PATCH] encoder: libav: Updates for ffmpeg v7.1
Fix some API breakages change for ffmpeg v7.1 packaged with Trixie.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Upstream: https://github.com/raspberrypi/rpicam-apps/commit/d67bc17a420b6c3519d4cfa24b4b4e5c7293165b
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
encoder/libav_encoder.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/encoder/libav_encoder.cpp b/encoder/libav_encoder.cpp
index 10c00e0..ba8b9fe 100644
--- a/encoder/libav_encoder.cpp
+++ b/encoder/libav_encoder.cpp
@@ -337,13 +337,13 @@ void LibAvEncoder::initAudioOutCodec(VideoOptions const *options, StreamInfo con
#if LIBAVCODEC_VERSION_MAJOR < 61
codec_ctx_[AudioOut]->sample_fmt = codec->sample_fmts[0];
#else
- enum AVSampleFormat **sample_fmts = nullptr;
+ const enum AVSampleFormat *sample_fmts = nullptr;
avcodec_get_supported_config(codec_ctx_[AudioOut], codec, AV_CODEC_CONFIG_SAMPLE_FORMAT, 0,
(const void **)&sample_fmts, nullptr);
if (!sample_fmts)
throw std::runtime_error("libav: no supported sample formats for audio codec");
else
- codec_ctx_[AudioOut]->sample_fmt = (*sample_fmts)[0];
+ codec_ctx_[AudioOut]->sample_fmt = sample_fmts[0];
#endif
codec_ctx_[AudioOut]->bit_rate = options->Get().audio_bitrate.bps();
@@ -652,7 +652,7 @@ void LibAvEncoder::audioThread()
uint32_t out_channels = codec_ctx_[AudioOut]->ch_layout.nb_channels;
#endif
- SwrContext *conv;
+ SwrContext *conv = nullptr;
AVAudioFifo *fifo;
#if LIBAVUTIL_VERSION_MAJOR < 57
--
2.47.3

View File

@@ -0,0 +1,37 @@
From 1a4860f36cffe167965351b7a59be46d7a7ae5ec Mon Sep 17 00:00:00 2001
From: Bernd Kuhls <bernd@kuhls.net>
Date: Sat, 10 Oct 2026 23:58:02 +0200
Subject: [PATCH] encoder: libav: fix build with ffmpeg 7.0
Adjust the version check according to ffmpeg docs:
https://code.ffmpeg.org/FFmpeg/FFmpeg/src/tag/n9.0.2/doc/APIchanges#L446
"2024-09-08 - 3305767560a - lavc 61.13.100 - avcodec.h
Add avcodec_get_supported_config() and enum AVCodecConfig; deprecate
AVCodec.pix_fmts, AVCodec.sample_fmts, AVCodec.supported_framerates,
AVCodec.supported_samplerates and AVCodec.ch_layouts."
Upstream: not applicable, support for older ffmpeg versions was removed:
https://github.com/raspberrypi/rpicam-apps/commit/cbe9921eeddd8e1c2e5798102f485baea5de3f65
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
encoder/libav_encoder.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/encoder/libav_encoder.cpp b/encoder/libav_encoder.cpp
index 31f5e55..8e24e7d 100644
--- a/encoder/libav_encoder.cpp
+++ b/encoder/libav_encoder.cpp
@@ -321,7 +321,7 @@ void LibAvEncoder::initAudioOutCodec(VideoOptions const *options, StreamInfo con
codec_ctx_[AudioOut]->sample_rate = options->Get().audio_samplerate ? options->Get().audio_samplerate
: stream_[AudioIn]->codecpar->sample_rate;
-#if LIBAVCODEC_VERSION_MAJOR < 61
+#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100))
codec_ctx_[AudioOut]->sample_fmt = codec->sample_fmts[0];
#else
const enum AVSampleFormat *sample_fmts = nullptr;
--
2.47.3