[tracker] build: Make libmediaart a soft dependency, not hard
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] build: Make libmediaart a soft dependency, not hard
- Date: Tue, 18 Mar 2014 16:05:15 +0000 (UTC)
commit 30dd98e54d3d0200d9b38487dfd8d4851bd49065
Author: Martyn Russell <martyn lanedo com>
Date: Tue Mar 18 16:04:22 2014 +0000
build: Make libmediaart a soft dependency, not hard
configure.ac | 50 ++++++++++++++++++++---
data/Makefile.am | 8 +++-
data/tracker-miner.pc.in | 2 +-
src/libtracker-miner/Makefile.am | 8 +++-
src/libtracker-miner/tracker-media-art.c | 4 ++
src/libtracker-miner/tracker-miner-fs.c | 4 ++
src/tracker-extract/tracker-extract-gstreamer.c | 30 ++++++++++++++
src/tracker-extract/tracker-extract-mp3.c | 4 ++
src/tracker-extract/tracker-main.c | 12 +++++
9 files changed, 112 insertions(+), 10 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4bf3c69..6a5fafc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -232,8 +232,7 @@ PKG_CHECK_MODULES(LIBTRACKER_BUS, [$LIBTRACKER_BUS_REQUIRED])
# Check requirements for libtracker-common
LIBTRACKER_COMMON_REQUIRED="glib-2.0 >= $GLIB_REQUIRED
- gio-unix-2.0 >= $GLIB_REQUIRED
- libmediaart-1.0 >= $LIBMEDIAART_REQUIRED"
+ gio-unix-2.0 >= $GLIB_REQUIRED"
PKG_CHECK_MODULES(LIBTRACKER_COMMON, [$LIBTRACKER_COMMON_REQUIRED])
@@ -274,8 +273,7 @@ PKG_CHECK_MODULES(LIBTRACKER_FTS, [$LIBTRACKER_FTS_REQUIRED])
# Check requirements for libtracker-miner
LIBTRACKER_MINER_REQUIRED="glib-2.0 >= $GLIB_REQUIRED
- gio-unix-2.0 >= $GLIB_REQUIRED
- libmediaart-1.0 >= $LIBMEDIAART_REQUIRED"
+ gio-unix-2.0 >= $GLIB_REQUIRED"
PKG_CHECK_MODULES(LIBTRACKER_MINER, [$LIBTRACKER_MINER_REQUIRED])
@@ -313,8 +311,7 @@ TRACKER_STORE_LIBS="$TRACKER_STORE_LIBS -lz -lm"
# Check requirements for tracker-extract
TRACKER_EXTRACT_REQUIRED="glib-2.0 >= $GLIB_REQUIRED
gio-unix-2.0 >= $GLIB_REQUIRED
- gmodule-2.0 >= $GLIB_REQUIRED
- libmediaart-1.0 >= $LIBMEDIAART_REQUIRED"
+ gmodule-2.0 >= $GLIB_REQUIRED"
PKG_CHECK_MODULES(TRACKER_EXTRACT, [$TRACKER_EXTRACT_REQUIRED])
@@ -988,6 +985,46 @@ fi
AM_CONDITIONAL(HAVE_NETWORK_MANAGER, test "x$have_network_manager" = "xyes")
##################################################################
+# Check for libtracker-miner, tracker-extract: libmediaart
+##################################################################
+
+AC_ARG_ENABLE(libmediaart,
+ AS_HELP_STRING([--enable-libmediaart],
+ [enable libmediaart for caching published video/audio art [[default=auto]]]),,
+ [enable_libmediaart=auto])
+
+if test "x$enable_libmediaart" != "xno" ; then
+ PKG_CHECK_MODULES(LIBMEDIAART,
+ [libmediaart-1.0 >= $LIBMEDIAART_REQUIRED],
+ [have_libmediaart=yes],
+ [have_libmediaart=no])
+
+ LIBTRACKER_MINER_CFLAGS="$LIBTRACKER_MINER_CFLAGS $LIBMEDIAART_CFLAGS"
+ LIBTRACKER_MINER_LIBS="$LIBTRACKER_MINER_LIBS $LIBMEDIAART_LIBS"
+
+ TRACKER_EXTRACT_CFLAGS="$TRACKER_EXTRACT_CFLAGS $LIBMEDIAART_CFLAGS"
+ TRACKER_EXTRACT_LIBS="$TRACKER_EXTRACT_LIBS $LIBMEDIAART_LIBS"
+
+ # Used for .pc file...
+ LIBTRACKER_MINER_PC_REQUIRES="libmediaart-1.0"
+ AC_SUBST(LIBTRACKER_MINER_PC_REQUIRES)
+
+ if test "x$have_libmediaart" = "xyes"; then
+ AC_DEFINE(HAVE_LIBMEDIAART, [], [Define if we have libmediaart])
+ fi
+else
+ have_libmediaart="no (disabled)"
+fi
+
+if test "x$enable_libmediaart" = "xyes"; then
+ if test "x$have_libmediaart" != "xyes"; then
+ AC_MSG_ERROR([Couldn't find libmediaart >= $LIBMEDIAART_REQUIRED.])
+ fi
+fi
+
+AM_CONDITIONAL(HAVE_LIBMEDIAART, test "x$have_libmediaart" = "xyes")
+
+##################################################################
# Check for libtracker-extract: libexif
##################################################################
@@ -2587,6 +2624,7 @@ Frameworks / Options:
Miscellaneous:
+ Cache media art $have_libmediaart (libmediaart)
Install artwork $have_artwork
"
diff --git a/data/Makefile.am b/data/Makefile.am
index d126371..b4b6c86 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,5 +1,12 @@
SUBDIRS = dbus languages icons ontologies miners gschemas
+# Set up pkg-config .pc files for exported libraries
+if HAVE_LIBMEDIAART
+requires="libmediaart-1.0"
+else
+requires=
+endif
+
# First we fix the VERSION and libexecdir in the desktop files
tracker-extract.desktop.in: tracker-extract.desktop.in.in
@sed -e "s|@libexecdir[ ]|${libexecdir}|" \
@@ -45,7 +52,6 @@ endif
@INTLTOOL_DESKTOP_RULE@
-# Set up pkg-config .pc files for exported libraries
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = \
tracker-control-$(TRACKER_API_VERSION).pc \
diff --git a/data/tracker-miner.pc.in b/data/tracker-miner.pc.in
index 36a8a32..dd6729e 100644
--- a/data/tracker-miner.pc.in
+++ b/data/tracker-miner.pc.in
@@ -6,6 +6,6 @@ includedir= includedir@
Name: tracker-miner
Description: A library to develop tracker data miners
Version: @VERSION@
-Requires: glib-2.0 gio-2.0 tracker-sparql- TRACKER_API_VERSION@
+Requires: glib-2.0 gio-2.0 tracker-sparql- TRACKER_API_VERSION@ @LIBTRACKER_MINER_PC_REQUIRES@
Libs: -L${libdir} -ltracker-miner- TRACKER_API_VERSION@
Cflags: -I${includedir}/tracker- TRACKER_API_VERSION@
diff --git a/src/libtracker-miner/Makefile.am b/src/libtracker-miner/Makefile.am
index 76fe514..4311353 100644
--- a/src/libtracker-miner/Makefile.am
+++ b/src/libtracker-miner/Makefile.am
@@ -37,8 +37,6 @@ private_sources = \
tracker-file-notifier.c \
tracker-file-system.h \
tracker-file-system.c \
- tracker-media-art.c \
- tracker-media-art.h \
tracker-priority-queue.h \
tracker-priority-queue.c \
tracker-task-pool.h \
@@ -50,6 +48,12 @@ private_sources = \
tracker-utils.c \
tracker-utils.h
+if HAVE_LIBMEDIAART
+private_sources += \
+ tracker-media-art.c \
+ tracker-media-art.h
+endif
+
miner_sources = \
$(libtracker_miner_monitor_sources) \
$(libtracker_miner_monitor_headers) \
diff --git a/src/libtracker-miner/tracker-media-art.c b/src/libtracker-miner/tracker-media-art.c
index b1abefc..1be85c2 100644
--- a/src/libtracker-miner/tracker-media-art.c
+++ b/src/libtracker-miner/tracker-media-art.c
@@ -24,7 +24,9 @@
#include <glib.h>
#include <glib/gstdio.h>
+#ifdef HAVE_LIBMEDIAART
#include <libmediaart/mediaart.h>
+#endif
#include <libtracker-sparql/tracker-sparql.h>
@@ -47,6 +49,7 @@ on_query_finished (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
+#ifdef HAVE_LIBMEDIAART
GError *error = NULL;
TrackerSparqlCursor *cursor = NULL;
GDir *dir = NULL;
@@ -154,6 +157,7 @@ on_error:
error->message ? error->message : "No error given");
g_error_free (error);
}
+#endif /* HAVE_LIBMEDIAART */
}
/**
* tracker_media_art_queue_remove:
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 700de1d..5241db9 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -1362,7 +1362,9 @@ item_remove (TrackerMinerFS *fs,
} else {
if (fs->priv->thumbnailer)
tracker_thumbnailer_remove_add (fs->priv->thumbnailer, uri, NULL);
+#ifdef HAVE_LIBMEDIAART
tracker_media_art_queue_remove (uri, NULL);
+#endif
}
/* FIRST:
@@ -2286,7 +2288,9 @@ item_queue_handlers_cb (gpointer user_data)
if (fs->priv->thumbnailer)
tracker_thumbnailer_send (fs->priv->thumbnailer);
+#ifdef HAVE_LIBMEDIAART
tracker_media_art_queue_empty (tracker_miner_get_connection (TRACKER_MINER
(fs)));
+#endif
} else {
/* Flush any possible pending update here */
tracker_sparql_buffer_flush (fs->priv->sparql_buffer,
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index 72e5b4e..441c287 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -51,7 +51,9 @@
#include <gst/gst.h>
#include <gst/tag/tag.h>
+#ifdef HAVE_LIBMEDIAART
#include <libmediaart/mediaart.h>
+#endif
#include <libtracker-common/tracker-common.h>
#include <libtracker-extract/tracker-extract.h>
@@ -107,6 +109,7 @@ typedef struct {
GSList *artist_list;
+#ifdef HAVE_LIBMEDIAART
MediaArtType media_art_type;
gchar *media_art_artist;
gchar *media_art_title;
@@ -114,6 +117,7 @@ typedef struct {
unsigned char *media_art_buffer;
guint media_art_buffer_size;
const gchar *media_art_buffer_mime;
+#endif
GstSample *sample;
GstMapInfo info;
@@ -471,6 +475,8 @@ get_embedded_cue_sheet_data (GstTagList *tag_list)
return NULL;
}
+#ifdef HAVE_LIBMEDIAART
+
static gboolean
get_embedded_media_art (MetadataExtractor *extractor)
{
@@ -542,6 +548,8 @@ get_embedded_media_art (MetadataExtractor *extractor)
return FALSE;
}
+#endif
+
static void
extractor_apply_geolocation_metadata (MetadataExtractor *extractor,
GstTagList *tag_list,
@@ -728,11 +736,15 @@ extractor_apply_general_metadata (MetadataExtractor *extractor,
add_string_gst_tag (metadata, "dc:coverage", tag_list, GST_TAG_LOCATION);
add_string_gst_tag (metadata, "nie:comment", tag_list, GST_TAG_COMMENT);
+#ifdef HAVE_LIBMEDIAART
if (extractor->media_art_type == MEDIA_ART_VIDEO) {
extractor->media_art_title = title_guaranteed;
} else {
g_free (title_guaranteed);
}
+#else
+ g_free (title_guaranteed);
+#endif
g_free (performer_temp);
g_free (artist_temp);
@@ -883,8 +895,10 @@ extractor_apply_album_metadata (MetadataExtractor *extractor,
replace_double_gst_tag (preupdate, *p_album_uri, "nmm:albumGain", extractor->tagcache,
GST_TAG_ALBUM_GAIN, graph);
replace_double_gst_tag (preupdate, *p_album_uri, "nmm:albumPeakGain", extractor->tagcache,
GST_TAG_ALBUM_PEAK, graph);
+#ifdef HAVE_LIBMEDIAART
extractor->media_art_artist = album_artist;
extractor->media_art_title = album_title;
+#endif
g_free (album_artist_temp);
g_free (track_artist_temp);
@@ -1104,7 +1118,9 @@ extract_metadata (MetadataExtractor *extractor,
g_return_if_fail (postupdate != NULL);
g_return_if_fail (metadata != NULL);
+#ifdef HAVE_LIBMEDIAART
extractor->media_art_type = MEDIA_ART_NONE;
+#endif
if (extractor->toc) {
gst_tag_list_insert (extractor->tagcache,
@@ -1149,11 +1165,15 @@ extract_metadata (MetadataExtractor *extractor,
if (extractor->toc == NULL || extractor->toc->entry_list == NULL)
tracker_sparql_builder_object (metadata, "nmm:MusicPiece");
+#ifdef HAVE_LIBMEDIAART
extractor->media_art_type = MEDIA_ART_ALBUM;
+#endif
} else if (extractor->mime == EXTRACT_MIME_VIDEO) {
tracker_sparql_builder_object (metadata, "nmm:Video");
+#ifdef HAVE_LIBMEDIAART
extractor->media_art_type = MEDIA_ART_VIDEO;
+#endif
} else {
tracker_sparql_builder_object (metadata, "nfo:Image");
@@ -1278,9 +1298,11 @@ extract_metadata (MetadataExtractor *extractor,
common_extract_stream_metadata (extractor, file_url, metadata);
#endif /* DECODEBIN2/DISCOVERER/GUPnP-DLNA */
+#ifdef HAVE_LIBMEDIAART
if (extractor->mime == EXTRACT_MIME_AUDIO) {
get_embedded_media_art (extractor);
}
+#endif
}
#if defined(GSTREAMER_BACKEND_DISCOVERER) || \
@@ -2040,7 +2062,10 @@ tracker_extract_gstreamer (const gchar *uri,
extractor = g_slice_new0 (MetadataExtractor);
extractor->mime = type;
extractor->tagcache = gst_tag_list_new_empty ();
+
+#ifdef HAVE_LIBMEDIAART
extractor->media_art_type = MEDIA_ART_NONE;
+#endif
g_debug ("GStreamer backend in use:");
@@ -2075,6 +2100,7 @@ tracker_extract_gstreamer (const gchar *uri,
metadata,
graph);
+#ifdef HAVE_LIBMEDIAART
if (extractor->media_art_type != MEDIA_ART_NONE) {
media_art_process (extractor->media_art_buffer,
extractor->media_art_buffer_size,
@@ -2084,11 +2110,15 @@ tracker_extract_gstreamer (const gchar *uri,
extractor->media_art_title,
uri);
}
+#endif
}
/* Clean up */
+#ifdef HAVE_LIBMEDIAART
g_free (extractor->media_art_artist);
g_free (extractor->media_art_title);
+#endif
+
if (extractor->sample) {
buffer = gst_sample_get_buffer (extractor->sample);
gst_buffer_unmap (buffer, &extractor->info);
diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index da4a87a..7dad217 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -40,7 +40,9 @@
#include <sys/mman.h>
#endif /* G_OS_WIN32 */
+#ifdef HAVE_LIBMEDIAART
#include <libmediaart/mediaart.h>
+#endif
#include <libtracker-common/tracker-common.h>
@@ -2487,6 +2489,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
/* Get mp3 stream info */
mp3_parse (buffer, buffer_size, audio_offset, uri, metadata, &md);
+#ifdef HAVE_LIBMEDIAART
media_art_process (md.media_art_data,
md.media_art_size,
md.media_art_mime,
@@ -2494,6 +2497,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
md.performer,
md.album,
uri);
+#endif
g_free (md.media_art_data);
g_free (md.media_art_mime);
diff --git a/src/tracker-extract/tracker-main.c b/src/tracker-extract/tracker-main.c
index 8e82343..23bfd25 100644
--- a/src/tracker-extract/tracker-main.c
+++ b/src/tracker-extract/tracker-main.c
@@ -38,7 +38,9 @@
#include <sys/resource.h>
#endif
+#ifdef HAVE_LIBMEDIAART
#include <libmediaart/mediaart.h>
+#endif
#include <libtracker-common/tracker-log.h>
#include <libtracker-common/tracker-dbus.h>
@@ -273,9 +275,11 @@ run_standalone (TrackerConfig *config)
tracker_locale_init ();
+#ifdef HAVE_LIBMEDIAART
if (!media_art_init ()) {
g_warning ("Could not initialize media art, will not be available");
}
+#endif
/* This makes sure we don't steal all the system's resources */
initialize_priority_and_scheduling (tracker_config_get_sched_idle (config),
@@ -291,7 +295,9 @@ run_standalone (TrackerConfig *config)
if (!object) {
g_object_unref (file);
g_free (uri);
+#ifdef HAVE_LIBMEDIAART
media_art_shutdown ();
+#endif
tracker_locale_shutdown ();
return EXIT_FAILURE;
}
@@ -304,7 +310,9 @@ run_standalone (TrackerConfig *config)
g_object_unref (file);
g_free (uri);
+#ifdef HAVE_LIBMEDIAART
media_art_shutdown ();
+#endif
tracker_locale_shutdown ();
return EXIT_SUCCESS;
@@ -427,9 +435,11 @@ main (int argc, char *argv[])
tracker_locale_init ();
+#ifdef HAVE_LIBMEDIAART
if (!media_art_init ()) {
g_warning ("Could not initialize media art, will not be available");
}
+#endif
controller = tracker_extract_controller_new (decorator);
tracker_miner_start (TRACKER_MINER (decorator));
@@ -445,7 +455,9 @@ main (int argc, char *argv[])
tracker_miner_stop (TRACKER_MINER (decorator));
/* Shutdown subsystems */
+#ifdef HAVE_LIBMEDIAART
media_art_shutdown ();
+#endif
tracker_locale_shutdown ();
g_object_unref (extract);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]