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:
Paul Elder 2021-01-21 17:40:35 +09:00
parent e5b6774422
commit 3a3f6ae22e
3 changed files with 210 additions and 16 deletions

View file

@ -7,6 +7,8 @@
#include "post_processor_jpeg.h"
#include <chrono>
#include "../camera_device.h"
#include "../camera_metadata.h"
#include "encoder_libjpeg.h"
@ -17,6 +19,7 @@
#include "libcamera/internal/log.h"
using namespace libcamera;
using namespace std::chrono_literals;
LOG_DEFINE_CATEGORY(JPEG)
@ -97,7 +100,7 @@ int PostProcessorJpeg::process(const FrameBuffer &source,
* Since the precision we need for EXIF timestamp is only one
* second, it is good enough.
*/
exif.setTimestamp(std::time(nullptr));
exif.setTimestamp(std::time(nullptr), 0ms);
std::vector<unsigned char> thumbnail;
generateThumbnail(source, &thumbnail);