Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,8 @@ class Camera2Source(context: Context): VideoSource() {
size?.let { checkResolutionSupported(it.width, it.height) }
camera.setRequiredResolution(size)
}

fun lockExposure(enabled: Boolean) = camera.lockExposure(enabled)

fun isLockExposureEnabled() = camera.isLockExposureEnabled()
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class Camera2ApiManager(context: Context) : CameraDevice.StateCallback() {
private set
var isAutoWhiteBalanceEnabled: Boolean = true
private set
var lockExposureEnabled: Boolean = false
private set
var isRunning: Boolean = false
private set
private var fps = 30
Expand Down Expand Up @@ -315,6 +317,17 @@ class Camera2ApiManager(context: Context) : CameraDevice.StateCallback() {
}
}

fun lockExposure(enabled: Boolean): Boolean {
val builderInputSurface = this.builderInputSurface ?: return false
builderInputSurface.set(CaptureRequest.CONTROL_AE_LOCK, enabled)
if (applyRequest(builderInputSurface)) {
lockExposureEnabled = enabled
return true
} else return false
}

fun isLockExposureEnabled() = lockExposureEnabled

/**
* @param mode value from CameraCharacteristics.CONTROL_AWB_MODE_*
*/
Expand Down