diff options
author | Angus Kong <shkong@google.com> | 2011-09-28 22:53:37 +0800 |
---|---|---|
committer | Angus Kong <shkong@google.com> | 2011-09-29 15:28:41 +0800 |
commit | ea312297ff6132bbafed99b90a72e4858b888fa4 (patch) | |
tree | e9bd250e5ffe0cdeb13218ea1f0ce1a7b8be175e | |
parent | 5fe35de7479dcb221dae3ecc08d0b33502d72a61 (diff) | |
download | LegacyCamera-ea312297ff6132bbafed99b90a72e4858b888fa4.zip LegacyCamera-ea312297ff6132bbafed99b90a72e4858b888fa4.tar.gz LegacyCamera-ea312297ff6132bbafed99b90a72e4858b888fa4.tar.bz2 |
Add dimension attributes to MediaStore.
1. Width/height of still images added.
2. Resolution of videos added.
bug:5376821
Change-Id: I809743ae777e6bbc01e3a86651e7cd6489a81c86
-rw-r--r-- | src/com/android/camera/Camera.java | 7 | ||||
-rw-r--r-- | src/com/android/camera/Storage.java | 6 | ||||
-rw-r--r-- | src/com/android/camera/VideoCamera.java | 8 | ||||
-rw-r--r-- | src/com/android/camera/panorama/PanoramaActivity.java | 6 |
4 files changed, 17 insertions, 10 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 4bfd602..dc4d45d 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -678,7 +678,8 @@ public class Camera extends ActivityBase implements FocusManager.Listener, } if (!mIsImageCaptureIntent) { - storeImage(jpegData, mLocation); + Size s = mParameters.getPictureSize(); + storeImage(jpegData, mLocation, s.width, s.height); } else { mJpegImageData = jpegData; if (!mQuickCapture) { @@ -745,12 +746,12 @@ public class Camera extends ActivityBase implements FocusManager.Listener, } } - private void storeImage(final byte[] data, Location loc) { + private void storeImage(final byte[] data, Location loc, int width, int height) { long dateTaken = System.currentTimeMillis(); String title = Util.createJpegName(dateTaken); int orientation = Exif.getOrientation(data); Uri uri = Storage.addImage(mContentResolver, title, dateTaken, - loc, orientation, data); + loc, orientation, data, width, height); if (uri != null) { // Create a thumbnail whose width is equal or bigger than that of the preview. int ratio = (int) Math.ceil((double) mParameters.getPictureSize().width diff --git a/src/com/android/camera/Storage.java b/src/com/android/camera/Storage.java index 3cb05a8..a9f67c9 100644 --- a/src/com/android/camera/Storage.java +++ b/src/com/android/camera/Storage.java @@ -47,8 +47,8 @@ public class Storage { private static final int BUFSIZE = 4096; - public static Uri addImage(ContentResolver resolver, String title, - long date, Location location, int orientation, byte[] jpeg) { + public static Uri addImage(ContentResolver resolver, String title, long date, + Location location, int orientation, byte[] jpeg, int width, int height) { // Save the image. String path = DIRECTORY + '/' + title + ".jpg"; FileOutputStream out = null; @@ -74,6 +74,8 @@ public class Storage { values.put(ImageColumns.ORIENTATION, orientation); values.put(ImageColumns.DATA, path); values.put(ImageColumns.SIZE, jpeg.length); + values.put(ImageColumns.WIDTH, width); + values.put(ImageColumns.HEIGHT, height); if (location != null) { values.put(ImageColumns.LATITUDE, location.getLatitude()); diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index 4e2532a..537db23 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -1297,6 +1297,9 @@ public class VideoCamera extends ActivityBase mCurrentVideoValues.put(Video.Media.DATE_TAKEN, dateTaken); mCurrentVideoValues.put(Video.Media.MIME_TYPE, mime); mCurrentVideoValues.put(Video.Media.DATA, mVideoFilename); + mCurrentVideoValues.put(Video.Media.RESOLUTION, + Integer.toString(mProfile.videoFrameWidth) + "x" + + Integer.toString(mProfile.videoFrameHeight)); Log.v(TAG, "New video filename: " + mVideoFilename); } @@ -2204,8 +2207,9 @@ public class VideoCamera extends ActivityBase long dateTaken = System.currentTimeMillis(); String title = Util.createJpegName(dateTaken); int orientation = Exif.getOrientation(data); - Uri uri = Storage.addImage(mContentResolver, title, dateTaken, - loc, orientation, data); + Size s = mParameters.getPictureSize(); + Uri uri = Storage.addImage(mContentResolver, title, dateTaken, loc, orientation, data, + s.width, s.height); if (uri != null) { // Create a thumbnail whose width is equal or bigger than that of the preview. int ratio = (int) Math.ceil((double) mParameters.getPictureSize().width diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java index b335249..b410c29 100644 --- a/src/com/android/camera/panorama/PanoramaActivity.java +++ b/src/com/android/camera/panorama/PanoramaActivity.java @@ -753,7 +753,7 @@ public class PanoramaActivity extends Activity implements mMainHandler.sendEmptyMessage(MSG_GENERATE_FINAL_MOSAIC_ERROR); } else { int orientation = Exif.getOrientation(jpeg.data); - Uri uri = savePanorama(jpeg.data, orientation); + Uri uri = savePanorama(jpeg.data, jpeg.width, jpeg.height, orientation); if (uri != null) { // Create a thumbnail whose width is equal or bigger // than the entire screen. @@ -841,12 +841,12 @@ public class PanoramaActivity extends Activity implements mReviewLayout.setVisibility(View.VISIBLE); } - private Uri savePanorama(byte[] jpegData, int orientation) { + private Uri savePanorama(byte[] jpegData, int width, int height, int orientation) { if (jpegData != null) { String imagePath = PanoUtil.createName( getResources().getString(R.string.pano_file_name_format), mTimeTaken); return Storage.addImage(getContentResolver(), imagePath, mTimeTaken, null, - orientation, jpegData); + orientation, jpegData, width, height); } return null; } |