summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/util
diff options
context:
space:
mode:
authorxianming wang <mingwax@codeaurora.org>2018-04-04 16:36:01 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2018-04-09 18:28:33 -0700
commitdf9daa56ab5f6ddc4579d4f32692435c647e8663 (patch)
tree1a7e56218405810416ce7d7293576e347a16b209 /src/com/android/camera/util
parent3cfcf4eeddc209785e2c99aa7be9fc7abfdefe68 (diff)
downloadandroid_packages_apps_Snap-df9daa56ab5f6ddc4579d4f32692435c647e8663.tar.gz
android_packages_apps_Snap-df9daa56ab5f6ddc4579d4f32692435c647e8663.tar.bz2
android_packages_apps_Snap-df9daa56ab5f6ddc4579d4f32692435c647e8663.zip
SnapdragonCamera: Add the 60fps support for preview
Add the 60fps support for preview. CRs-Fixed: 2210765 Change-Id: If16aff4e73721050e40364c1415c8a8dfe1faa14
Diffstat (limited to 'src/com/android/camera/util')
-rwxr-xr-xsrc/com/android/camera/util/CameraUtil.java46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java
index 378d6633f..0704a90f9 100755
--- a/src/com/android/camera/util/CameraUtil.java
+++ b/src/com/android/camera/util/CameraUtil.java
@@ -1403,7 +1403,10 @@ public class CameraUtil {
// Request list size: to limit the preview to 30fps, need use maxFps/30; to maximize
// the preview frame rate, should use maxBatch size for that high speed stream
// configuration. We choose the former for now.
- int requestListSize = fpsRange.getUpper() / 30;
+ int requestListSize = getHighSpeedVideoConfigsLists((int)request.getTag());
+ if (requestListSize == -1) {
+ requestListSize = fpsRange.getUpper() / 30;
+ }
List<CaptureRequest> requestList = new ArrayList<CaptureRequest>();
// Prepare the Request builders: need carry over the request controls.
@@ -1471,6 +1474,47 @@ public class CameraUtil {
return Collections.unmodifiableList(requestList);
}
+ private static int getHighSpeedVideoConfigsLists(int cameraId) {
+ int optimalSizeIndex = -1;
+ SettingsManager settingsManager = SettingsManager.getInstance();
+ int[] table = settingsManager.getHighSpeedVideoConfigs(cameraId);
+ if (table == null) {
+ Log.w(TAG, " getHighSpeedVideoConfigsLists is null");
+ return optimalSizeIndex;
+ }
+ String videoSizeString = settingsManager.getValue(SettingsManager.KEY_VIDEO_QUALITY);
+ if (videoSizeString == null) {
+ Log.w(TAG, " KEY_VIDEO_QUALITY is null");
+ return optimalSizeIndex;
+ }
+ android.util.Size videoSize = parsePictureSize(videoSizeString);
+ String rateValue = settingsManager.getValue(SettingsManager.KEY_VIDEO_HIGH_FRAME_RATE);
+ if (rateValue == null || rateValue.substring(0, 3).equals("off")) {
+ Log.w(TAG, " KEY_VIDEO_HIGH_FRAME_RATE is null");
+ return optimalSizeIndex;
+ }
+ int frameRate = Integer.parseInt(rateValue.substring(3));
+ for (int i = 0; i < table.length; i += 5) {
+ if (table[i] == videoSize.getWidth()
+ && table[i + 1] == videoSize.getHeight()
+ && (table[i + 2] == frameRate
+ || table[i + 3] == frameRate)) {
+ if (i != table.length) {
+ optimalSizeIndex = table[i + 4];
+ return optimalSizeIndex;
+ }
+ }
+ }
+ return optimalSizeIndex;
+ }
+
+ private static android.util.Size parsePictureSize(String value) {
+ int indexX = value.indexOf('x');
+ int width = Integer.parseInt(value.substring(0, indexX));
+ int height = Integer.parseInt(value.substring(indexX + 1));
+ return new android.util.Size(width, height);
+ }
+
private static CaptureRequest.Builder constructorCaptureRequestBuilder (
CameraMetadataNative requestMetadata, boolean reprocess, int SESSION_ID_NONE,
CaptureRequest request, Set<String> physicalCameraIdSet) {