From: Kirill A. Korinsky Subject: astro/celestia: compatibility with ffmpeg 9.0 To: Antoine Jacoutot Cc: OpenBSD ports Date: Thu, 13 Aug 2026 00:41:01 +0200 Antoine, I'd like to backport from upstream a diff to fix ffmpeg 9.0 compatibility in astro/celestia. Build tested against ffmpeg-9.0 and ffmpeg-8.1.2 Ok? Index: Makefile =================================================================== RCS file: /home/cvs/ports/astro/celestia/Makefile,v diff -u -p -r1.63 Makefile --- Makefile 25 Mar 2026 14:51:54 -0000 1.63 +++ Makefile 12 Aug 2026 22:27:01 -0000 @@ -5,6 +5,7 @@ GH_PROJECT= Celestia GH_COMMIT= 504e54ca7decb483c81f76357ada8bd95a7b0f47 DISTNAME= celestia-1.7.0pre20260319 +REVISION= 0 EPOCH= 0 SHARED_LIBS += celestia 0.0 # 0.0 Index: patches/patch-src_celestia_ffmpegcapture_cpp =================================================================== RCS file: patches/patch-src_celestia_ffmpegcapture_cpp diff -N patches/patch-src_celestia_ffmpegcapture_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_celestia_ffmpegcapture_cpp 12 Aug 2026 22:30:05 -0000 @@ -0,0 +1,61 @@ +https://github.com/CelestiaProject/Celestia/commit/c2152be2385429660a2c02351110a8af08db6df8 + +Index: src/celestia/ffmpegcapture.cpp +--- src/celestia/ffmpegcapture.cpp.orig ++++ src/celestia/ffmpegcapture.cpp +@@ -98,7 +98,8 @@ bool FFMPEGCapturePrivate::init(const std::filesystem: + + bool FFMPEGCapturePrivate::isSupportedPixelFormat(enum AVPixelFormat format) const + { +- const enum AVPixelFormat *p = vc->pix_fmts; ++#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 19, 100)) // ffmpeg < 7.1 ++ const AVPixelFormat* p = vc->pix_fmts; + if (p == nullptr) + return false; + +@@ -109,6 +110,20 @@ bool FFMPEGCapturePrivate::isSupportedPixelFormat(enum + } + + return false; ++#else ++ const void* p; ++ int ret = avcodec_get_supported_config(enc, vc, AV_CODEC_CONFIG_PIX_FORMAT, 0, &p, nullptr); ++ if (ret < 0) ++ return false; ++ ++ for (auto f = static_cast(p); *f != AV_PIX_FMT_NONE; ++f) ++ { ++ if (*f == format) ++ return true; ++ } ++ ++ return false; ++#endif + } + + #if AVCODEC_DEBUG +@@ -268,7 +283,15 @@ bool FFMPEGCapturePrivate::addStream(int width, int he + } + else + { ++#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 19, 100)) // ffmpeg < 7.1 + enc->pix_fmt = avcodec_find_best_pix_fmt_of_list(vc->pix_fmts, format, 0, nullptr); ++#else ++ const void* p; ++ int ret = avcodec_get_supported_config(enc, vc, AV_CODEC_CONFIG_PIX_FORMAT, 0, &p, nullptr); ++ enc->pix_fmt = ret >= 0 ++ ? avcodec_find_best_pix_fmt_of_list(static_cast(p), format, 0, nullptr) ++ : AV_PIX_FMT_NONE; ++#endif + if (enc->pix_fmt == AV_PIX_FMT_NONE) + avcodec_default_get_format(enc, &(enc->pix_fmt)); + } +@@ -451,7 +474,7 @@ bool FFMPEGCapturePrivate::writeVideoFrame(bool finali + frame->pts = nextPts++; + } + +-#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)) ++#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)) // ffmpeg < 4.4 + av_init_packet(pkt); + #endif + -- wbr, Kirill