[tracker] tracker-extract: Fix original resolution conversion in EXIF data
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tracker-extract: Fix original resolution conversion in EXIF data
- Date: Mon, 21 Mar 2011 12:03:25 +0000 (UTC)
commit 7eb1a4d79c6cd6777a96a0da3f06a28571747a7f
Author: Lionel Landwerlin <lionel g landwerlin linux intel com>
Date: Fri Mar 18 17:42:48 2011 +0000
tracker-extract: Fix original resolution conversion in EXIF data
According to the specification (http://www.exif.org/Exif2-2.PDF),
the resolution unit is described as :
2 = inches unit
3 = centimer unit
other = reserved
Fixes GB#645375
Signed-off-by: Lionel Landwerlin <lionel g landwerlin linux intel com>
src/tracker-extract/tracker-extract-jpeg.c | 4 ++--
src/tracker-extract/tracker-extract-png.c | 6 +++---
src/tracker-extract/tracker-extract-tiff.c | 4 ++--
3 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-jpeg.c b/src/tracker-extract/tracker-extract-jpeg.c
index 06cd43c..b6fd791 100644
--- a/src/tracker-extract/tracker-extract-jpeg.c
+++ b/src/tracker-extract/tracker-extract-jpeg.c
@@ -581,7 +581,7 @@ tracker_extract_get_metadata (const gchar *uri,
gdouble value;
if (cinfo.density_unit == 0) {
- if (ed->resolution_unit == 1)
+ if (ed->resolution_unit != 3)
value = g_strtod (ed->x_resolution, NULL);
else
value = g_strtod (ed->x_resolution, NULL) * CM_TO_INCH;
@@ -600,7 +600,7 @@ tracker_extract_get_metadata (const gchar *uri,
gdouble value;
if (cinfo.density_unit == 0) {
- if (ed->resolution_unit == 1)
+ if (ed->resolution_unit != 3)
value = g_strtod (ed->y_resolution, NULL);
else
value = g_strtod (ed->y_resolution, NULL) * CM_TO_INCH;
diff --git a/src/tracker-extract/tracker-extract-png.c b/src/tracker-extract/tracker-extract-png.c
index aa8a2f2..57b8776 100644
--- a/src/tracker-extract/tracker-extract-png.c
+++ b/src/tracker-extract/tracker-extract-png.c
@@ -111,7 +111,7 @@ read_metadata (TrackerSparqlBuilder *preupdate,
if (!text_ptr[i].key || !text_ptr[i].text || text_ptr[i].text[0] == '\0') {
continue;
}
-
+
#if defined(HAVE_EXEMPI) && defined(PNG_iTXt_SUPPORTED)
if (g_strcmp0 ("XML:com.adobe.xmp", text_ptr[i].key) == 0) {
/* ATM tracker_extract_xmp_read supports setting xd
@@ -460,7 +460,7 @@ read_metadata (TrackerSparqlBuilder *preupdate,
if (ed->x_resolution) {
gdouble value;
- value = ed->resolution_unit == 1 ? g_strtod (ed->x_resolution, NULL) : g_strtod (ed->x_resolution, NULL) * CM_TO_INCH;
+ value = ed->resolution_unit != 3 ? g_strtod (ed->x_resolution, NULL) : g_strtod (ed->x_resolution, NULL) * CM_TO_INCH;
tracker_sparql_builder_predicate (metadata, "nfo:horizontalResolution");
tracker_sparql_builder_object_double (metadata, value);
}
@@ -468,7 +468,7 @@ read_metadata (TrackerSparqlBuilder *preupdate,
if (ed->y_resolution) {
gdouble value;
- value = ed->resolution_unit == 1 ? g_strtod (ed->y_resolution, NULL) : g_strtod (ed->y_resolution, NULL) * CM_TO_INCH;
+ value = ed->resolution_unit != 3 ? g_strtod (ed->y_resolution, NULL) : g_strtod (ed->y_resolution, NULL) * CM_TO_INCH;
tracker_sparql_builder_predicate (metadata, "nfo:verticalResolution");
tracker_sparql_builder_object_double (metadata, value);
}
diff --git a/src/tracker-extract/tracker-extract-tiff.c b/src/tracker-extract/tracker-extract-tiff.c
index 67cea6d..d465a18 100644
--- a/src/tracker-extract/tracker-extract-tiff.c
+++ b/src/tracker-extract/tracker-extract-tiff.c
@@ -688,7 +688,7 @@ tracker_extract_get_metadata (const gchar *uri,
if (ed->x_resolution) {
gdouble value;
- value = ed->resolution_unit == 1 ? g_strtod (ed->x_resolution, NULL) : g_strtod (ed->x_resolution, NULL) * CM_TO_INCH;
+ value = ed->resolution_unit != 3 ? g_strtod (ed->x_resolution, NULL) : g_strtod (ed->x_resolution, NULL) * CM_TO_INCH;
tracker_sparql_builder_predicate (metadata, "nfo:horizontalResolution");
tracker_sparql_builder_object_double (metadata, value);
}
@@ -696,7 +696,7 @@ tracker_extract_get_metadata (const gchar *uri,
if (ed->y_resolution) {
gdouble value;
- value = ed->resolution_unit == 1 ? g_strtod (ed->y_resolution, NULL) : g_strtod (ed->y_resolution, NULL) * CM_TO_INCH;
+ value = ed->resolution_unit != 3 ? g_strtod (ed->y_resolution, NULL) : g_strtod (ed->y_resolution, NULL) * CM_TO_INCH;
tracker_sparql_builder_predicate (metadata, "nfo:verticalResolution");
tracker_sparql_builder_object_double (metadata, value);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]