denicija | 71caaca | 2016-11-23 00:41:57 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 11 | #import <AVFoundation/AVFoundation.h> |
| 12 | #import <Foundation/Foundation.h> |
| 13 | |
| 14 | #ifdef __cplusplus |
| 15 | #include "avfoundationvideocapturer.h" |
| 16 | #endif |
| 17 | |
| 18 | NS_ASSUME_NONNULL_BEGIN |
| 19 | // This class is an implementation detail of AVFoundationVideoCapturer and handles |
| 20 | // the ObjC integration with the AVFoundation APIs. |
| 21 | // It is meant to be owned by an instance of AVFoundationVideoCapturer. |
| 22 | // The reason for this is because other webrtc objects own cricket::VideoCapturer, which is not |
| 23 | // ref counted. To prevent bad behavior we do not expose this class directly. |
| 24 | @interface RTCAVFoundationVideoCapturerInternal |
| 25 | : NSObject <AVCaptureVideoDataOutputSampleBufferDelegate> |
| 26 | |
| 27 | @property(nonatomic, readonly) AVCaptureSession *captureSession; |
| 28 | @property(nonatomic, readonly) dispatch_queue_t frameQueue; |
| 29 | @property(nonatomic, readonly) BOOL canUseBackCamera; |
| 30 | @property(nonatomic, assign) BOOL useBackCamera; // Defaults to NO. |
| 31 | @property(atomic, assign) BOOL isRunning; // Whether the capture session is running. |
| 32 | @property(atomic, assign) BOOL hasStarted; // Whether we have an unmatched start. |
| 33 | |
| 34 | // We keep a pointer back to AVFoundationVideoCapturer to make callbacks on it |
| 35 | // when we receive frames. This is safe because this object should be owned by |
| 36 | // it. |
| 37 | - (instancetype)initWithCapturer:(webrtc::AVFoundationVideoCapturer *)capturer; |
| 38 | - (AVCaptureDevice *)getActiveCaptureDevice; |
| 39 | |
| 40 | - (nullable AVCaptureDevice *)frontCaptureDevice; |
| 41 | - (nullable AVCaptureDevice *)backCaptureDevice; |
| 42 | |
| 43 | // Starts and stops the capture session asynchronously. We cannot do this |
| 44 | // synchronously without blocking a WebRTC thread. |
| 45 | - (void)start; |
| 46 | - (void)stop; |
| 47 | |
| 48 | @end |
| 49 | NS_ASSUME_NONNULL_END |