| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.media; | 5 package org.chromium.media; |
| 6 | 6 |
| 7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.graphics.ImageFormat; | 9 import android.graphics.ImageFormat; |
| 10 import android.graphics.Rect; | 10 import android.graphics.Rect; |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 COLOR_TEMPERATURES_MAP.append(7000, CameraMetadata.CONTROL_AWB_MODE_SHAD
E); | 251 COLOR_TEMPERATURES_MAP.append(7000, CameraMetadata.CONTROL_AWB_MODE_SHAD
E); |
| 252 }; | 252 }; |
| 253 | 253 |
| 254 private static enum CameraState { OPENING, CONFIGURING, STARTED, STOPPED } | 254 private static enum CameraState { OPENING, CONFIGURING, STARTED, STOPPED } |
| 255 | 255 |
| 256 private final Object mCameraStateLock = new Object(); | 256 private final Object mCameraStateLock = new Object(); |
| 257 | 257 |
| 258 private CameraDevice mCameraDevice; | 258 private CameraDevice mCameraDevice; |
| 259 private CameraCaptureSession mPreviewSession; | 259 private CameraCaptureSession mPreviewSession; |
| 260 private CaptureRequest mPreviewRequest; | 260 private CaptureRequest mPreviewRequest; |
| 261 private Handler mMainHandler = null; | 261 private Handler mMainHandler; |
| 262 | 262 |
| 263 private CameraState mCameraState = CameraState.STOPPED; | 263 private CameraState mCameraState = CameraState.STOPPED; |
| 264 private final float mMaxZoom; | 264 private final float mMaxZoom; |
| 265 private Rect mCropRect = new Rect(); | 265 private Rect mCropRect = new Rect(); |
| 266 private int mPhotoWidth = 0; | 266 private int mPhotoWidth; |
| 267 private int mPhotoHeight = 0; | 267 private int mPhotoHeight; |
| 268 private int mFocusMode = AndroidMeteringMode.CONTINUOUS; | 268 private int mFocusMode = AndroidMeteringMode.CONTINUOUS; |
| 269 private int mExposureMode = AndroidMeteringMode.CONTINUOUS; | 269 private int mExposureMode = AndroidMeteringMode.CONTINUOUS; |
| 270 private MeteringRectangle mAreaOfInterest; | 270 private MeteringRectangle mAreaOfInterest; |
| 271 private int mExposureCompensation = 0; | 271 private int mExposureCompensation; |
| 272 private int mWhiteBalanceMode = AndroidMeteringMode.CONTINUOUS; | 272 private int mWhiteBalanceMode = AndroidMeteringMode.CONTINUOUS; |
| 273 private int mColorTemperature = -1; | 273 private int mColorTemperature = -1; |
| 274 private int mIso = 0; | 274 private int mIso; |
| 275 private boolean mRedEyeReduction = false; | 275 private boolean mRedEyeReduction; |
| 276 private int mFillLightMode = AndroidFillLightMode.OFF; | 276 private int mFillLightMode = AndroidFillLightMode.OFF; |
| 277 | 277 |
| 278 // Service function to grab CameraCharacteristics and handle exceptions. | 278 // Service function to grab CameraCharacteristics and handle exceptions. |
| 279 private static CameraCharacteristics getCameraCharacteristics(Context appCon
text, int id) { | 279 private static CameraCharacteristics getCameraCharacteristics(Context appCon
text, int id) { |
| 280 final CameraManager manager = | 280 final CameraManager manager = |
| 281 (CameraManager) appContext.getSystemService(Context.CAMERA_SERVI
CE); | 281 (CameraManager) appContext.getSystemService(Context.CAMERA_SERVI
CE); |
| 282 try { | 282 try { |
| 283 return manager.getCameraCharacteristics(Integer.toString(id)); | 283 return manager.getCameraCharacteristics(Integer.toString(id)); |
| 284 } catch (CameraAccessException ex) { | 284 } catch (CameraAccessException ex) { |
| 285 Log.e(TAG, "getCameraCharacteristics: ", ex); | 285 Log.e(TAG, "getCameraCharacteristics: ", ex); |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 return false; | 945 return false; |
| 946 } | 946 } |
| 947 return true; | 947 return true; |
| 948 } | 948 } |
| 949 | 949 |
| 950 @Override | 950 @Override |
| 951 public void deallocate() { | 951 public void deallocate() { |
| 952 Log.d(TAG, "deallocate"); | 952 Log.d(TAG, "deallocate"); |
| 953 } | 953 } |
| 954 } | 954 } |
| OLD | NEW |