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 android.annotation.TargetApi; |
14 import android.content.Context; | 14 import android.content.Context; |
15 import android.hardware.camera2.CameraManager; | 15 import android.hardware.camera2.CameraManager; |
| 16 import android.media.MediaRecorder; |
16 | 17 |
17 @TargetApi(21) | 18 @TargetApi(21) |
18 public class Camera2Capturer extends CameraCapturer { | 19 public class Camera2Capturer extends CameraCapturer { |
19 private final Context context; | 20 private final Context context; |
20 private final CameraManager cameraManager; | 21 private final CameraManager cameraManager; |
21 | 22 |
22 public Camera2Capturer(Context context, String cameraName, CameraEventsHandler
eventsHandler) { | 23 public Camera2Capturer(Context context, String cameraName, CameraEventsHandler
eventsHandler) { |
23 super(cameraName, eventsHandler, new Camera2Enumerator(context)); | 24 super(cameraName, eventsHandler, new Camera2Enumerator(context)); |
24 | 25 |
25 this.context = context; | 26 this.context = context; |
26 cameraManager = (CameraManager) context.getSystemService(Context.CAMERA_SERV
ICE); | 27 cameraManager = (CameraManager) context.getSystemService(Context.CAMERA_SERV
ICE); |
27 } | 28 } |
28 | 29 |
29 @Override | 30 @Override |
30 protected void createCameraSession(CameraSession.CreateSessionCallback createS
essionCallback, | 31 protected void createCameraSession(CameraSession.CreateSessionCallback createS
essionCallback, |
31 CameraSession.Events events, Context applicationContext, | 32 CameraSession.Events events, Context applicationContext, |
32 SurfaceTextureHelper surfaceTextureHelper, String cameraName, int width, i
nt height, | 33 SurfaceTextureHelper surfaceTextureHelper, MediaRecorder mediaRecoder, Str
ing cameraName, |
33 int framerate) { | 34 int width, int height, int framerate) { |
34 Camera2Session.create(createSessionCallback, events, applicationContext, cam
eraManager, | 35 Camera2Session.create(createSessionCallback, events, applicationContext, cam
eraManager, |
35 surfaceTextureHelper, cameraName, width, height, framerate); | 36 surfaceTextureHelper, mediaRecoder, cameraName, width, height, framerate
); |
36 } | 37 } |
37 } | 38 } |
OLD | NEW |