| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 |
| 11 | package org.webrtc; |
| 12 |
| 13 | import android.annotation.TargetApi; |
| 14 | import android.content.Context; |
| 15 | import android.hardware.camera2.CameraManager; |
| 16 | import androidx.annotation.Nullable; |
| 17 |
| 18 | @TargetApi(21) |
| 19 | public class Camera2Capturer extends CameraCapturer { |
| 20 | private final Context context; |
| 21 | @Nullable private final CameraManager cameraManager; |
| 22 |
| 23 | public Camera2Capturer(Context context, String cameraName, CameraEventsHandler eventsHandler) { |
| 24 | super(cameraName, eventsHandler, new Camera2Enumerator(context)); |
| 25 |
| 26 | this.context = context; |
| 27 | cameraManager = (CameraManager) context.getSystemService(Context.CAMERA_SERVICE); |
| 28 | } |
| 29 |
| 30 | @Override |
| 31 | protected void createCameraSession(CameraSession.CreateSessionCallback createSessionCallback, |
| 32 | CameraSession.Events events, Context applicationContext, |
| 33 | SurfaceTextureHelper surfaceTextureHelper, String cameraName, int width, int height, |
| 34 | int framerate) { |
| 35 | Camera2Session.create(createSessionCallback, events, applicationContext, cameraManager, |
| 36 | surfaceTextureHelper, cameraName, width, height, framerate); |
| 37 | } |
| 38 | } |
| 39 |