summaryrefslogtreecommitdiffstats
path: root/camera/inc
diff options
context:
space:
mode:
authorTyler Luu <tluu@ti.com>2011-09-07 22:19:09 -0500
committerIliyan Malchev <malchev@google.com>2011-09-12 16:15:48 -0700
commit36e9bdd56757ff8048e08f6e52f234480c44f122 (patch)
tree5eccf8d64f6fd808fc2d1a6ed8f590cdc49607ef /camera/inc
parent6b5eaf29c3d17a24731bf9271bd0d199d433813e (diff)
downloadhardware_ti_omap4xxx-36e9bdd56757ff8048e08f6e52f234480c44f122.zip
hardware_ti_omap4xxx-36e9bdd56757ff8048e08f6e52f234480c44f122.tar.gz
hardware_ti_omap4xxx-36e9bdd56757ff8048e08f6e52f234480c44f122.tar.bz2
CameraHal: Add Exif support to video snapshot
Use jhead library to insert Exif to jpeg stream returned from libjpeg. Change-Id: Ia6398180b7ef3c1b3ddcb35e489527289565fef5 Signed-off-by: Tyler Luu <tluu@ti.com>
Diffstat (limited to 'camera/inc')
-rw-r--r--camera/inc/CameraHal.h6
-rw-r--r--camera/inc/Encoder_libjpeg.h43
-rw-r--r--camera/inc/OMXCameraAdapter/OMXCameraAdapter.h2
3 files changed, 50 insertions, 1 deletions
diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h
index 36a3504..f19acea 100644
--- a/camera/inc/CameraHal.h
+++ b/camera/inc/CameraHal.h
@@ -238,11 +238,13 @@ class CameraFrame
enum FrameQuirks
{
ENCODE_RAW_YUV422I_TO_JPEG = 0x1 << 0,
+ HAS_EXIF_DATA = 0x1 << 1,
};
//default contrustor
CameraFrame():
mCookie(NULL),
+ mCookie2(NULL),
mBuffer(NULL),
mFrameType(0),
mTimestamp(0),
@@ -257,6 +259,7 @@ class CameraFrame
//copy constructor
CameraFrame(const CameraFrame &frame) :
mCookie(frame.mCookie),
+ mCookie2(frame.mCookie2),
mBuffer(frame.mBuffer),
mFrameType(frame.mFrameType),
mTimestamp(frame.mTimestamp),
@@ -269,6 +272,7 @@ class CameraFrame
mQuirks(frame.mQuirks) {}
void *mCookie;
+ void *mCookie2;
void *mBuffer;
int mFrameType;
nsecs_t mTimestamp;
@@ -540,7 +544,7 @@ public:
status_t useMetaDataBufferMode(bool enable);
- void EncoderDoneCb(size_t jpeg_size, uint8_t* src, CameraFrame::FrameType type, void* cookie1);
+ void EncoderDoneCb(size_t jpeg_size, uint8_t* src, CameraFrame::FrameType type, void* cookie1, void* cookie2);
//Internal class definitions
class NotificationThread : public Thread {
diff --git a/camera/inc/Encoder_libjpeg.h b/camera/inc/Encoder_libjpeg.h
index 24ce672..8aaae02 100644
--- a/camera/inc/Encoder_libjpeg.h
+++ b/camera/inc/Encoder_libjpeg.h
@@ -27,12 +27,17 @@
#include <utils/threads.h>
#include <utils/RefBase.h>
+extern "C" {
+#include "jhead.h"
+}
namespace android {
/**
* libjpeg encoder class - uses libjpeg to encode yuv
*/
+#define MAX_EXIF_TAGS_SUPPORTED 30
+
typedef void (*encoder_libjpeg_callback_t) (size_t jpeg_size,
uint8_t* src,
CameraFrame::FrameType type,
@@ -40,6 +45,44 @@ typedef void (*encoder_libjpeg_callback_t) (size_t jpeg_size,
void* cookie2,
void* cookie3);
+static const char TAG_MODEL[] = "Model";
+static const char TAG_MAKE[] = "Make";
+static const char TAG_FOCALLENGTH[] = "FocalLength";
+static const char TAG_DATETIME[] = "DateTime";
+static const char TAG_IMAGE_WIDTH[] = "ImageWidth";
+static const char TAG_IMAGE_LENGTH[] = "ImageLength";
+static const char TAG_GPS_LAT[] = "GPSLatitude";
+static const char TAG_GPS_LAT_REF[] = "GPSLatitudeRef";
+static const char TAG_GPS_LONG[] = "GPSLongitude";
+static const char TAG_GPS_LONG_REF[] = "GPSLongitudeRef";
+static const char TAG_GPS_ALT[] = "GPSAltitude";
+static const char TAG_GPS_ALT_REF[] = "GPSAltitudeRef";
+static const char TAG_GPS_MAP_DATUM[] = "GPSMapDatum";
+static const char TAG_GPS_PROCESSING_METHOD[] = "GPSProcessingMethod";
+static const char TAG_GPS_VERSION_ID[] = "GPSVersionID";
+static const char TAG_GPS_TIMESTAMP[] = "GPSTimeStamp";
+static const char TAG_GPS_DATESTAMP[] = "GPSDateStamp";
+static const char TAG_ORIENTATION[] = "Orientation";
+
+class ExifElementsTable {
+ public:
+ ExifElementsTable() :
+ gps_tag_count(0), exif_tag_count(0), position(0),
+ jpeg_opened(false) { }
+ ~ExifElementsTable();
+
+ status_t insertElement(const char* tag, const char* value);
+ void insertExifToJpeg(unsigned char* jpeg, size_t jpeg_size);
+ void saveJpeg(unsigned char* picture, size_t jpeg_size);
+ static const char* degreesToExifOrientation(const char*);
+ private:
+ ExifElement_t table[MAX_EXIF_TAGS_SUPPORTED];
+ unsigned int gps_tag_count;
+ unsigned int exif_tag_count;
+ unsigned int position;
+ bool jpeg_opened;
+};
+
class Encoder_libjpeg : public Thread {
public:
Encoder_libjpeg(uint8_t* src,
diff --git a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
index b7d7f2d..c01ca02 100644
--- a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
+++ b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
@@ -34,6 +34,7 @@
#include "General3A_Settings.h"
#include "BaseCameraAdapter.h"
+#include "Encoder_libjpeg.h"
#include "DebugUtils.h"
@@ -425,6 +426,7 @@ private:
BaseCameraAdapter::AdapterState state);
status_t convertGPSCoord(double coord, int &deg, int &min, int &sec, int &secDivisor);
status_t setupEXIF();
+ status_t setupEXIF_libjpeg(ExifElementsTable*);
//Focus functionality
status_t doAutoFocus();