From ced850c5fae85e80ca11c90633ab2dc50b446b0f Mon Sep 17 00:00:00 2001 From: "Akram H. Sharkar" Date: Tue, 3 Feb 2026 14:21:01 -0500 Subject: [PATCH] Fix compatibility with FFmpeg 6.x - Add missing #include for AVBSFContext and av_bsf_free declarations which were moved to a separate header in newer FFmpeg versions - Change AVCodec* to const AVCodec* in SetVideoStream() to match the updated signature of av_find_best_stream() in FFmpeg 6.x Tested with FFmpeg 6.0 (libavcodec 60.31.102, libavformat 60.16.100) --- src/video/ffmpeg/ffmpeg_common.h | 1 + src/video/video_reader.cc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/video/ffmpeg/ffmpeg_common.h b/src/video/ffmpeg/ffmpeg_common.h index b0b973f9..f0f73169 100644 --- a/src/video/ffmpeg/ffmpeg_common.h +++ b/src/video/ffmpeg/ffmpeg_common.h @@ -21,6 +21,7 @@ extern "C" { #endif #include +#include #include #include #include diff --git a/src/video/video_reader.cc b/src/video/video_reader.cc index af4858d2..99c96357 100644 --- a/src/video/video_reader.cc +++ b/src/video/video_reader.cc @@ -145,7 +145,7 @@ VideoReader::~VideoReader(){ void VideoReader::SetVideoStream(int stream_nb) { if (!fmt_ctx_) return; - AVCodec *dec; + const AVCodec *dec; int st_nb = av_find_best_stream(fmt_ctx_.get(), AVMEDIA_TYPE_VIDEO, stream_nb, -1, &dec, 0); // LOG(INFO) << "find best stream: " << st_nb; CHECK_GE(st_nb, 0) << "ERROR cannot find video stream with wanted index: " << stream_nb;