summaryrefslogtreecommitdiff
path: root/src/android
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2021-03-08 18:57:59 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2021-03-10 12:30:23 +0900
commit4c0b6c6bd19b95467812cce12bee180d32936600 (patch)
tree9ccdec92012cc7a9da0203a3a43232db915fe691 /src/android
parentfd3faf7b601272c5d6ca8fc66b14d0fe13f56789 (diff)
android: jpeg: exif: Simplify setGPSDateTimestamp and setGPSDMS
Now that setRational() supports setting multiple rational values, use that in setGPSDateTimestamp and setGPSDMS which previously set every rational manually. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/android')
-rw-r--r--src/android/jpeg/exif.cpp25
1 files changed, 3 insertions, 22 deletions
diff --git a/src/android/jpeg/exif.cpp b/src/android/jpeg/exif.cpp
index 626595cc..470a2ac6 100644
--- a/src/android/jpeg/exif.cpp
+++ b/src/android/jpeg/exif.cpp
@@ -345,24 +345,14 @@ void Exif::setGPSDateTimestamp(time_t timestamp)
EXIF_FORMAT_ASCII, tsStr);
/* Set GPS_TIME_STAMP */
- ExifEntry *entry =
- createEntry(EXIF_IFD_GPS,
- static_cast<ExifTag>(EXIF_TAG_GPS_TIME_STAMP),
- EXIF_FORMAT_RATIONAL, 3, 3 * sizeof(ExifRational));
- if (!entry)
- return;
-
ExifRational ts[] = {
{ static_cast<ExifLong>(tm.tm_hour), 1 },
{ static_cast<ExifLong>(tm.tm_min), 1 },
{ static_cast<ExifLong>(tm.tm_sec), 1 },
};
- for (int i = 0; i < 3; i++)
- exif_set_rational(entry->data + i * sizeof(ExifRational),
- order_, ts[i]);
-
- exif_entry_unref(entry);
+ setRational(EXIF_IFD_GPS, static_cast<ExifTag>(EXIF_TAG_GPS_TIME_STAMP),
+ ts);
}
std::tuple<int, int, int> Exif::degreesToDMS(double decimalDegrees)
@@ -376,22 +366,13 @@ std::tuple<int, int, int> Exif::degreesToDMS(double decimalDegrees)
void Exif::setGPSDMS(ExifIfd ifd, ExifTag tag, int deg, int min, int sec)
{
- ExifEntry *entry = createEntry(ifd, tag, EXIF_FORMAT_RATIONAL, 3,
- 3 * sizeof(ExifRational));
- if (!entry)
- return;
-
ExifRational coords[] = {
{ static_cast<ExifLong>(deg), 1 },
{ static_cast<ExifLong>(min), 1 },
{ static_cast<ExifLong>(sec), 1 },
};
- for (int i = 0; i < 3; i++)
- exif_set_rational(entry->data + i * sizeof(ExifRational),
- order_, coords[i]);
-
- exif_entry_unref(entry);
+ setRational(ifd, tag, coords);
}
/*