]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11022 #resolve ImageMagic 7 support
authorSeven Du <dujinfang@x-y-t.cn>
Tue, 13 Mar 2018 13:35:39 +0000 (21:35 +0800)
committerMuteesa Fred <muteesafred@hotmail.com>
Tue, 24 Jul 2018 07:21:47 +0000 (07:21 +0000)
configure.ac
src/mod/formats/mod_imagick/Makefile.am
src/mod/formats/mod_imagick/mod_imagick.c

index b8df6d1759aa240ea01264471de9507c6569a194..a52af80ccdbd34b428dd581c3b962df6e20f4494 100644 (file)
@@ -1389,6 +1389,10 @@ PKG_CHECK_MODULES([MAGICK], [ImageMagick >= 6.0.0],[
   AM_CONDITIONAL([HAVE_MAGICK],[true])],[
   AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MAGICK],[false])])
 
+PKG_CHECK_MODULES([MAGICK7], [ImageMagick >= 7.0.0],[
+  AM_CONDITIONAL([HAVE_MAGICK7],[true])],[
+  AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MAGICK7],[false])])
+
 PKG_CHECK_MODULES([SILK], [silk >= 1.0.8],[
   AM_CONDITIONAL([HAVE_SILK],[true])],[
   AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SILK],[false])])
index 19270b6003f0df22989609adf0da77fe609b5c6b..3bcc4017c103081f2175937f17eef0b7f3816ee1 100644 (file)
@@ -6,6 +6,11 @@ if HAVE_MAGICK
 mod_LTLIBRARIES = mod_imagick.la
 mod_imagick_la_SOURCES  = mod_imagick.c
 mod_imagick_la_CFLAGS   = $(AM_CFLAGS) $(MAGICK_CFLAGS)
+
+if HAVE_MAGICK7
+mod_imagick_la_CFLAGS  += -DHAVE_MAGIC7
+endif
+
 mod_imagick_la_LIBADD   = $(switch_builddir)/libfreeswitch.la $(MAGICK_LIBS)
 mod_imagick_la_LDFLAGS  = -avoid-version -module -no-undefined -shared
 
index 96efd74df0a09b1ddba7a44c14f0a38f205d3877..d008632b74f657b2ecbec5b22f593c636c0d3a74 100644 (file)
 #define MAGICKCORE_HDRI_ENABLE   0
 #endif
 
+#ifdef HAVE_MAGIC7
+#include <MagickCore/MagickCore.h>
+#else
 #include <magick/MagickCore.h>
-
+#endif
 
 #ifdef _MSC_VER
 // Disable MSVC warnings that suggest making code non-portable.
@@ -101,7 +104,13 @@ static void *SWITCH_THREAD_FUNC open_pdf_thread_run(switch_thread_t *thread, voi
                Image *tmp_images;
                switch_snprintf(path, sizeof(path), "%s[%d]", context->path, pagenumber);
                switch_set_string(context->image_info->filename, path);
+
+#ifdef HAVE_MAGIC7
+               if ((tmp_images = ReadImages(context->image_info, path, context->exception))) {
+#else
                if ((tmp_images = ReadImages(context->image_info, context->exception))) {
+#endif
+
                        pagenumber++;
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s page %d loaded\n", context->path, pagenumber);
                        AppendImageToList(&context->images, tmp_images);
@@ -229,7 +238,12 @@ static switch_status_t imagick_file_open(switch_file_handle_t *handle, const cha
                switch_set_string(context->image_info->filename, path);
        }
 
+#ifdef HAVE_MAGIC7
+       context->images = ReadImages(context->image_info, context->lazy ? range_path : path, context->exception);
+#else
        context->images = ReadImages(context->image_info, context->exception);
+#endif
+
        if (context->exception->severity != UndefinedException) {
                CatchException(context->exception);
        }