diff options
Diffstat (limited to 'src/com/android/camera/util/CameraUtil.java')
-rwxr-xr-x | src/com/android/camera/util/CameraUtil.java | 46 |
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) { |