From aa7742c70169dce5fec9ac7911e8e778452027e1 Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Sun, 30 Jun 2024 20:52:08 +0800 Subject: [PATCH] Fix compilation on ubuntu noble with FFMPEG 6.0 (#21) Ubuntu noble ships with FFMPEG 6.0 where `AV_CODEC_CAP_TRUNCATED` is not defined. I based my work of off https://github.com/obsproject/obs-studio/issues/8375 Co-authored-by: Michael Welter --- src/h264decoder.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/h264decoder.cpp b/src/h264decoder.cpp index c4083c9..dc49c3a 100644 --- a/src/h264decoder.cpp +++ b/src/h264decoder.cpp @@ -34,10 +34,12 @@ H264Decoder::H264Decoder() if (!context) throw H264InitFailure("cannot allocate context"); +#if LIBAVCODEC_VERSION_MAJOR < 60 // Note: CODEC_CAP_TRUNCATED was prefixed with AV_... if(codec->capabilities & AV_CODEC_CAP_TRUNCATED) { context->flags |= AV_CODEC_FLAG_TRUNCATED; - } + } +#endif int err = avcodec_open2(context, codec, nullptr); if (err < 0) @@ -169,4 +171,4 @@ int row_size(const AVFrame& f) void disable_logging() { av_log_set_level(AV_LOG_QUIET); -} \ No newline at end of file +}