Skip to content

Commit

Permalink
Use CameraX's official APIs for EIS
Browse files Browse the repository at this point in the history
(over existing Camera2Interop API implementation)
  • Loading branch information
MHShetty authored and thestinger committed Jul 19, 2024
1 parent be3d7d0 commit 92d262a
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions app/src/main/java/app/grapheneos/camera/CamConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,8 @@ class CamConfig(private val mActivity: MainActivity) {
.build()
)

videoCaptureBuilder.setVideoStabilizationEnabled(mActivity.camConfig.enableEIS)

if (mActivity.camConfig.saveVideoAsPreviewed)
videoCaptureBuilder.setMirrorMode(MirrorMode.MIRROR_MODE_ON_FRONT_ONLY)

Expand Down Expand Up @@ -1131,17 +1133,8 @@ class CamConfig(private val mActivity: MainActivity) {
ResolutionSelector.Builder().setAspectRatioStrategy(aspectRatioStrategy).build()
)

@androidx.camera.camera2.interop.ExperimentalCamera2Interop
if (isVideoMode && enableEIS) {
Camera2Interop.Extender(previewBuilder).setCaptureRequestOption(
CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE,
CameraMetadata.CONTROL_VIDEO_STABILIZATION_MODE_ON
)
} else {
Camera2Interop.Extender(previewBuilder).setCaptureRequestOption(
CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE,
CameraMetadata.CONTROL_VIDEO_STABILIZATION_MODE_OFF
)
if (isVideoMode) {
previewBuilder.setPreviewStabilizationEnabled(enableEIS)
}

preview = previewBuilder.build().also {
Expand Down

0 comments on commit 92d262a

Please sign in to comment.