[tracker-miners: 1/4] fix the GPSLatitudeRef GPSLongitudeRef extraction
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners: 1/4] fix the GPSLatitudeRef GPSLongitudeRef extraction
- Date: Mon, 3 Feb 2020 19:17:57 +0000 (UTC)
commit 5a0ada56559874019b37caf6ad1fbfea7631de84
Author: Viktor Gal <viktor gal maeth com>
Date: Mon Feb 3 09:09:21 2020 +0100
fix the GPSLatitudeRef GPSLongitudeRef extraction
src/libtracker-extract/tracker-exif.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-exif.c b/src/libtracker-extract/tracker-exif.c
index 2d753ba2d..e0838e11c 100644
--- a/src/libtracker-extract/tracker-exif.c
+++ b/src/libtracker-extract/tracker-exif.c
@@ -312,14 +312,12 @@ get_gps_coordinate (ExifData *exif,
ExifByteOrder order;
ExifRational degrees, minutes, seconds;
gfloat f;
- gchar ref;
if (entry->size == 24) {
order = exif_data_get_byte_order (exif);
degrees = exif_get_rational (entry->data, order);
minutes = exif_get_rational (entry->data + 8, order);
seconds = exif_get_rational (entry->data + 16, order);
- ref = exif_get_short (refentry->data, order);
/* Avoid ridiculous values */
if (degrees.denominator == 0 ||
@@ -332,8 +330,11 @@ get_gps_coordinate (ExifData *exif,
(gdouble) minutes.numerator / (minutes.denominator * 60) +
(gdouble) seconds.numerator / (seconds.denominator * 60 * 60);
- if (ref == 'S' || ref == 'W') {
- f = -1 * f;
+ if (refentry->format == EXIF_FORMAT_ASCII && (refentry->size == 2)) {
+ // following Exif Version 2.2 specs
+ if (refentry->data[0] == 'S' || refentry->data[0] == 'W') {
+ f = -1 * f;
+ }
}
return g_strdup_printf ("%f", f);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]