tracker r2299 - in trunk: . src/tracker-extract
- From: mottela svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2299 - in trunk: . src/tracker-extract
- Date: Thu, 2 Oct 2008 21:52:06 +0000 (UTC)
Author: mottela
Date: Thu Oct 2 21:52:06 2008
New Revision: 2299
URL: http://svn.gnome.org/viewvc/tracker?rev=2299&view=rev
Log:
Added extraction of embedded album art to gstreamer based extractor
Modified:
trunk/ChangeLog
trunk/configure.ac
trunk/src/tracker-extract/Makefile.am
trunk/src/tracker-extract/tracker-extract-gstreamer.c
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Thu Oct 2 21:52:06 2008
@@ -409,7 +409,7 @@
[enable_video_extractor=auto])
PKG_CHECK_MODULES(GSTREAMER,
- [gstreamer-0.10 >= 0.10.0],
+ [gstreamer-0.10 >= 0.10.12 gstreamer-tag-0.10 >= 0.10.12],
[have_libgstreamer=yes],
[have_libgstreamer=no])
Modified: trunk/src/tracker-extract/Makefile.am
==============================================================================
--- trunk/src/tracker-extract/Makefile.am (original)
+++ trunk/src/tracker-extract/Makefile.am Thu Oct 2 21:52:06 2008
@@ -135,9 +135,9 @@
libextract_pdf_la_LIBADD = $(GLIB2_LIBS) $(POPPLER_GLIB_LIBS) $(EXEMPI_LIBS)
# GStreamer
-libextract_gstreamer_la_SOURCES = tracker-extract-gstreamer.c
+libextract_gstreamer_la_SOURCES = tracker-extract-gstreamer.c $(albumart_sources)
libextract_gstreamer_la_LDFLAGS = $(module_flags)
-libextract_gstreamer_la_LIBADD = $(GLIB2_LIBS) $(GSTREAMER_LIBS)
+libextract_gstreamer_la_LIBADD = $(GLIB2_LIBS) $(GSTREAMER_LIBS) $(GDK_PIXBUF_LIBS)
# Xine
libextract_xine_la_SOURCES = tracker-extract-libxine.c
Modified: trunk/src/tracker-extract/tracker-extract-gstreamer.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-gstreamer.c (original)
+++ trunk/src/tracker-extract/tracker-extract-gstreamer.c Thu Oct 2 21:52:06 2008
@@ -59,8 +59,10 @@
#include <glib.h>
#include <gst/gst.h>
+#include <gst/tag/tag.h>
#include "tracker-extract.h"
+#include "tracker-albumart.h"
typedef enum {
EXTRACT_MIME_UNDEFINED=0,
@@ -89,6 +91,10 @@
gint video_fps_d;
gint audio_channels;
gint audio_samplerate;
+
+ unsigned char *album_art_data;
+ guint album_art_size;
+
} MetadataExtractor;
static void extract_gstreamer_audio (const gchar *uri, GHashTable *metadata);
@@ -514,8 +520,48 @@
}
static void
+get_embedded_album_art(MetadataExtractor *extractor)
+{
+ const GValue *value;
+ guint index;
+
+ index = 0;
+
+ do {
+ value = gst_tag_list_get_value_index (extractor->tagcache, GST_TAG_IMAGE, index);
+
+ if (value) {
+ GstBuffer *buffer;
+ GstCaps *caps;
+ GstStructure *caps_struct;
+ gint type;
+
+ buffer = gst_value_get_buffer (value);
+ caps = gst_buffer_get_caps (buffer);
+ caps_struct = gst_caps_get_structure (buffer->caps, 0);
+
+ gst_structure_get_enum (caps_struct,
+ "image-type",
+ GST_TYPE_TAG_IMAGE_TYPE,
+ &type);
+
+ if (type == GST_TAG_IMAGE_TYPE_FRONT_COVER) {
+ extractor->album_art_data = buffer->data;
+ extractor->album_art_size = buffer->size;
+
+ return;
+ }
+
+ gst_object_unref (caps);
+
+ index++;
+ }
+ } while (value);
+}
+
+static void
extract_metadata (MetadataExtractor *extractor,
- GHashTable *metadata)
+ GHashTable *metadata)
{
g_return_if_fail (extractor);
g_return_if_fail (metadata);
@@ -615,6 +661,8 @@
if (duration >= 0) {
add_int64_info (metadata, g_strdup ("Audio:Duration"), duration);
}
+
+ get_embedded_album_art (extractor);
}
}
@@ -773,6 +821,9 @@
extractor->mime = type;
+ extractor->album_art_data = NULL;
+ extractor->album_art_size = 0;
+
extractor->playbin = gst_element_factory_make ("playbin", "playbin");
/* Add bus callback */
@@ -801,6 +852,14 @@
extract_metadata (extractor, metadata);
+ /* Save embedded art */
+ if (extractor->album_art_data && extractor->album_art_size) {
+ tracker_save_albumart (extractor->album_art_data, extractor->album_art_size,
+ g_hash_table_lookup (metadata, "Audio:Artist") ,
+ g_hash_table_lookup (metadata, "Audio:Album"),
+ uri);
+ }
+
/* Check that we have the minimum data. FIXME We should not need to do this */
if (!g_hash_table_lookup (metadata, "Audio:Title")) {
g_hash_table_insert (metadata, g_strdup ("Audio:Title"), g_strdup ("tracker:unknown"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]