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.effects
17 
18 import androidx.camera.core.CameraEffect
19 import kotlinx.coroutines.CoroutineScope
20 
21 private const val TARGETS =
22     CameraEffect.PREVIEW or CameraEffect.VIDEO_CAPTURE
23 
24 /**
25  * [CameraEffect] that applies a no-op effect.
26  *
27  * Essentially copying the camera input to the targets,
28  * Preview, VideoCapture and ImageCapture.
29  *
30  * Used as a workaround to force the above 3 use cases to use a single camera stream.
31  */
32 class SingleSurfaceForcingEffect(coroutineScope: CoroutineScope) : CameraEffect(
33     TARGETS,
34     Runnable::run,
35     CopyingSurfaceProcessor(coroutineScope),
<lambda>null36     {}
37 )
38