Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java

Issue 2798263003: Image Capture: add |supports_torch| field to mojom (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 builder.setMinColorTemperature(COLOR_TEMPERATURES_MAP.keyAt(0)); 790 builder.setMinColorTemperature(COLOR_TEMPERATURES_MAP.keyAt(0));
791 builder.setMaxColorTemperature( 791 builder.setMaxColorTemperature(
792 COLOR_TEMPERATURES_MAP.keyAt(COLOR_TEMPERATURES_MAP.size() - 1)) ; 792 COLOR_TEMPERATURES_MAP.keyAt(COLOR_TEMPERATURES_MAP.size() - 1)) ;
793 final int index = COLOR_TEMPERATURES_MAP.indexOfValue(whiteBalanceMode); 793 final int index = COLOR_TEMPERATURES_MAP.indexOfValue(whiteBalanceMode);
794 if (index >= 0) { 794 if (index >= 0) {
795 builder.setCurrentColorTemperature(COLOR_TEMPERATURES_MAP.keyAt(inde x)); 795 builder.setCurrentColorTemperature(COLOR_TEMPERATURES_MAP.keyAt(inde x));
796 } 796 }
797 builder.setStepColorTemperature(1); 797 builder.setStepColorTemperature(1);
798 798
799 if (!cameraCharacteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABL E)) { 799 if (!cameraCharacteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABL E)) {
800 builder.setTorch(false); 800 builder.setSupportsTorch(false);
801 builder.setRedEyeReduction(false); 801 builder.setRedEyeReduction(false);
802 } else { 802 } else {
803 // There's no way to query if torch and/or red eye reduction modes a re available using 803 // There's no way to query if torch and/or red eye reduction modes a re available using
804 // Camera2 API but since there's a Flash unit, we assume so. 804 // Camera2 API but since there's a Flash unit, we assume so.
805 builder.setTorch(true); 805 builder.setSupportsTorch(true);
806 builder.setTorch(mPreviewRequest.get(CaptureRequest.FLASH_MODE)
807 == CameraMetadata.FLASH_MODE_TORCH);
808
806 builder.setRedEyeReduction(true); 809 builder.setRedEyeReduction(true);
807 810
808 final int[] flashModes = 811 final int[] flashModes =
809 cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_A VAILABLE_MODES); 812 cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_A VAILABLE_MODES);
810 ArrayList<Integer> modes = new ArrayList<Integer>(0); 813 ArrayList<Integer> modes = new ArrayList<Integer>(0);
811 for (int flashMode : flashModes) { 814 for (int flashMode : flashModes) {
812 if (flashMode == CameraMetadata.FLASH_MODE_OFF) { 815 if (flashMode == CameraMetadata.FLASH_MODE_OFF) {
813 modes.add(Integer.valueOf(AndroidFillLightMode.OFF)); 816 modes.add(Integer.valueOf(AndroidFillLightMode.OFF));
814 } else if (flashMode == CameraMetadata.CONTROL_AE_MODE_ON_AUTO_F LASH) { 817 } else if (flashMode == CameraMetadata.CONTROL_AE_MODE_ON_AUTO_F LASH) {
815 modes.add(Integer.valueOf(AndroidFillLightMode.AUTO)); 818 modes.add(Integer.valueOf(AndroidFillLightMode.AUTO));
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 return false; 970 return false;
968 } 971 }
969 return true; 972 return true;
970 } 973 }
971 974
972 @Override 975 @Override
973 public void deallocate() { 976 public void deallocate() {
974 Log.d(TAG, "deallocate"); 977 Log.d(TAG, "deallocate");
975 } 978 }
976 } 979 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698