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