From 6f09a619cca412f029c124cff8bbf1647d3d68cf Mon Sep 17 00:00:00 2001 From: Umang Jain Date: Wed, 9 Sep 2020 16:44:45 +0530 Subject: android: jpeg: Support an initial set of EXIF metadata tags Create a Exif object with various metadata tags set, just before the encoder starts to encode the frame. The object is passed directly as libcamera::Span<> to make sure EXIF tags can be set in a single place i.e. in CameraDevice and the encoder only has the job to write the data in the final output. Signed-off-by: Kieran Bingham Signed-off-by: Umang Jain Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- src/android/jpeg/encoder_libjpeg.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/android/jpeg/encoder_libjpeg.cpp') diff --git a/src/android/jpeg/encoder_libjpeg.cpp b/src/android/jpeg/encoder_libjpeg.cpp index 977538ce..510613cd 100644 --- a/src/android/jpeg/encoder_libjpeg.cpp +++ b/src/android/jpeg/encoder_libjpeg.cpp @@ -180,7 +180,8 @@ void EncoderLibJpeg::compressNV(const libcamera::MappedBuffer *frame) } int EncoderLibJpeg::encode(const FrameBuffer *source, - const libcamera::Span &dest) + const libcamera::Span &dest, + const libcamera::Span &exifData) { MappedFrameBuffer frame(source, PROT_READ); if (!frame.isValid()) { @@ -204,6 +205,12 @@ int EncoderLibJpeg::encode(const FrameBuffer *source, jpeg_start_compress(&compress_, TRUE); + if (exifData.size()) + /* Store Exif data in the JPEG_APP1 data block. */ + jpeg_write_marker(&compress_, JPEG_APP0 + 1, + static_cast(exifData.data()), + exifData.size()); + LOG(JPEG, Debug) << "JPEG Encode Starting:" << compress_.image_width << "x" << compress_.image_height; -- cgit v1.2.1