diff --git a/package/android/src/main/java/com/mrousavy/camera/core/CameraSession.kt b/package/android/src/main/java/com/mrousavy/camera/core/CameraSession.kt index 02488f4..92c65a0 100644 --- a/package/android/src/main/java/com/mrousavy/camera/core/CameraSession.kt +++ b/package/android/src/main/java/com/mrousavy/camera/core/CameraSession.kt @@ -466,6 +466,7 @@ class CameraSession(private val context: Context, private val cameraManager: Cam val cameraCharacteristics = cameraManager.getCameraCharacteristics(captureSession.device.id) val orientation = outputOrientation.toSensorRelativeOrientation(cameraCharacteristics) + val enableHdr = configuration?.photoHdr ?: false val captureRequest = captureSession.device.createPhotoCaptureRequest( cameraManager, photoOutput.surface, @@ -474,6 +475,7 @@ class CameraSession(private val context: Context, private val cameraManager: Cam flashMode, enableRedEyeReduction, enableAutoStabilization, + enableHdr, orientation ) Log.i(TAG, "Photo capture 1/3 - starting capture...") diff --git a/package/android/src/main/java/com/mrousavy/camera/extensions/CameraDevice+createPhotoCaptureRequest.kt b/package/android/src/main/java/com/mrousavy/camera/extensions/CameraDevice+createPhotoCaptureRequest.kt index 486707f..0c425a8 100644 --- a/package/android/src/main/java/com/mrousavy/camera/extensions/CameraDevice+createPhotoCaptureRequest.kt +++ b/package/android/src/main/java/com/mrousavy/camera/extensions/CameraDevice+createPhotoCaptureRequest.kt @@ -30,6 +30,7 @@ fun CameraDevice.createPhotoCaptureRequest( flashMode: Flash, enableRedEyeReduction: Boolean, enableAutoStabilization: Boolean, + enableHdr: Boolean, orientation: Orientation ): CaptureRequest { val cameraCharacteristics = cameraManager.getCameraCharacteristics(this.id) @@ -40,6 +41,7 @@ fun CameraDevice.createPhotoCaptureRequest( CameraDevice.TEMPLATE_STILL_CAPTURE } val captureRequest = this.createCaptureRequest(template) + captureRequest.addTarget(surface) // TODO: Maybe we can even expose that prop directly? val jpegQuality = when (qualityPrioritization) { @@ -51,6 +53,8 @@ fun CameraDevice.createPhotoCaptureRequest( captureRequest.set(CaptureRequest.JPEG_ORIENTATION, orientation.toDegrees()) + // TODO: Use the same options as from the preview request. This is duplicate code! + when (flashMode) { // Set the Flash Mode Flash.OFF -> { @@ -87,9 +91,14 @@ fun CameraDevice.createPhotoCaptureRequest( } } + // TODO: Check if that zoom value is even supported. captureRequest.setZoom(zoom, cameraCharacteristics) - captureRequest.addTarget(surface) + // Set HDR + // TODO: Check if that value is even supported + if (enableHdr) { + captureRequest.set(CaptureRequest.CONTROL_SCENE_MODE, CaptureRequest.CONTROL_SCENE_MODE_HDR) + } return captureRequest.build() }