summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjinwu <jinwu@codeaurora.org>2018-11-22 16:10:27 +0800
committerjinwu <jinwu@codeaurora.org>2018-11-22 16:10:27 +0800
commitdd30707c2d5987c6329a142a7566206390913fe1 (patch)
tree6bdb1da60837e7e2c51fc4f618d36d22f24ef803 /src
parent78b730055695188e43819ddf108b63021c9d7d7c (diff)
downloadandroid_packages_apps_Snap-dd30707c2d5987c6329a142a7566206390913fe1.tar.gz
android_packages_apps_Snap-dd30707c2d5987c6329a142a7566206390913fe1.tar.bz2
android_packages_apps_Snap-dd30707c2d5987c6329a142a7566206390913fe1.zip
Upate liveshot size
1.Should support 30fps 2.Should match aspect ratio of Video size 3.If 4k recording or HFR/HSR, set liveshot size to be same as video size. Change-Id: If5b89519f55a7a8a4e92c4062d0bddd4bf4e2935
Diffstat (limited to 'src')
-rwxr-xr-xsrc/com/android/camera/CaptureModule.java41
1 files changed, 32 insertions, 9 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 5ec6f5be9..0314d2c10 100755
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -4140,16 +4140,10 @@ public class CaptureModule implements CameraModule, PhotoController,
private void updateVideoSnapshotSize() {
mVideoSnapshotSize = mVideoSize;
- if (isVideoSize1080P(mVideoSnapshotSize)) {
- updateHFRSetting();
- mHighSpeedFPSRange = new Range(mHighSpeedCaptureRate, mHighSpeedCaptureRate);
- Log.d(TAG,"updateVideoSnapshotSize " + mHighSpeedCaptureRate);
- boolean is60FPS = ((int)mHighSpeedFPSRange.getUpper() == 60);
- // if video is 1080p encode except 60fps, VideoSnapShotSize set 16M(5312x2988)
- if (!is60FPS) {
- mVideoSnapshotSize = new Size(5312, 2988);
- }
+ if (!is4kSize(mVideoSize) && (mHighSpeedCaptureRate == 0)) {
+ mVideoSnapshotSize = getMaxPictureSizeLiveshot();
}
+
String videoSnapshot = getVideoSnapshotSize();
String[] sourceStrArray = videoSnapshot.split("x");
if (sourceStrArray != null && sourceStrArray.length >= 2) {
@@ -4163,6 +4157,35 @@ public class CaptureModule implements CameraModule, PhotoController,
mVideoSnapshotThumbSize = getOptimalPreviewSize(mVideoSnapshotSize, thumbSizes); // get largest thumb size
}
+ private boolean is4kSize(Size size) {
+ return (size.getHeight() >= 2160 || size.getWidth() >= 3840);
+ }
+
+ private Size getMaxPictureSizeLiveshot() {
+ Size[] sizes = mSettingsManager.getSupportedOutputSize(getMainCameraId(), ImageFormat.JPEG);
+ float ratio = (float) mVideoSize.getWidth() / mVideoSize.getHeight();
+ Size optimalSize = null;
+ for (Size size : sizes) {
+ float pictureRatio = (float) size.getWidth() / size.getHeight();
+ if (Math.abs(pictureRatio - ratio) > 0.01) continue;
+ if (optimalSize == null || size.getWidth() > optimalSize.getWidth()) {
+ optimalSize = size;
+ }
+ }
+
+ // Cannot find one that matches the aspect ratio. This should not happen.
+ // Ignore the requirement.
+ if (optimalSize == null) {
+ Log.w(TAG, "getMaxPictureSizeLiveshot: no picture size match the aspect ratio");
+ for (Size size : sizes) {
+ if (optimalSize == null || size.getWidth() > optimalSize.getWidth()) {
+ optimalSize = size;
+ }
+ }
+ }
+ return optimalSize;
+ }
+
private String getVideoSnapshotSize(){
return SystemProperties.get("persist.sys.camera.video.snapshotsize", "");
}