mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 22:45:18 +01:00
feat: add cam2api autofocus
This commit is contained in:
parent
cb6ef11cdd
commit
7ac553ce9d
1 changed files with 13 additions and 0 deletions
|
@ -481,6 +481,7 @@ public class Camera2Session {
|
||||||
captureRequestBuilder.set(CaptureRequest.CONTROL_CAPTURE_INTENT, CaptureRequest.CONTROL_CAPTURE_INTENT_VIDEO_RECORD);
|
captureRequestBuilder.set(CaptureRequest.CONTROL_CAPTURE_INTENT, CaptureRequest.CONTROL_CAPTURE_INTENT_VIDEO_RECORD);
|
||||||
|
|
||||||
isStabilizationAvailable(builder);
|
isStabilizationAvailable(builder);
|
||||||
|
isAutoFocusAvailable(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sensorSize != null && Math.abs(currentZoom - 1f) >= 0.01f) {
|
if (sensorSize != null && Math.abs(currentZoom - 1f) >= 0.01f) {
|
||||||
|
@ -528,6 +529,18 @@ public class Camera2Session {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void isAutoFocusAvailable(CaptureRequest.Builder builder) {
|
||||||
|
if (setModeIfAvailable(
|
||||||
|
builder,
|
||||||
|
CameraCharacteristics.CONTROL_AF_AVAILABLE_MODES,
|
||||||
|
CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_VIDEO,
|
||||||
|
CaptureRequest.CONTROL_AF_MODE)) {
|
||||||
|
FileLog.d("Camera2Sessions use continuous AF");
|
||||||
|
} else {
|
||||||
|
FileLog.d("Camera2Sessions AF is not available");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean setModeIfAvailable(
|
private boolean setModeIfAvailable(
|
||||||
CameraCharacteristics.Key<int[]> key, int desiredMode,
|
CameraCharacteristics.Key<int[]> key, int desiredMode,
|
||||||
CaptureRequest.Builder builder, CaptureRequest.Key<Integer> requestKey) {
|
CaptureRequest.Builder builder, CaptureRequest.Key<Integer> requestKey) {
|
||||||
|
|
Loading…
Reference in a new issue