summaryrefslogtreecommitdiff
path: root/src/android/jpeg/exif.h
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2021-01-21 17:40:35 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2021-01-27 12:06:59 +0900
commit3a3f6ae22e88c592425a4374734cd17df76d7db2 (patch)
treebf1ca191275b508e53d85461d463d67f3b4e2e12 /src/android/jpeg/exif.h
parente5b6774422b66b4caee544b12c3aea14e3416ded (diff)
android: jpeg: exif: Add functions for setting various values
Add functions for setting the following EXIF fields: - GPSDatestamp - GPSTimestamp - GPSLocation - GPSLatitudeRef - GPSLatitude - GPSLongitudeRef - GPSLongitude - GPSAltitudeRef - GPSAltitude - GPSProcessingMethod - FocalLength - ExposureTime - FNumber - ISO - Flash - WhiteBalance - SubsecTime - SubsecTimeOriginal - SubsecTimeDigitized These are in preparation for fixing the following CTS tests: - android.hardware.camera2.cts.StillCaptureTest#testFocalLengths - android.hardware.camera2.cts.StillCaptureTest#testJpegExif Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/android/jpeg/exif.h')
-rw-r--r--src/android/jpeg/exif.h39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/android/jpeg/exif.h b/src/android/jpeg/exif.h
index 8b84165b..b0d61402 100644
--- a/src/android/jpeg/exif.h
+++ b/src/android/jpeg/exif.h
@@ -7,6 +7,7 @@
#ifndef __ANDROID_JPEG_EXIF_H__
#define __ANDROID_JPEG_EXIF_H__
+#include <chrono>
#include <string>
#include <time.h>
@@ -26,6 +27,27 @@ public:
JPEG = 6,
};
+ enum Flash {
+ /* bit 0 */
+ Fired = 0x01,
+ /* bits 1 and 2 */
+ StrobeDetected = 0x04,
+ StrobeNotDetected = 0x06,
+ /* bits 3 and 4 */
+ ModeCompulsoryFiring = 0x08,
+ ModeCompulsorySuppression = 0x10,
+ ModeAuto = 0x18,
+ /* bit 5 */
+ FlashNotPresent = 0x20,
+ /* bit 6 */
+ RedEye = 0x40,
+ };
+
+ enum WhiteBalance {
+ Auto = 0,
+ Manual = 1,
+ };
+
enum StringEncoding {
NoEncoding = 0,
ASCII = 1,
@@ -39,7 +61,18 @@ public:
void setSize(const libcamera::Size &size);
void setThumbnail(libcamera::Span<const unsigned char> thumbnail,
Compression compression);
- void setTimestamp(time_t timestamp);
+ void setTimestamp(time_t timestamp, std::chrono::milliseconds msec);
+
+ void setGPSDateTimestamp(time_t timestamp);
+ void setGPSLocation(const double *coords);
+ void setGPSMethod(const std::string &method);
+
+ void setFocalLength(float length);
+ void setExposureTime(uint64_t nsec);
+ void setAperture(float size);
+ void setISO(uint16_t iso);
+ void setFlash(Flash flash);
+ void setWhiteBalance(WhiteBalance wb);
libcamera::Span<const uint8_t> data() const { return { exifData_, size_ }; }
[[nodiscard]] int generate();
@@ -49,6 +82,7 @@ private:
ExifEntry *createEntry(ExifIfd ifd, ExifTag tag, ExifFormat format,
unsigned long components, unsigned int size);
+ void setByte(ExifIfd ifd, ExifTag tag, uint8_t item);
void setShort(ExifIfd ifd, ExifTag tag, uint16_t item);
void setLong(ExifIfd ifd, ExifTag tag, uint32_t item);
void setString(ExifIfd ifd, ExifTag tag, ExifFormat format,
@@ -56,6 +90,9 @@ private:
StringEncoding encoding = NoEncoding);
void setRational(ExifIfd ifd, ExifTag tag, ExifRational item);
+ std::tuple<int, int, int> degreesToDMS(double decimalDegrees);
+ void setGPSDMS(ExifIfd ifd, ExifTag tag, int deg, int min, int sec);
+
std::u16string utf8ToUtf16(const std::string &str);
bool valid_;