OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 package org.webrtc; | 11 package org.webrtc; |
12 | 12 |
13 import android.annotation.TargetApi; | 13 import org.webrtc.CameraEnumerationAndroid.CaptureFormat; |
| 14 |
14 import android.content.Context; | 15 import android.content.Context; |
15 import android.hardware.camera2.CameraManager; | |
16 | 16 |
17 @TargetApi(21) | 17 import java.util.List; |
18 public class Camera2Capturer extends CameraCapturer { | |
19 private final Context context; | |
20 private final CameraManager cameraManager; | |
21 | 18 |
22 public Camera2Capturer(Context context, String cameraName, CameraEventsHandler
eventsHandler) { | 19 public class Camera1Capturer extends CameraCapturer { |
23 super(cameraName, eventsHandler, new Camera2Enumerator(context)); | 20 private final boolean captureToTexture; |
24 | 21 |
25 this.context = context; | 22 public Camera1Capturer(String cameraName, CameraEventsHandler eventsHandler, |
26 cameraManager = (CameraManager) context.getSystemService(Context.CAMERA_SERV
ICE); | 23 boolean captureToTexture) { |
| 24 super(cameraName, eventsHandler, new Camera1Enumerator(captureToTexture)); |
| 25 |
| 26 this.captureToTexture = captureToTexture; |
27 } | 27 } |
28 | 28 |
29 @Override | 29 @Override |
30 protected void createCameraSession( | 30 protected void createCameraSession( |
31 CameraSession.CreateSessionCallback createSessionCallback, CameraSession.E
vents events, | 31 CameraSession.CreateSessionCallback createSessionCallback, CameraSession.E
vents events, |
32 Context applicationContext, SurfaceTextureHelper surfaceTextureHelper, | 32 Context applicationContext, SurfaceTextureHelper surfaceTextureHelper, |
33 String cameraName, int width, int height, int framerate) { | 33 String cameraName, int width, int height, int framerate) { |
34 Camera2Session.create( | 34 Camera1Session.create( |
35 createSessionCallback, events, | 35 createSessionCallback, events, captureToTexture, applicationContext, surfa
ceTextureHelper, |
36 applicationContext, cameraManager, | 36 Camera1Enumerator.getCameraIndex(cameraName), width, height, framerate); |
37 surfaceTextureHelper, | |
38 cameraName, width, height, framerate); | |
39 } | 37 } |
40 } | 38 } |
OLD | NEW |