From 1e3f261d811caf8ae5bba29e5e16075b31fb36ab Mon Sep 17 00:00:00 2001 From: David GUGLIELMI Date: Sat, 6 Sep 2025 15:55:49 +0200 Subject: [PATCH] Fix build with system libheif >= 1.20.0 A change occurred in the libheif API for versions 1.20.0 and 1.20.1, which is incompatible with versions 1.19 and >= 1.20.2 Issue https://github.com/strukturag/libheif/issues/1566 This patch fixes the compilation of the addon that uses the system versions of libheif. The fix has been tested on Gentoo Linux with media-libs/libheif 1.19.8, 1.20.1, and 1.20.2. --- src/HeifPicture.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/HeifPicture.cpp b/src/HeifPicture.cpp index 2ade65e..6d4b2c7 100644 --- a/src/HeifPicture.cpp +++ b/src/HeifPicture.cpp @@ -187,8 +187,16 @@ bool HeifPicture::Decode(uint8_t* pixels, return false; } +#if LIBHEIF_HAVE_VERSION(1,20,2) + size_t stride; + const uint8_t* data = img.get_plane2(heif_channel_interleaved, &stride); +#elif LIBHEIF_HAVE_VERSION(1,20,0) + size_t stride; + const uint8_t* data = img.get_plane(heif_channel_interleaved, &stride); +#else int stride; const uint8_t* data = img.get_plane(heif_channel_interleaved, &stride); +#endif if (!data) return false;