android: jpeg: exif: Expand setString to support different encodings

GPSProcessingMethod and UserComment in EXIF tags can be in UTF-16.
Expand setString to take an encoding when the field type is undefined.
Update callers accordingly.

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:16:42 +09:00
parent 34897234d1
commit d81e26d360
2 changed files with 84 additions and 4 deletions

View file

@ -26,6 +26,12 @@ public:
JPEG = 6,
};
enum StringEncoding {
NoEncoding = 0,
ASCII = 1,
Unicode = 2,
};
void setMake(const std::string &make);
void setModel(const std::string &model);
@ -46,9 +52,12 @@ private:
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);
const std::string &item,
StringEncoding encoding = NoEncoding);
void setRational(ExifIfd ifd, ExifTag tag, ExifRational item);
std::u16string utf8ToUtf16(const std::string &str);
bool valid_;
ExifData *data_;