diff options
author | Jay Wang <jaywang@codeaurora.org> | 2016-07-25 18:16:26 -0700 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-08-25 21:55:20 -0700 |
commit | 77b89f98961440d1a316ba2fdf4af72840f7fc05 (patch) | |
tree | 6e208d3e6568d6164775ec0a06383a8d0d74c040 | |
parent | 8efd5085fb1e8e4d7561889d32bd9c64bd920cd7 (diff) | |
download | android_packages_apps_Snap-77b89f98961440d1a316ba2fdf4af72840f7fc05.tar.gz android_packages_apps_Snap-77b89f98961440d1a316ba2fdf4af72840f7fc05.tar.bz2 android_packages_apps_Snap-77b89f98961440d1a316ba2fdf4af72840f7fc05.zip |
SnapdragonCamera: Provide correct orientation when adding image
Read orientation from exif and provide to content provider
when adding image.
CRs-Fixed: 993611
Change-Id: Ic2079dd1b5e6bdb93f73b4084749b3cbc68b3f86
-rw-r--r-- | src/com/android/camera/CaptureModule.java | 17 | ||||
-rw-r--r-- | src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java | 11 |
2 files changed, 23 insertions, 5 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index b35da5d06..20b25f3aa 100644 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -71,6 +71,8 @@ import android.view.SurfaceHolder; import android.view.View; import android.widget.Toast; +import com.android.camera.exif.ExifInterface; +import com.android.camera.Exif; import com.android.camera.imageprocessor.filter.ImageFilter; import com.android.camera.imageprocessor.PostProcessor; import com.android.camera.imageprocessor.FrameProcessor; @@ -1302,8 +1304,11 @@ public class CaptureModule implements CameraModule, PhotoController, byte[] bytes = getJpegData(image); mLastJpegData = bytes; + ExifInterface exif = Exif.getExif(bytes); + int orientation = Exif.getOrientation(exif); + mActivity.getMediaSaveService().addImage(bytes, title, date, - null, image.getWidth(), image.getHeight(), 0, null, + null, image.getWidth(), image.getHeight(), orientation, null, mOnMediaSavedListener, mContentResolver, "jpeg"); image.close(); } @@ -1342,8 +1347,11 @@ public class CaptureModule implements CameraModule, PhotoController, mLastJpegData = bytes; buffer.get(bytes); + ExifInterface exif = Exif.getExif(bytes); + int orientation = Exif.getOrientation(exif); + mActivity.getMediaSaveService().addImage(bytes, title, date, - null, image.getWidth(), image.getHeight(), 0, null, + null, image.getWidth(), image.getHeight(), orientation, null, mOnMediaSavedListener, mContentResolver, "jpeg"); image.close(); } @@ -3160,9 +3168,12 @@ public class CaptureModule implements CameraModule, PhotoController, byte[] monoBytes = getJpegData(monoImage); mLastJpegData = bayerBytes; + ExifInterface exif = Exif.getExif(bayerBytes); + int orientation = Exif.getOrientation(exif); + mActivity.getMediaSaveService().addMpoImage( null, bayerBytes, monoBytes, width, height, title, - date, null, 0, mOnMediaSavedListener, mContentResolver, "jpeg"); + date, null, orientation, mOnMediaSavedListener, mContentResolver, "jpeg"); bayerImage.close(); bayerImage = null; diff --git a/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java b/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java index 8970ca8e8..3a94baec9 100644 --- a/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java +++ b/src/org/codeaurora/snapcam/filter/ClearSightImageProcessor.java @@ -29,6 +29,7 @@ package org.codeaurora.snapcam.filter; +import java.io.IOException; import java.io.ByteArrayOutputStream; import java.nio.ByteBuffer; import java.util.ArrayDeque; @@ -65,6 +66,8 @@ import android.util.Log; import android.view.Surface; import com.android.camera.CaptureModule; +import com.android.camera.Exif; +import com.android.camera.exif.ExifInterface; import com.android.camera.MediaSaveService; import com.android.camera.MediaSaveService.OnMediaSavedListener; import com.android.camera.PhotoModule.NamedImages; @@ -821,11 +824,15 @@ public class ClearSightImageProcessor { height = mClearSightImage.getHeight(); } + byte[] bayerBytes = getJpegData(mBayerImage); + ExifInterface exif = Exif.getExif(bayerBytes); + int orientation = Exif.getOrientation(exif); + mMediaSaveService.addMpoImage( getJpegData(mClearSightImage), - getJpegData(mBayerImage), + bayerBytes, getJpegData(mMonoImage), width, height, title, - date, null, 0, mMediaSavedListener, + date, null, orientation, mMediaSavedListener, mMediaSaveService.getContentResolver(), "jpeg"); mBayerImage.close(); |