summaryrefslogtreecommitdiffstats
path: root/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2Settings.java
diff options
context:
space:
mode:
authorSol Boucher <solb@google.com>2014-06-09 12:05:13 -0700
committerSol Boucher <solb@google.com>2014-07-08 15:17:16 -0700
commita0842b40441db5332a5290f941021636b1182761 (patch)
treef87677f9a18112b5b8e4bcff2a502c8a416fa70d /camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2Settings.java
parent858edec400cf5c7cf3171f877f81bbc891fc4bcc (diff)
downloadandroid_frameworks_ex-a0842b40441db5332a5290f941021636b1182761.tar.gz
android_frameworks_ex-a0842b40441db5332a5290f941021636b1182761.tar.bz2
android_frameworks_ex-a0842b40441db5332a5290f941021636b1182761.zip
camera2-portability: Add support for previews using the camera2 API
At the moment, only SurfaceTextures (and not SurfaceViews/SurfaceHolders) are supported. The tests still only cover Stringifier and IntegralStringifier. Change-Id: Ie643c58f8383cd3b9f59c16e0b79239df0ca068d
Diffstat (limited to 'camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2Settings.java')
-rw-r--r--camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2Settings.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2Settings.java b/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2Settings.java
new file mode 100644
index 0000000..e21e177
--- /dev/null
+++ b/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2Settings.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ex.camera2.portability;
+
+import android.hardware.camera2.CaptureRequest;
+
+/**
+ * The subclass of {@link CameraSettings} for Android Camera 2 API.
+ */
+public class AndroidCamera2Settings extends CameraSettings {
+ // TODO: Implement more completely
+ public AndroidCamera2Settings(AndroidCamera2Capabilities capabilities,
+ CaptureRequest.Builder request,
+ Size preview, Size photo) {
+ // TODO: Support zoom
+ setZoomRatio(1.0f);
+ setZoomIndex(0);
+
+ // TODO: Set exposure compensation
+
+ AndroidCamera2Capabilities.IntegralStringifier stringifier =
+ capabilities.getIntegralStringifier();
+ setFocusMode(stringifier.focusModeFromInt(request.get(CaptureRequest.CONTROL_AF_MODE)));
+ setFlashMode(stringifier.flashModeFromInt(request.get(CaptureRequest.FLASH_MODE)));
+ setSceneMode(stringifier.sceneModeFromInt(request.get(CaptureRequest.CONTROL_SCENE_MODE)));
+
+ // This is mutability-safe because those setters copy the Size objects
+ setPreviewSize(preview);
+ setPhotoSize(photo);
+
+ // TODO: Initialize formats, too
+ }
+}