[tracker/tracker-0.10] tracker-extract: Fix original resolution conversion in EXIF data
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.10] tracker-extract: Fix original resolution conversion in EXIF data
- Date: Wed, 23 Mar 2011 11:06:14 +0000 (UTC)
commit 65af7d50507fea4e2bb543996a657bcb4d0ced49
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 fadfeb5..8df263e 100644
--- a/src/tracker-extract/tracker-extract-jpeg.c
+++ b/src/tracker-extract/tracker-extract-jpeg.c
@@ -587,7 +587,7 @@ extract_jpeg (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;
@@ -606,7 +606,7 @@ extract_jpeg (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 1a2d109..b96c72e 100644
--- a/src/tracker-extract/tracker-extract-png.c
+++ b/src/tracker-extract/tracker-extract-png.c
@@ -121,7 +121,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
@@ -470,7 +470,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);
}
@@ -478,7 +478,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 4b550b8..128301a 100644
--- a/src/tracker-extract/tracker-extract-tiff.c
+++ b/src/tracker-extract/tracker-extract-tiff.c
@@ -696,7 +696,7 @@ extract_tiff (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);
}
@@ -704,7 +704,7 @@ extract_tiff (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]