commit 30b86dceb5bc11900ba75ddddda7b627421338df
parent 81f044b5c969970b6f050b7a4c2b1efae7c8634f
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 31 May 2005 19:27:19 +0000
update
Diffstat:
11 files changed, 74 insertions(+), 87 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -1,8 +1,8 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
-AC_INIT([libextractor], [0.5.0], [bug-libextractor@gnu.org])
+AC_INIT([libextractor], [0.5.1], [bug-libextractor@gnu.org])
AC_REVISION($Revision: 1.67 $)
-AM_INIT_AUTOMAKE([libextractor], [0.5.0])
+AM_INIT_AUTOMAKE([libextractor], [0.5.1])
AM_CONFIG_HEADER(src/include/config.h)
# Checks for programs.
@@ -149,25 +149,6 @@ AC_CHECK_HEADERS([ltdl.h iconv.h])
AC_CHECK_HEADERS([jni.h])
# jni.h is purely optional! But if not present => no Java support!
-AC_CHECK_HEADERS([wand/magick-wand.h])
-
-AC_PATH_PROG(WAND_CONFIG, Wand-config, no)
-if test "$WAND_CONFIG" = "no" ; then
- AC_MSG_RESULT([*** All Imagemagick dependent parts will be disabled, Wand-config not found. ***])
-else
- WAND_CFLAGS=`$WAND_CONFIG --cflags`
- WAND_LDFLAGS=`$WAND_CONFIG --ldflags`
- WAND_LIBS=`$WAND_CONFIG --libs`
- have_imagemagick="yes"
- AC_DEFINE(HAVE_WAND,1,[Define this if you have Imagemagick])
-fi
-
-AM_CONDITIONAL(HAVE_WAND, test x"$have_imagemagick" = "xyes" )
-AC_SUBST(WAND_CFLAGS)
-AC_SUBST(WAND_LDFLAGS)
-AC_SUBST(WAND_LIBS)
-
-
AC_PYTHON_DEVEL
AC_CHECK_HEADERS([vorbis/vorbisfile.h])
@@ -227,6 +208,18 @@ else
fi
+# check for gtk >= 2.6.0
+AC_MSG_CHECKING(for gtk)
+AM_PATH_GTK_2_0(2.6.0,without_gtk=false,without_gtk=true)
+AM_CONDITIONAL(HAVE_GTK, test x$without_gtk != xtrue)
+if test $without_gtk != true
+then
+ AC_DEFINE_UNQUOTED([HAVE_GTK], 1, [We have GTK])
+else
+ AM_CONDITIONAL(HAVE_GTK,false)
+fi
+
+
printable=1
AC_MSG_CHECKING([whether to enable printable extractors])
diff --git a/src/include/extractor.h b/src/include/extractor.h
@@ -29,7 +29,7 @@ extern "C" {
* 0.2.6-1 => 0x00020601
* 4.5.2-0 => 0x04050200
*/
-#define EXTRACTOR_VERSION 0x00050000
+#define EXTRACTOR_VERSION 0x00050001
#include <stdio.h>
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
@@ -10,7 +10,7 @@ if HAVE_GLIB
oledir=ole2
endif
-if HAVE_WAND
+if HAVE_GTK
thumbdir=thumbnail
endif
diff --git a/src/plugins/mp3extractor.c b/src/plugins/mp3extractor.c
@@ -243,21 +243,10 @@ int freq_table[4][3]={
#define SYSERR 1
#define INVALID_ID3 2
-/**
- * Remove trailing whitespace from the end of a string
- */
-static char * unpad(char * string) {
- char * end = &string[strlen(string) - 1];
- while ( (end >= string) &&
- (' ' == end[0]) )
- (end--)[0]='\0';
- return string;
-}
-
static int get_id3(unsigned char * data,
size_t size,
id3tag * id3) {
- char * pos;
+ unsigned char * pos;
if (size < 128)
return INVALID_ID3;
@@ -312,7 +301,6 @@ mp3parse(char * data,
int counter=0;
char mpeg_ver=0;
char layer_ver=0;
- char tag[128];
int idx_num=0;
int bitrate=0; /*used for each frame*/
int avg_bps=0; /*average bitrate*/
diff --git a/src/plugins/mpegextractor.c b/src/plugins/mpegextractor.c
@@ -30,6 +30,7 @@
#include "platform.h"
#include "extractor.h"
#include "pack.h"
+#include <math.h>
static void addKeyword(struct EXTRACTOR_Keywords ** list,
char * keyword,
@@ -67,7 +68,6 @@ struct EXTRACTOR_Keywords * libextractor_mpeg_extract(char * filename,
struct EXTRACTOR_Keywords * prev) {
unsigned int version = 0;
unsigned int bitrate = 0;
- unsigned int fps = 0;
unsigned int height = 0;
unsigned int width = 0;
unsigned int temp;
diff --git a/src/plugins/ole2/ole2extractor.c b/src/plugins/ole2/ole2extractor.c
@@ -41,7 +41,7 @@
/* using libgobject, needs init! */
void __attribute__ ((constructor)) ole_gobject_init(void) {
- g_type_init(); /* really needed??? */
+ g_type_init();
}
static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead,
diff --git a/src/plugins/printable/dictionary-builder.c b/src/plugins/printable/dictionary-builder.c
@@ -38,7 +38,6 @@ int main(int argc,
char ** argv) {
Bloomfilter bf;
HashCode160 hc;
- int val=1; /* for endianness */
int i;
int cnt;
char * fn;
diff --git a/src/plugins/thumbnail/Makefile.am b/src/plugins/thumbnail/Makefile.am
@@ -1,4 +1,6 @@
-INCLUDES = -I$(top_srcdir)/src/include
+INCLUDES = \
+ -I$(top_srcdir)/src/include \
+ @GTK_CFLAGS@
LIBS = \
@LTLIBINTL@ @LIBS@
@@ -8,17 +10,21 @@ plugindir = $(libdir)/libextractor
SUBDIRS = .
+AM_CFLAGS = $(GLIB_CFLAGS)
+
plugin_LTLIBRARIES = \
libextractor_thumbnail.la
libextractor_thumbnail_la_SOURCES = \
thumbnailextractor.c
+# Ok, linking this one is complicated, see Mantis #787.
libextractor_thumbnail_la_LDFLAGS = \
- -export-dynamic -avoid-version -module @WAND_LDFLAGS@
-
-libextractor_thumbnail_la_CFLAGS = \
- @WAND_CFLAGS@ @CFLAGS@
+ -Wl,-Bstatic -Wl,-lgobject-2.0 -Wl,-lglib-2.0 -Wl,-Bdynamic \
+ -Wl,-Bsymbolic -avoid-version -module
libextractor_thumbnail_la_LIBADD = \
- @WAND_LIBS@
+ @GTK_LIBS@
+
+
+
diff --git a/src/plugins/thumbnail/thumbnailextractor.c b/src/plugins/thumbnail/thumbnailextractor-old.c
diff --git a/src/plugins/thumbnail/thumbnailextractor.c b/src/plugins/thumbnail/thumbnailextractor.c
@@ -22,17 +22,24 @@
* @file thumbnailextractor.c
* @author Christian Grothoff
* @brief this extractor produces a binary (!) encoded
- * thumbnail of images (using imagemagick). The bottom
+ * thumbnail of images (using gdk pixbuf). The bottom
* of the file includes a decoder method that can be used
* to reproduce the 128x128 PNG thumbnails.
*/
#include "platform.h"
#include "extractor.h"
-#include <wand/magick_wand.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
#define THUMBSIZE 128
+
+/* using libgobject, needs init! */
+void __attribute__ ((constructor)) ole_gobject_init(void) {
+ g_type_init();
+}
+
+
static EXTRACTOR_KeywordList * addKeyword(EXTRACTOR_KeywordType type,
char * keyword,
EXTRACTOR_KeywordList * next) {
@@ -72,8 +79,8 @@ struct EXTRACTOR_Keywords * libextractor_thumbnail_extract(const char * filename
const char * data,
size_t size,
struct EXTRACTOR_Keywords * prev) {
- MagickBooleanType status;
- MagickWand * magick_wand;
+ GdkPixbuf * in;
+ GdkPixbuf * out;
size_t length;
char * thumb;
unsigned long width;
@@ -87,6 +94,7 @@ struct EXTRACTOR_Keywords * libextractor_thumbnail_extract(const char * filename
unsigned char marker;
const char * mime;
int j;
+ char * format;
/* if the mime-type of the file is not whitelisted
do not run the thumbnail extactor! */
@@ -103,29 +111,31 @@ struct EXTRACTOR_Keywords * libextractor_thumbnail_extract(const char * filename
if (whitelist[j] == NULL)
return prev;
- magick_wand = NewMagickWand();
- status = MagickReadImageBlob(magick_wand, data, size);
- if (status == MagickFalse) {
- DestroyMagickWand(magick_wand);
+ in = gdk_pixbuf_new_from_file(filename,
+ NULL);
+ if (in == NULL)
return prev;
- }
- MagickResetIterator(magick_wand);
- if (MagickNextImage(magick_wand) == MagickFalse)
- return prev;
-
- height = MagickGetImageHeight(magick_wand);
- width = MagickGetImageWidth(magick_wand);
+ height = gdk_pixbuf_get_height(in);
+ width = gdk_pixbuf_get_width(in);
+ format = malloc(64);
+ snprintf(format,
+ 64,
+ "%ux%u",
+ (unsigned int) width,
+ (unsigned int) height);
+ prev
+ = addKeyword(EXTRACTOR_SIZE,
+ format,
+ prev);
if (height == 0)
height = 1;
if (width == 0)
width = 1;
if ( (height <= THUMBSIZE) &&
(width <= THUMBSIZE) ) {
- DestroyMagickWand(magick_wand);
+ g_object_unref(in);
return prev;
}
-
-
if (height > THUMBSIZE) {
width = width * THUMBSIZE / height;
height = THUMBSIZE;
@@ -134,31 +144,22 @@ struct EXTRACTOR_Keywords * libextractor_thumbnail_extract(const char * filename
height = height * THUMBSIZE / width;
width = THUMBSIZE;
}
- MagickResizeImage(magick_wand, height, width, LanczosFilter, 1.0);
- MagickSetImageDepth(magick_wand,
- 8);
- MagickSetImageChannelDepth(magick_wand,
- RedChannel,
- 2);
- MagickCommentImage(magick_wand, "");
- MagickSetImageChannelDepth(magick_wand,
- GreenChannel,
- 2);
- MagickSetImageChannelDepth(magick_wand,
- BlueChannel,
- 2);
- MagickSetImageChannelDepth(magick_wand,
- OpacityChannel,
- 2);
- MagickSetImageInterlaceScheme(magick_wand,
- NoInterlace);
-
- if (MagickFalse == MagickSetImageFormat(magick_wand, "png")) {
- DestroyMagickWand(magick_wand);
+ out = gdk_pixbuf_scale_simple(in,
+ width,
+ height,
+ GDK_INTERP_BILINEAR);
+ g_object_unref(in);
+ thumb = NULL;
+ if (! gdk_pixbuf_save_to_buffer(out,
+ &thumb,
+ &length,
+ "png",
+ NULL,
+ NULL)) {
+ g_object_unref(out);
return prev;
}
- thumb = MagickGetImageBlob(magick_wand, &length);
- DestroyMagickWand(magick_wand);
+ g_object_unref(out);
if (thumb == NULL)
return prev;
diff --git a/src/plugins/translitextractor.c b/src/plugins/translitextractor.c
@@ -552,7 +552,7 @@ struct EXTRACTOR_Keywords * libextractor_translit_extract(char * filename,
size_t size,
struct EXTRACTOR_Keywords * prev) {
struct EXTRACTOR_Keywords * pos;
- unsigned int mem, src, dest, len, i;
+ unsigned int mem, src, dest, len;
unsigned char *transl;
pos = prev;