|
| 1 | +/* |
| 2 | + * Copyright 2017 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 | +#import <WebRTC/RTCMacros.h> |
| 15 | +#import <WebRTC/RTCVideoCapturer.h> |
| 16 | + |
| 17 | +NS_ASSUME_NONNULL_BEGIN |
| 18 | + |
| 19 | +RTC_OBJC_EXPORT |
| 20 | +// Camera capture that implements RTCVideoCapturer. Delivers frames to a |
| 21 | +// RTCVideoCapturerDelegate (usually RTCVideoSource). |
| 22 | +NS_EXTENSION_UNAVAILABLE_IOS("Camera not available in app extensions.") |
| 23 | +@interface RTC_OBJC_TYPE (RTCCameraVideoCapturer) : RTC_OBJC_TYPE(RTCVideoCapturer) |
| 24 | + |
| 25 | +// Capture session that is used for capturing. Valid from initialization to dealloc. |
| 26 | +@property(readonly, nonatomic) AVCaptureSession *captureSession; |
| 27 | + |
| 28 | +// Returns list of available capture devices that support video capture. |
| 29 | ++ (NSArray<AVCaptureDevice *> *)captureDevices; |
| 30 | +// Returns list of formats that are supported by this class for this device. |
| 31 | ++ (NSArray<AVCaptureDeviceFormat *> *)supportedFormatsForDevice:(AVCaptureDevice *)device; |
| 32 | + |
| 33 | +// Returns the most efficient supported output pixel format for this capturer. |
| 34 | +- (FourCharCode)preferredOutputPixelFormat; |
| 35 | + |
| 36 | +// Starts the capture session asynchronously and notifies callback on completion. |
| 37 | +// The device will capture video in the format given in the `format` parameter. If the pixel format |
| 38 | +// in `format` is supported by the WebRTC pipeline, the same pixel format will be used for the |
| 39 | +// output. Otherwise, the format returned by `preferredOutputPixelFormat` will be used. |
| 40 | +- (void)startCaptureWithDevice:(AVCaptureDevice *)device |
| 41 | + format:(AVCaptureDeviceFormat *)format |
| 42 | + fps:(NSInteger)fps |
| 43 | + completionHandler:(nullable void (^)(NSError *_Nullable))completionHandler; |
| 44 | +// Stops the capture session asynchronously and notifies callback on completion. |
| 45 | +- (void)stopCaptureWithCompletionHandler:(nullable void (^)(void))completionHandler; |
| 46 | + |
| 47 | +// Starts the capture session asynchronously. |
| 48 | +- (void)startCaptureWithDevice:(AVCaptureDevice *)device |
| 49 | + format:(AVCaptureDeviceFormat *)format |
| 50 | + fps:(NSInteger)fps; |
| 51 | +// Stops the capture session asynchronously. |
| 52 | +- (void)stopCapture; |
| 53 | + |
| 54 | +@end |
| 55 | + |
| 56 | +NS_ASSUME_NONNULL_END |
0 commit comments