1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2020, Google Inc.
*
* exif.h - EXIF tag creator using libexif
*/
#ifndef __ANDROID_JPEG_EXIF_H__
#define __ANDROID_JPEG_EXIF_H__
#include <ctime>
#include <string>
#include <libexif/exif-data.h>
#include <libcamera/span.h>
class Exif
{
public:
Exif();
~Exif();
libcamera::Span<const uint8_t> data() const { return { exifData_, size_ }; }
[[nodiscard]] int generate();
private:
ExifEntry *createEntry(ExifIfd ifd, ExifTag tag);
ExifEntry *createEntry(ExifIfd ifd, ExifTag tag, ExifFormat format,
unsigned long components, unsigned int size);
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,
const std::string &item);
void setRational(ExifIfd ifd, ExifTag tag, ExifRational item);
bool valid_;
ExifData *data_;
ExifMem *mem_;
unsigned char *exifData_;
unsigned int size_;
};
#endif /* __ANDROID_JPEG_EXIF_H__ */
|