From 62f010df909f585c7bb19da695b35bf2f29ddb73 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Tue, 25 Jun 2019 13:20:07 +0200 Subject: [PATCH] configure.ac, plug-ins: make file-heif build with older libheif again Lower requirement to 1.3.2 and check for 1.4.0 separately. Put color profile code in #ifdef HAVE_LIBHEIF_1_4_0. --- configure.ac | 11 ++++++++++- plug-ins/common/file-heif.c | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 2c4c9f32ab..4e86462877 100644 --- a/configure.ac +++ b/configure.ac @@ -65,7 +65,7 @@ m4_define([harfbuzz_required_version], [0.9.19]) m4_define([intltool_required_version], [0.40.1]) m4_define([lcms_required_version], [2.8]) m4_define([libgudev_required_version], [167]) -m4_define([libheif_required_version], [1.4.0]) +m4_define([libheif_required_version], [1.3.2]) m4_define([liblzma_required_version], [5.0.0]) m4_define([libmypaint_required_version], [1.3.0]) m4_define([libpng_required_version], [1.6.25]) @@ -1776,7 +1776,10 @@ AC_ARG_WITH(libheif, [ --without-libheif build without libheif support]) have_libheif=no if test "x$with_libheif" != xno; then + have_libheif_1_4_0=yes have_libheif=yes + PKG_CHECK_MODULES(LIBHEIF, libheif >= 1.4.0,, + [have_libheif_1_4_0="no (libheif >= 1.4.0 not found)"]) PKG_CHECK_MODULES(LIBHEIF, libheif >= libheif_required_version, FILE_HEIF='file-heif$(EXEEXT)', [have_libheif="no (libheif not found)"]) @@ -1789,6 +1792,11 @@ fi AC_SUBST(FILE_HEIF) AM_CONDITIONAL(HAVE_LIBHEIF, test "x$have_libheif" = xyes) +if test "x$have_libheif_1_4_0" = xyes; then + AC_DEFINE(HAVE_LIBHEIF_1_4_0, 1, + [Define to 1 if libheif >= 1.4.0 is available]) +fi + ######################## # Check for libbacktrace @@ -3010,6 +3018,7 @@ Optional Plug-Ins: OpenEXR: $have_openexr WebP: $have_webp Heif: $have_libheif + Heif >= 1.4.0: $have_libheif_1_4_0 PDF (export): $have_cairo_pdf Print: $enable_print Python 2: $enable_python diff --git a/plug-ins/common/file-heif.c b/plug-ins/common/file-heif.c index 0ccb3e2551..f22963b319 100644 --- a/plug-ins/common/file-heif.c +++ b/plug-ins/common/file-heif.c @@ -479,6 +479,7 @@ load_image (GFile *file, return -1; } +#ifdef HAVE_LIBHEIF_1_4_0 switch (heif_image_handle_get_color_profile_type (handle)) { case heif_color_profile_type_not_present: @@ -506,6 +507,7 @@ load_image (GFile *file, g_free (profile_data); } break; + default: /* heif_color_profile_type_nclx (what is that?) and any future * profile type which we don't support in GIMP (yet). @@ -514,6 +516,7 @@ load_image (GFile *file, G_STRFUNC); break; } +#endif /* HAVE_LIBHEIF_1_4_0 */ gimp_progress_update (0.75); @@ -697,11 +700,13 @@ save_image (GFile *file, if (profile) { +#ifdef HAVE_LIBHEIF_1_4_0 const guint8 *icc_data; gsize icc_length; icc_data = gimp_color_profile_get_icc_profile (profile, &icc_length); heif_image_set_raw_color_profile (image, "prof", icc_data, icc_length); +#endif /* HAVE_LIBHEIF_1_4_0 */ g_object_unref (profile); }