[tracker] Coalesce nie:comment in jpeg extractor.
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker] Coalesce nie:comment in jpeg extractor.
- Date: Wed, 4 Nov 2009 10:35:17 +0000 (UTC)
commit a03a0f3b54bcfcb1c4f3d62e1b3b7f54fa139210
Author: Carlos Garnacho <carlos lanedo com>
Date: Tue Nov 3 14:56:11 2009 +0100
Coalesce nie:comment in jpeg extractor.
comment info may come from builtin and exif data. Coalesce both, since
nie:comment only allows one value.
src/tracker-extract/tracker-extract-jpeg.c | 25 ++++++++++---------------
1 files changed, 10 insertions(+), 15 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-jpeg.c b/src/tracker-extract/tracker-extract-jpeg.c
index c61312e..b828fd0 100644
--- a/src/tracker-extract/tracker-extract-jpeg.c
+++ b/src/tracker-extract/tracker-extract-jpeg.c
@@ -83,7 +83,7 @@ typedef struct {
gchar *camera, *title, *orientation, *copyright, *white_balance,
*fnumber, *flash, *focal_length, *artist,
*exposure_time, *iso_speed_ratings, *date, *description,
- *metering_mode, *creator;
+ *metering_mode, *creator, *comment;
} JpegNeedsMergeData;
static void extract_jpeg (const gchar *filename,
@@ -158,7 +158,7 @@ extract_jpeg (const gchar *uri,
TrackerExifData exif_data = { 0 };
TrackerIptcData iptc_data = { 0 };
JpegNeedsMergeData merge_data = { 0 };
- gchar *str;
+ gchar *str, *comment = NULL;
gsize len;
#ifdef HAVE_LIBIPTCDATA
gsize offset;
@@ -204,14 +204,7 @@ extract_jpeg (const gchar *uri,
switch (marker->marker) {
case JPEG_COM:
len = marker->data_length;
- str = g_strndup ((gchar*) marker->data, len);
-
- tracker_statement_list_insert (metadata, uri,
- NIE_PREFIX "comment",
- str);
-
- g_free (str);
-
+ comment = g_strndup ((gchar*) marker->data, len);
break;
case JPEG_APP0+1:
@@ -324,11 +317,8 @@ extract_jpeg (const gchar *uri,
merge_data.creator = tracker_coalesce (3, iptc_data.byline,
xmp_data.creator,
iptc_data.credit);
-
- if (exif_data.user_comment) {
- tracker_statement_list_insert (metadata, uri, NIE_PREFIX "comment", exif_data.user_comment);
- g_free (exif_data.user_comment);
- }
+ merge_data.comment = tracker_coalesce (2, exif_data.user_comment,
+ comment);
/* Prioritize on native dimention in all cases */
tracker_statement_list_insert_with_int (metadata, uri,
@@ -482,6 +472,11 @@ extract_jpeg (const gchar *uri,
g_free (merge_data.creator);
}
+ if (merge_data.comment) {
+ tracker_statement_list_insert (metadata, uri, NIE_PREFIX "comment", merge_data.comment);
+ g_free (merge_data.comment);
+ }
+
jpeg_destroy_decompress (&cinfo);
fail:
tracker_file_close (f, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]