[gimp/gimp-2-10] configure.ac, plug-ins: make file-heif build with older libheif again



commit e918a937d524c26a0e5d304daa2fa418d691cfd1
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jun 25 13:20:07 2019 +0200

    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.
    
    (cherry picked from commit 62f010df909f585c7bb19da695b35bf2f29ddb73)

 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 5ca912c1e5..ffb8919265 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,7 +64,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])
@@ -1792,7 +1792,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)"])
@@ -1805,6 +1808,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
@@ -3030,6 +3038,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 6c15f7e419..237213e2cc 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);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]