1 /* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.google.jetpackcamera.core.camera 17 18 import androidx.camera.core.CameraInfo 19 import com.google.jetpackcamera.settings.model.AspectRatio 20 import com.google.jetpackcamera.settings.model.CaptureMode 21 import com.google.jetpackcamera.settings.model.DeviceRotation 22 import com.google.jetpackcamera.settings.model.DynamicRange 23 import com.google.jetpackcamera.settings.model.FlashMode 24 import com.google.jetpackcamera.settings.model.ImageOutputFormat 25 import com.google.jetpackcamera.settings.model.Stabilization 26 27 /** 28 * Camera settings that persist as long as a camera is running. 29 * 30 * Any change in these settings will require calling [ProcessCameraProvider.runWith] with 31 * updates [CameraSelector] and/or [UseCaseGroup] 32 */ 33 internal sealed interface PerpetualSessionSettings { 34 val aspectRatio: AspectRatio 35 36 data class SingleCamera( 37 val cameraInfo: CameraInfo, 38 override val aspectRatio: AspectRatio, 39 val captureMode: CaptureMode, 40 val targetFrameRate: Int, 41 val stabilizePreviewMode: Stabilization, 42 val stabilizeVideoMode: Stabilization, 43 val dynamicRange: DynamicRange, 44 val imageFormat: ImageOutputFormat 45 ) : PerpetualSessionSettings 46 47 data class ConcurrentCamera( 48 val primaryCameraInfo: CameraInfo, 49 val secondaryCameraInfo: CameraInfo, 50 override val aspectRatio: AspectRatio 51 ) : PerpetualSessionSettings 52 } 53 54 /** 55 * Camera settings that can change while the camera is running. 56 * 57 * Any changes in these settings can be applied either directly to use cases via their 58 * setter methods or to [androidx.camera.core.CameraControl]. 59 * The use cases typically will not need to be re-bound. 60 */ 61 internal data class TransientSessionSettings( 62 val audioMuted: Boolean, 63 val deviceRotation: DeviceRotation, 64 val flashMode: FlashMode, 65 val zoomScale: Float 66 ) 67