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>
This commit is contained in:
parent
e5b6774422
commit
3a3f6ae22e
3 changed files with 210 additions and 16 deletions
|
@ -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_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue