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 org.webrtc.CameraEnumerationAndroid.CaptureFormat; | |
14 | |
15 import android.annotation.TargetApi; | 13 import android.annotation.TargetApi; |
16 import android.content.Context; | 14 import android.content.Context; |
17 import android.hardware.camera2.CameraManager; | 15 import android.hardware.camera2.CameraManager; |
18 import android.os.Handler; | |
19 | |
20 import java.util.List; | |
21 | 16 |
22 @TargetApi(21) | 17 @TargetApi(21) |
23 public class Camera2Capturer extends CameraCapturer { | 18 public class Camera2Capturer extends CameraCapturer { |
24 private final Context context; | 19 private final Context context; |
25 private final CameraManager cameraManager; | 20 private final CameraManager cameraManager; |
26 | 21 |
27 public Camera2Capturer(Context context, String cameraName, CameraEventsHandler
eventsHandler) { | 22 public Camera2Capturer(Context context, String cameraName, CameraEventsHandler
eventsHandler) { |
28 super(cameraName, eventsHandler, new Camera2Enumerator(context)); | 23 super(cameraName, eventsHandler, new Camera2Enumerator(context)); |
29 | 24 |
30 this.context = context; | 25 this.context = context; |
31 cameraManager = (CameraManager) context.getSystemService(Context.CAMERA_SERV
ICE); | 26 cameraManager = (CameraManager) context.getSystemService(Context.CAMERA_SERV
ICE); |
32 } | 27 } |
33 | 28 |
34 @Override | 29 @Override |
35 protected void createCameraSession( | 30 protected void createCameraSession( |
36 CameraSession.CreateSessionCallback createSessionCallback, | 31 CameraSession.CreateSessionCallback createSessionCallback, CameraSession.E
vents events, |
37 CameraEventsHandler eventsHandler, Context applicationContext, | 32 Context applicationContext, SurfaceTextureHelper surfaceTextureHelper, |
38 CameraVideoCapturer.CapturerObserver capturerObserver, | |
39 SurfaceTextureHelper surfaceTextureHelper, | |
40 String cameraName, int width, int height, int framerate) { | 33 String cameraName, int width, int height, int framerate) { |
41 Camera2Session.create( | 34 Camera2Session.create( |
42 cameraManager, | 35 createSessionCallback, events, |
43 createSessionCallback, | 36 applicationContext, cameraManager, |
44 eventsHandler, applicationContext, | 37 surfaceTextureHelper, |
45 capturerObserver, | 38 cameraName, width, height, framerate); |
46 surfaceTextureHelper, | |
47 cameraName, width, height, framerate); | |
48 } | 39 } |
49 } | 40 } |
OLD | NEW |