|
|
@ -60,8 +60,8 @@ public class CameraOptions { |
|
|
|
private float exposureCorrectionMinValue; |
|
|
|
private float exposureCorrectionMinValue; |
|
|
|
private float exposureCorrectionMaxValue; |
|
|
|
private float exposureCorrectionMaxValue; |
|
|
|
private boolean autoFocusSupported; |
|
|
|
private boolean autoFocusSupported; |
|
|
|
private float fpsRangeMinValue; |
|
|
|
private float previewFrameRateMinValue; |
|
|
|
private float fpsRangeMaxValue; |
|
|
|
private float previewFrameRateMaxValue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public CameraOptions(@NonNull Camera.Parameters params, int cameraId, boolean flipSizes) { |
|
|
|
public CameraOptions(@NonNull Camera.Parameters params, int cameraId, boolean flipSizes) { |
|
|
@ -159,9 +159,16 @@ public class CameraOptions { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//fps range
|
|
|
|
// Preview FPS
|
|
|
|
fpsRangeMinValue = 0F; |
|
|
|
previewFrameRateMinValue = Float.MAX_VALUE; |
|
|
|
fpsRangeMaxValue = 0F; |
|
|
|
previewFrameRateMaxValue = -Float.MAX_VALUE; |
|
|
|
|
|
|
|
List<int[]> fpsRanges = params.getSupportedPreviewFpsRange(); |
|
|
|
|
|
|
|
for (int[] fpsRange : fpsRanges) { |
|
|
|
|
|
|
|
float lower = (float) fpsRange[0] / 1000F; |
|
|
|
|
|
|
|
float upper = (float) fpsRange[1] / 1000F; |
|
|
|
|
|
|
|
previewFrameRateMinValue = Math.min(previewFrameRateMinValue, lower); |
|
|
|
|
|
|
|
previewFrameRateMaxValue = Math.max(previewFrameRateMaxValue, upper); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Camera2Engine constructor.
|
|
|
|
// Camera2Engine constructor.
|
|
|
@ -279,22 +286,19 @@ public class CameraOptions { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//fps Range
|
|
|
|
// Preview FPS
|
|
|
|
fpsRangeMinValue = Float.MAX_VALUE; |
|
|
|
Range<Integer>[] range = cameraCharacteristics.get( |
|
|
|
fpsRangeMaxValue = Float.MIN_VALUE; |
|
|
|
CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES); |
|
|
|
Range<Integer>[] range = cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES); |
|
|
|
|
|
|
|
if (range != null) { |
|
|
|
if (range != null) { |
|
|
|
|
|
|
|
previewFrameRateMinValue = Float.MAX_VALUE; |
|
|
|
|
|
|
|
previewFrameRateMaxValue = -Float.MAX_VALUE; |
|
|
|
for (Range<Integer> fpsRange : range) { |
|
|
|
for (Range<Integer> fpsRange : range) { |
|
|
|
if (fpsRange.getLower() <= fpsRangeMinValue) { |
|
|
|
previewFrameRateMinValue = Math.min(previewFrameRateMinValue, fpsRange.getLower()); |
|
|
|
fpsRangeMinValue = fpsRange.getLower(); |
|
|
|
previewFrameRateMaxValue = Math.max(previewFrameRateMaxValue, fpsRange.getUpper()); |
|
|
|
} |
|
|
|
|
|
|
|
if (fpsRange.getUpper() >= fpsRangeMaxValue) { |
|
|
|
|
|
|
|
fpsRangeMaxValue = fpsRange.getUpper(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
fpsRangeMinValue = 0F; |
|
|
|
previewFrameRateMinValue = 0F; |
|
|
|
fpsRangeMaxValue = 0F; |
|
|
|
previewFrameRateMaxValue = 0F; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -308,7 +312,6 @@ public class CameraOptions { |
|
|
|
return getSupportedControls(control.getClass()).contains(control); |
|
|
|
return getSupportedControls(control.getClass()).contains(control); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Shorthand for other methods in this class, |
|
|
|
* Shorthand for other methods in this class, |
|
|
|
* e.g. supports(GestureAction.ZOOM) == isZoomSupported(). |
|
|
|
* e.g. supports(GestureAction.ZOOM) == isZoomSupported(). |
|
|
@ -333,7 +336,6 @@ public class CameraOptions { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@NonNull |
|
|
|
@NonNull |
|
|
|
public <T extends Control> Collection<T> getSupportedControls(@NonNull Class<T> controlClass) { |
|
|
|
public <T extends Control> Collection<T> getSupportedControls(@NonNull Class<T> controlClass) { |
|
|
@ -362,7 +364,6 @@ public class CameraOptions { |
|
|
|
return Collections.emptyList(); |
|
|
|
return Collections.emptyList(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set of supported picture sizes for the currently opened camera. |
|
|
|
* Set of supported picture sizes for the currently opened camera. |
|
|
|
* |
|
|
|
* |
|
|
@ -373,7 +374,6 @@ public class CameraOptions { |
|
|
|
return Collections.unmodifiableSet(supportedPictureSizes); |
|
|
|
return Collections.unmodifiableSet(supportedPictureSizes); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set of supported picture aspect ratios for the currently opened camera. |
|
|
|
* Set of supported picture aspect ratios for the currently opened camera. |
|
|
|
* |
|
|
|
* |
|
|
@ -385,7 +385,6 @@ public class CameraOptions { |
|
|
|
return Collections.unmodifiableSet(supportedPictureAspectRatio); |
|
|
|
return Collections.unmodifiableSet(supportedPictureAspectRatio); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set of supported video sizes for the currently opened camera. |
|
|
|
* Set of supported video sizes for the currently opened camera. |
|
|
|
* |
|
|
|
* |
|
|
@ -396,7 +395,6 @@ public class CameraOptions { |
|
|
|
return Collections.unmodifiableSet(supportedVideoSizes); |
|
|
|
return Collections.unmodifiableSet(supportedVideoSizes); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set of supported picture aspect ratios for the currently opened camera. |
|
|
|
* Set of supported picture aspect ratios for the currently opened camera. |
|
|
|
* |
|
|
|
* |
|
|
@ -408,7 +406,6 @@ public class CameraOptions { |
|
|
|
return Collections.unmodifiableSet(supportedVideoAspectRatio); |
|
|
|
return Collections.unmodifiableSet(supportedVideoAspectRatio); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set of supported facing values. |
|
|
|
* Set of supported facing values. |
|
|
|
* |
|
|
|
* |
|
|
@ -421,7 +418,6 @@ public class CameraOptions { |
|
|
|
return Collections.unmodifiableSet(supportedFacing); |
|
|
|
return Collections.unmodifiableSet(supportedFacing); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set of supported flash values. |
|
|
|
* Set of supported flash values. |
|
|
|
* |
|
|
|
* |
|
|
@ -436,7 +432,6 @@ public class CameraOptions { |
|
|
|
return Collections.unmodifiableSet(supportedFlash); |
|
|
|
return Collections.unmodifiableSet(supportedFlash); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set of supported white balance values. |
|
|
|
* Set of supported white balance values. |
|
|
|
* |
|
|
|
* |
|
|
@ -452,7 +447,6 @@ public class CameraOptions { |
|
|
|
return Collections.unmodifiableSet(supportedWhiteBalance); |
|
|
|
return Collections.unmodifiableSet(supportedWhiteBalance); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set of supported hdr values. |
|
|
|
* Set of supported hdr values. |
|
|
|
* |
|
|
|
* |
|
|
@ -488,7 +482,6 @@ public class CameraOptions { |
|
|
|
return autoFocusSupported; |
|
|
|
return autoFocusSupported; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Whether exposure correction is supported. If this is false, calling |
|
|
|
* Whether exposure correction is supported. If this is false, calling |
|
|
|
* {@link CameraView#setExposureCorrection(float)} has no effect. |
|
|
|
* {@link CameraView#setExposureCorrection(float)} has no effect. |
|
|
@ -501,7 +494,6 @@ public class CameraOptions { |
|
|
|
return exposureCorrectionSupported; |
|
|
|
return exposureCorrectionSupported; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* The minimum value of negative exposure correction, in EV stops. |
|
|
|
* The minimum value of negative exposure correction, in EV stops. |
|
|
|
* This is presumably negative or 0 if not supported. |
|
|
|
* This is presumably negative or 0 if not supported. |
|
|
@ -524,18 +516,20 @@ public class CameraOptions { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* The minimum value for FPS |
|
|
|
* The minimum value for the preview frame rate, in frames per second (FPS). |
|
|
|
|
|
|
|
* |
|
|
|
* @return the min value |
|
|
|
* @return the min value |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public float getFpsRangeMinValue() { |
|
|
|
public float getPreviewFrameRateMinValue() { |
|
|
|
return fpsRangeMinValue; |
|
|
|
return previewFrameRateMinValue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* The maximum value for FPS |
|
|
|
* The maximum value for the preview frame rate, in frames per second (FPS). |
|
|
|
|
|
|
|
* |
|
|
|
* @return the max value |
|
|
|
* @return the max value |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public float getFpsRangeMaxValue() { |
|
|
|
public float getPreviewFrameRateMaxValue() { |
|
|
|
return fpsRangeMaxValue; |
|
|
|
return previewFrameRateMaxValue; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|