diff options
author | Michael Gernoth <michael@gernoth.net> | 2016-01-07 20:42:31 +0100 |
---|---|---|
committer | Ziyan <jaraidaniel@gmail.com> | 2016-01-17 22:47:34 +0100 |
commit | e723d21643b2d330ca99b07f20cc5566c2743f0e (patch) | |
tree | 5b5a3722561c6ced21fe6c6bb6bc30982d9a2982 /camera/OMXCameraAdapter | |
parent | 22f5a971e82bc1dc229f34ffa93be9fe0dec9053 (diff) | |
download | device_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
Diffstat (limited to 'camera/OMXCameraAdapter')
-rw-r--r-- | camera/OMXCameraAdapter/OMXExif.cpp | 34 |
1 files changed, 31 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)) { |