summaryrefslogtreecommitdiff
path: root/src/video_dec/image.c
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2011-12-10 22:49:27 +0000
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2011-12-10 22:49:27 +0000
commit471aee5bb21bb5d568ac1ddaea0b35c18cda5c07 (patch)
tree77d42d4a0c337d4001d100b49b785f2604deeb0e /src/video_dec/image.c
parentc6324255117128d3a7a9f614c756022d3ef7461d (diff)
parent508e9088eec8f00b5dea9571383480803d4ad45e (diff)
downloadxine-lib-471aee5bb21bb5d568ac1ddaea0b35c18cda5c07.tar.gz
xine-lib-471aee5bb21bb5d568ac1ddaea0b35c18cda5c07.tar.bz2
Merge from 1.1.
--HG-- rename : src/liba52/xine_a52_decoder.c => src/audio_dec/xine_a52_decoder.c rename : src/libspudvb/xine_spudvb_decoder.c => src/spu_dec/spudvb_decoder.c rename : src/libxinevdec/image.c => src/video_dec/image.c
Diffstat (limited to 'src/video_dec/image.c')
-rw-r--r--src/video_dec/image.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/video_dec/image.c b/src/video_dec/image.c
index cbbb9d722..e91588702 100644
--- a/src/video_dec/image.c
+++ b/src/video_dec/image.c
@@ -54,6 +54,17 @@
#include <xine/xineutils.h>
#include "bswap.h"
+#ifdef HAVE_GRAPHICSMAGICK
+# define MAGICK_VERSION 0x670
+#else
+# if !defined(MagickLibVersion) || MagickLibVersion < 0x671
+# define MAGICK_VERSION 0x670
+#else
+# define MAGICK_VERSION MagickLibVersion
+# endif
+#endif
+
+
typedef struct {
video_decoder_class_t decoder_class;
@@ -101,14 +112,23 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
/*
* this->image -> rgb data
*/
+#if MAGICK_VERSION < 0x671
InitializeMagick(NULL);
+#else
+ MagickWandGenesis();
+#endif
wand = NewMagickWand();
status = MagickReadImageBlob(wand, this->image, this->index);
+
this->index = 0;
if (!status) {
DestroyMagickWand(wand);
+#if MAGICK_VERSION < 0x671
DestroyMagick();
+#else
+ MagickWandTerminus();
+#endif
lprintf("error loading image\n");
return;
}
@@ -116,9 +136,15 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
width = MagickGetImageWidth(wand) & ~1; /* must be even for init_yuv_planes */
height = MagickGetImageHeight(wand);
img_buf = malloc(width * height * 3);
+#if MAGICK_VERSION < 0x671
MagickGetImagePixels(wand, 0, 0, width, height, "RGB", CharPixel, img_buf);
DestroyMagickWand(wand);
DestroyMagick();
+#else
+ MagickExportImagePixels(wand, 0, 0, width, height, "RGB", CharPixel, img_buf);
+ DestroyMagickWand(wand);
+ MagickWandTerminus();
+#endif
_x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, width);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, height);