pngdec: fix build with libpng versions between 1.2 and 1.5.1
authorAndreas Frisch <fraxinas@dreambox.guru>
Thu, 19 Oct 2017 16:23:34 +0000 (18:23 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Fri, 20 Oct 2017 07:31:31 +0000 (09:31 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=765927

configure.ac
ext/libpng/gstpngdec.c

index 3aaa27d..69ae3d1 100644 (file)
@@ -701,6 +701,11 @@ dnl *** libpng ***
 translit(dnm, m, l) AM_CONDITIONAL(USE_LIBPNG, true)
 AG_GST_CHECK_FEATURE(LIBPNG, [Portable Network Graphics library], png, [
   AG_GST_PKG_CHECK_MODULES(LIBPNG, libpng >= 1.2)
+  if test $HAVE_LIBPNG = "yes"; then
+    PKG_CHECK_MODULES(LIBPNG, libpng >= 1.5.1, [
+        AC_DEFINE(HAVE_LIBPNG_1_5, 1, [Defined if libpng version is 1.5.1 or newer])
+      ], [true])
+  fi
 ])
 
 dnl *** mpg123 ***
index acadf54..581e3a9 100644 (file)
@@ -341,7 +341,7 @@ gst_pngdec_caps_create_and_set (GstPngDec * pngdec)
     }
     gst_video_codec_state_unref (pngdec->output_state);
   }
-
+#ifdef HAVE_LIBPNG_1_5
   if ((pngdec->color_type & PNG_COLOR_MASK_COLOR)
       && !(pngdec->color_type & PNG_COLOR_MASK_PALETTE)
       && png_get_valid (pngdec->png, pngdec->info, PNG_INFO_iCCP)) {
@@ -386,6 +386,7 @@ gst_pngdec_caps_create_and_set (GstPngDec * pngdec)
       gst_tag_list_unref (taglist);
     }
   }
+#endif
 
   pngdec->output_state =
       gst_video_decoder_set_output_state (GST_VIDEO_DECODER (pngdec), format,