blob: 27b2df74740a97d761b002ce9a8cfb7112660e55 [file] [log] [blame]
sakal34425792016-09-21 01:34:56 -07001/*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 *
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
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
11package org.webrtc;
12
sakal34425792016-09-21 01:34:56 -070013import android.content.Context;
glaznev37adc5e2017-04-27 13:38:29 -070014import android.media.MediaRecorder;
Sami Kalliomäkie7592d82018-03-22 13:32:44 +010015import javax.annotation.Nullable;
sakal34425792016-09-21 01:34:56 -070016
17public class Camera1Capturer extends CameraCapturer {
18 private final boolean captureToTexture;
19
sakalb6760f92016-09-29 04:12:44 -070020 public Camera1Capturer(
21 String cameraName, CameraEventsHandler eventsHandler, boolean captureToTexture) {
sakal34425792016-09-21 01:34:56 -070022 super(cameraName, eventsHandler, new Camera1Enumerator(captureToTexture));
23
24 this.captureToTexture = captureToTexture;
25 }
26
27 @Override
sakalb6760f92016-09-29 04:12:44 -070028 protected void createCameraSession(CameraSession.CreateSessionCallback createSessionCallback,
29 CameraSession.Events events, Context applicationContext,
Sami Kalliomäkie7592d82018-03-22 13:32:44 +010030 SurfaceTextureHelper surfaceTextureHelper, @Nullable MediaRecorder mediaRecorder,
31 String cameraName, int width, int height, int framerate) {
sakalbac4c802017-05-05 01:48:48 -070032 Camera1Session.create(createSessionCallback, events,
33 captureToTexture || (mediaRecorder != null), applicationContext, surfaceTextureHelper,
34 mediaRecorder, Camera1Enumerator.getCameraIndex(cameraName), width, height, framerate);
sakal34425792016-09-21 01:34:56 -070035 }
36}