summaryrefslogtreecommitdiffstats
path: root/libs3cjpeg
diff options
context:
space:
mode:
authorMike J. Chen <mjchen@sta.samsung.com>2010-10-22 18:06:42 -0700
committerMaarten Hooft <mthooft@google.com>2010-10-24 14:20:50 -0700
commitd4cc9f0ff9c4985dcd7bda608de72df1601d8ea8 (patch)
tree123d0b74656b4d0241eeaf64703fe0e3823b422d /libs3cjpeg
parent3fda02d334845a570b9de76006741be42280f544 (diff)
downloaddevice_samsung_crespo-d4cc9f0ff9c4985dcd7bda608de72df1601d8ea8.zip
device_samsung_crespo-d4cc9f0ff9c4985dcd7bda608de72df1601d8ea8.tar.gz
device_samsung_crespo-d4cc9f0ff9c4985dcd7bda608de72df1601d8ea8.tar.bz2
SP5C11X: libs3cjpeg: add support for additional gps tags
Add support for the following GPS exif tags that CTS requires: GPS_TIMESTAMP GPS_DATESTAMP GPS_PROCESSING_METHOD Change-Id: I4aea9f20f6db247bb58c60f5869aa6cfbec6ad3a Signed-off-by: Mike J. Chen <mjchen@sta.samsung.com>
Diffstat (limited to 'libs3cjpeg')
-rw-r--r--libs3cjpeg/Exif.h8
-rw-r--r--libs3cjpeg/JpegEncoder.cpp26
2 files changed, 31 insertions, 3 deletions
diff --git a/libs3cjpeg/Exif.h b/libs3cjpeg/Exif.h
index 207caca..96e11dd 100644
--- a/libs3cjpeg/Exif.h
+++ b/libs3cjpeg/Exif.h
@@ -32,7 +32,7 @@
#define NUM_0TH_IFD_TIFF 10
#define NUM_0TH_IFD_EXIF 22
-#define NUM_0TH_IFD_GPS 7
+#define NUM_0TH_IFD_GPS 10
#define NUM_1TH_IFD_TIFF 9
/* Type */
@@ -91,6 +91,9 @@
#define EXIF_TAG_GPS_LONGITUDE 0x0004
#define EXIF_TAG_GPS_ALTITUDE_REF 0x0005
#define EXIF_TAG_GPS_ALTITUDE 0x0006
+#define EXIF_TAG_GPS_TIMESTAMP 0x0007
+#define EXIF_TAG_GPS_PROCESSING_METHOD 0x001B
+#define EXIF_TAG_GPS_DATESTAMP 0x001D
/* 1th IFD TIFF Tags */
#define EXIF_TAG_COMPRESSION_SCHEME 0x0103
@@ -216,6 +219,9 @@ typedef struct {
rational_t gps_latitude[3];
rational_t gps_longitude[3];
rational_t gps_altitude;
+ rational_t gps_timestamp[3];
+ unsigned char gps_datestamp[11];
+ unsigned char gps_processing_method[100];
rational_t x_resolution;
rational_t y_resolution;
diff --git a/libs3cjpeg/JpegEncoder.cpp b/libs3cjpeg/JpegEncoder.cpp
index 848fec2..1361bca 100644
--- a/libs3cjpeg/JpegEncoder.cpp
+++ b/libs3cjpeg/JpegEncoder.cpp
@@ -29,6 +29,8 @@
#include "JpegEncoder.h"
+static const char ExifAsciiPrefix[] = { 0x41, 0x53, 0x43, 0x49, 0x49, 0x0, 0x0, 0x0 };
+
namespace android {
JpegEncoder::JpegEncoder() : available(false)
{
@@ -484,11 +486,16 @@ jpg_return_status JpegEncoder::makeExif (unsigned char *exifOut,
pCur = pIfdStart + LongerTagOffest;
- tmp = NUM_0TH_IFD_GPS;
+ if (exifInfo->gps_processing_method[0] == 0) {
+ // don't create GPS_PROCESSING_METHOD tag if there isn't any
+ tmp = NUM_0TH_IFD_GPS - 1;
+ } else {
+ tmp = NUM_0TH_IFD_GPS;
+ }
memcpy(pCur, &tmp, NUM_SIZE);
pCur += NUM_SIZE;
- LongerTagOffest += NUM_SIZE + NUM_0TH_IFD_GPS*IFD_SIZE + OFFSET_SIZE;
+ LongerTagOffest += NUM_SIZE + tmp*IFD_SIZE + OFFSET_SIZE;
writeExifIfd(&pCur, EXIF_TAG_GPS_VERSION_ID, EXIF_TYPE_BYTE,
4, exifInfo->gps_version_id);
@@ -504,6 +511,21 @@ jpg_return_status JpegEncoder::makeExif (unsigned char *exifOut,
1, exifInfo->gps_altitude_ref);
writeExifIfd(&pCur, EXIF_TAG_GPS_ALTITUDE, EXIF_TYPE_RATIONAL,
1, &exifInfo->gps_altitude, &LongerTagOffest, pIfdStart);
+ writeExifIfd(&pCur, EXIF_TAG_GPS_TIMESTAMP, EXIF_TYPE_RATIONAL,
+ 3, exifInfo->gps_timestamp, &LongerTagOffest, pIfdStart);
+ tmp = strlen((char*)exifInfo->gps_processing_method);
+ if (tmp > 0) {
+ if (tmp > 100) {
+ tmp = 100;
+ }
+ unsigned char tmp_buf[100+sizeof(ExifAsciiPrefix)];
+ memcpy(tmp_buf, ExifAsciiPrefix, sizeof(ExifAsciiPrefix));
+ memcpy(&tmp_buf[sizeof(ExifAsciiPrefix)], exifInfo->gps_processing_method, tmp);
+ writeExifIfd(&pCur, EXIF_TAG_GPS_PROCESSING_METHOD, EXIF_TYPE_UNDEFINED,
+ tmp+sizeof(ExifAsciiPrefix), tmp_buf, &LongerTagOffest, pIfdStart);
+ }
+ writeExifIfd(&pCur, EXIF_TAG_GPS_DATESTAMP, EXIF_TYPE_ASCII,
+ 11, exifInfo->gps_datestamp, &LongerTagOffest, pIfdStart);
tmp = 0;
memcpy(pCur, &tmp, OFFSET_SIZE); // next IFD offset
pCur += OFFSET_SIZE;