summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Gernoth <michael@gernoth.net>2016-01-07 20:42:31 +0100
committerZiyan <jaraidaniel@gmail.com>2016-01-17 22:47:34 +0100
commite723d21643b2d330ca99b07f20cc5566c2743f0e (patch)
tree5b5a3722561c6ced21fe6c6bb6bc30982d9a2982
parent22f5a971e82bc1dc229f34ffa93be9fe0dec9053 (diff)
downloaddevice_samsung_tuna-e723d21643b2d330ca99b07f20cc5566c2743f0e.zip
device_samsung_tuna-e723d21643b2d330ca99b07f20cc5566c2743f0e.tar.gz
device_samsung_tuna-e723d21643b2d330ca99b07f20cc5566c2743f0e.tar.bz2
camera: add Pixel{X,Y}Dimension and Orientation EXIF tags
These tags are needed by the CM13 camera to not crop images to square when shooting portrait. As the camera HAL already rotated the picture, always set orientation to 0. Change-Id: Id8b6aac5369ae3adfdfec0ec7528edc849bd3b10
-rw-r--r--camera/OMXCameraAdapter/OMXExif.cpp34
-rw-r--r--camera/inc/Encoder_libjpeg.h2
2 files changed, 33 insertions, 3 deletions
diff --git a/camera/OMXCameraAdapter/OMXExif.cpp b/camera/OMXCameraAdapter/OMXExif.cpp
index b4fde5a..f9ed59d 100644
--- a/camera/OMXCameraAdapter/OMXExif.cpp
+++ b/camera/OMXCameraAdapter/OMXExif.cpp
@@ -237,7 +237,7 @@ status_t OMXCameraAdapter::setupEXIF()
struct timeval sTv;
struct tm *pTime;
OMXCameraPortParameters * capData = NULL;
- CameraBuffer *memmgr_buf_array;
+ CameraBuffer *memmgr_buf_array = NULL;
int buf_size = 0;
LOG_FUNCTION_NAME;
@@ -373,6 +373,28 @@ status_t OMXCameraAdapter::setupEXIF()
exifTags->eStatusImageHeight = OMX_TI_TagUpdated;
}
+ if ( OMX_TI_TagReadWrite == exifTags->eStatusPixelXDimension &&
+ OMX_TI_TagReadWrite == exifTags->eStatusPixelYDimension)
+ {
+ if (mPictureRotation == 90 || mPictureRotation == 270) {
+ exifTags->ulPixelXDimension = capData->mHeight;
+ exifTags->ulPixelYDimension = capData->mWidth;
+ }
+ else
+ {
+ exifTags->ulPixelXDimension = capData->mWidth;
+ exifTags->ulPixelYDimension = capData->mHeight;
+ }
+ exifTags->eStatusPixelXDimension = OMX_TI_TagUpdated;
+ exifTags->eStatusPixelYDimension = OMX_TI_TagUpdated;
+ }
+
+ if ( OMX_TI_TagReadWrite == exifTags->eStatusOrientation)
+ {
+ exifTags->usOrientation = 0;
+ exifTags->eStatusOrientation = OMX_TI_TagUpdated;
+ }
+
if ( ( OMX_TI_TagReadWrite == exifTags->eStatusGpsLatitude ) &&
( mEXIFData.mGPSData.mLatValid ) )
{
@@ -560,14 +582,20 @@ status_t OMXCameraAdapter::setupEXIF_libjpeg(ExifElementsTable* exifTable,
if ((NO_ERROR == ret)) {
char temp_value[5];
- snprintf(temp_value, sizeof(temp_value)/sizeof(char), "%lu", capData->mWidth);
+ snprintf(temp_value, sizeof(temp_value)/sizeof(char), "%lu", (unsigned long)capData->mWidth);
ret = exifTable->insertElement(TAG_IMAGE_WIDTH, temp_value);
+ if ((NO_ERROR == ret)) {
+ ret = exifTable->insertElement(TAG_EXIF_IMAGE_WIDTH, temp_value);
+ }
}
if ((NO_ERROR == ret)) {
char temp_value[5];
- snprintf(temp_value, sizeof(temp_value)/sizeof(char), "%lu", capData->mHeight);
+ snprintf(temp_value, sizeof(temp_value)/sizeof(char), "%lu", (unsigned long)capData->mHeight);
ret = exifTable->insertElement(TAG_IMAGE_LENGTH, temp_value);
+ if ((NO_ERROR == ret)) {
+ ret = exifTable->insertElement(TAG_EXIF_IMAGE_LENGTH, temp_value);
+ }
}
if ((NO_ERROR == ret) && (mEXIFData.mGPSData.mLatValid)) {
diff --git a/camera/inc/Encoder_libjpeg.h b/camera/inc/Encoder_libjpeg.h
index 72feb08..bb41562 100644
--- a/camera/inc/Encoder_libjpeg.h
+++ b/camera/inc/Encoder_libjpeg.h
@@ -63,6 +63,8 @@ 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_EXIF_IMAGE_WIDTH[] = "ExifImageWidth";
+static const char TAG_EXIF_IMAGE_LENGTH[] = "ExifImageLength";
static const char TAG_GPS_LAT[] = "GPSLatitude";
static const char TAG_GPS_LAT_REF[] = "GPSLatitudeRef";
static const char TAG_GPS_LONG[] = "GPSLongitude";