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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 // https://crbug.com/518807. | 372 // https://crbug.com/518807. |
373 } | 373 } |
374 | 374 |
375 // |mExposureMode|, |mFillLightMode| and |mTorch| interact to configure
the AE and Flash | 375 // |mExposureMode|, |mFillLightMode| and |mTorch| interact to configure
the AE and Flash |
376 // modes. In a nutshell, FLASH_MODE is only effective if the auto-exposu
re is ON/OFF, | 376 // modes. In a nutshell, FLASH_MODE is only effective if the auto-exposu
re is ON/OFF, |
377 // otherwise the auto-exposure related flash control (ON_{AUTO,ALWAYS}_F
LASH{_REDEYE) takes | 377 // otherwise the auto-exposure related flash control (ON_{AUTO,ALWAYS}_F
LASH{_REDEYE) takes |
378 // priority. |mTorch| mode overrides any previous |mFillLightMode| flas
h control. | 378 // priority. |mTorch| mode overrides any previous |mFillLightMode| flas
h control. |
379 if (mExposureMode == AndroidMeteringMode.NONE | 379 if (mExposureMode == AndroidMeteringMode.NONE |
380 || mExposureMode == AndroidMeteringMode.FIXED) { | 380 || mExposureMode == AndroidMeteringMode.FIXED) { |
381 requestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CameraMetadata.CO
NTROL_AE_MODE_OFF); | 381 requestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CameraMetadata.CO
NTROL_AE_MODE_OFF); |
| 382 |
| 383 // We need to configure by hand the exposure time when AE mode is of
f. Set it to the |
| 384 // middle of the allowed range. Further tuning will be done via |mIs
o|. |
| 385 final CameraCharacteristics cameraCharacteristics = |
| 386 getCameraCharacteristics(mContext, mId); |
| 387 Range<Long> range = cameraCharacteristics.get( |
| 388 CameraCharacteristics.SENSOR_INFO_EXPOSURE_TIME_RANGE); |
| 389 requestBuilder.set(CaptureRequest.SENSOR_EXPOSURE_TIME, |
| 390 range.getLower() + (range.getUpper() + range.getLower()) / 2
/* nanoseconds*/); |
| 391 |
382 } else { | 392 } else { |
383 requestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CameraMetadata.CO
NTROL_AE_MODE_ON); | 393 requestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CameraMetadata.CO
NTROL_AE_MODE_ON); |
384 requestBuilder.set(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, mAeFp
sRange); | 394 requestBuilder.set(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, mAeFp
sRange); |
385 } | 395 } |
386 switch (mFillLightMode) { | 396 switch (mFillLightMode) { |
387 case AndroidFillLightMode.OFF: | 397 case AndroidFillLightMode.OFF: |
388 requestBuilder.set(CaptureRequest.FLASH_MODE, CameraMetadata.FLA
SH_MODE_OFF); | 398 requestBuilder.set(CaptureRequest.FLASH_MODE, CameraMetadata.FLA
SH_MODE_OFF); |
389 break; | 399 break; |
390 case AndroidFillLightMode.AUTO: | 400 case AndroidFillLightMode.AUTO: |
391 // Setting the AE to CONTROL_AE_MODE_ON_AUTO_FLASH[_REDEYE] over
rides FLASH_MODE. | 401 // Setting the AE to CONTROL_AE_MODE_ON_AUTO_FLASH[_REDEYE] over
rides FLASH_MODE. |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 return false; | 1030 return false; |
1021 } | 1031 } |
1022 return true; | 1032 return true; |
1023 } | 1033 } |
1024 | 1034 |
1025 @Override | 1035 @Override |
1026 public void deallocate() { | 1036 public void deallocate() { |
1027 Log.d(TAG, "deallocate"); | 1037 Log.d(TAG, "deallocate"); |
1028 } | 1038 } |
1029 } | 1039 } |
OLD | NEW |