1*d9f75844SAndroid Build Coastguard Worker /* 2*d9f75844SAndroid Build Coastguard Worker * Copyright 2017 The WebRTC project authors. All Rights Reserved. 3*d9f75844SAndroid Build Coastguard Worker * 4*d9f75844SAndroid Build Coastguard Worker * Use of this source code is governed by a BSD-style license 5*d9f75844SAndroid Build Coastguard Worker * that can be found in the LICENSE file in the root of the source 6*d9f75844SAndroid Build Coastguard Worker * tree. An additional intellectual property rights grant can be found 7*d9f75844SAndroid Build Coastguard Worker * in the file PATENTS. All contributing project authors may 8*d9f75844SAndroid Build Coastguard Worker * be found in the AUTHORS file in the root of the source tree. 9*d9f75844SAndroid Build Coastguard Worker */ 10*d9f75844SAndroid Build Coastguard Worker 11*d9f75844SAndroid Build Coastguard Worker #import <AVFoundation/AVFoundation.h> 12*d9f75844SAndroid Build Coastguard Worker #import <Foundation/Foundation.h> 13*d9f75844SAndroid Build Coastguard Worker 14*d9f75844SAndroid Build Coastguard Worker #import "RTCMacros.h" 15*d9f75844SAndroid Build Coastguard Worker #import "RTCVideoCapturer.h" 16*d9f75844SAndroid Build Coastguard Worker 17*d9f75844SAndroid Build Coastguard Worker NS_ASSUME_NONNULL_BEGIN 18*d9f75844SAndroid Build Coastguard Worker 19*d9f75844SAndroid Build Coastguard Worker RTC_OBJC_EXPORT 20*d9f75844SAndroid Build Coastguard Worker // Camera capture that implements RTCVideoCapturer. Delivers frames to a 21*d9f75844SAndroid Build Coastguard Worker // RTCVideoCapturerDelegate (usually RTCVideoSource). 22*d9f75844SAndroid Build Coastguard Worker NS_EXTENSION_UNAVAILABLE_IOS("Camera not available in app extensions.") 23*d9f75844SAndroid Build Coastguard Worker @interface RTC_OBJC_TYPE (RTCCameraVideoCapturer) : RTC_OBJC_TYPE(RTCVideoCapturer) 24*d9f75844SAndroid Build Coastguard Worker 25*d9f75844SAndroid Build Coastguard Worker // Capture session that is used for capturing. Valid from initialization to dealloc. 26*d9f75844SAndroid Build Coastguard Worker @property(readonly, nonatomic) AVCaptureSession *captureSession; 27*d9f75844SAndroid Build Coastguard Worker 28*d9f75844SAndroid Build Coastguard Worker // Returns list of available capture devices that support video capture. 29*d9f75844SAndroid Build Coastguard Worker + (NSArray<AVCaptureDevice *> *)captureDevices; 30*d9f75844SAndroid Build Coastguard Worker // Returns list of formats that are supported by this class for this device. 31*d9f75844SAndroid Build Coastguard Worker + (NSArray<AVCaptureDeviceFormat *> *)supportedFormatsForDevice:(AVCaptureDevice *)device; 32*d9f75844SAndroid Build Coastguard Worker 33*d9f75844SAndroid Build Coastguard Worker // Returns the most efficient supported output pixel format for this capturer. 34*d9f75844SAndroid Build Coastguard Worker - (FourCharCode)preferredOutputPixelFormat; 35*d9f75844SAndroid Build Coastguard Worker 36*d9f75844SAndroid Build Coastguard Worker // Starts the capture session asynchronously and notifies callback on completion. 37*d9f75844SAndroid Build Coastguard Worker // The device will capture video in the format given in the `format` parameter. If the pixel format 38*d9f75844SAndroid Build Coastguard Worker // in `format` is supported by the WebRTC pipeline, the same pixel format will be used for the 39*d9f75844SAndroid Build Coastguard Worker // output. Otherwise, the format returned by `preferredOutputPixelFormat` will be used. 40*d9f75844SAndroid Build Coastguard Worker - (void)startCaptureWithDevice:(AVCaptureDevice *)device 41*d9f75844SAndroid Build Coastguard Worker format:(AVCaptureDeviceFormat *)format 42*d9f75844SAndroid Build Coastguard Worker fps:(NSInteger)fps 43*d9f75844SAndroid Build Coastguard Worker completionHandler:(nullable void (^)(NSError *_Nullable))completionHandler; 44*d9f75844SAndroid Build Coastguard Worker // Stops the capture session asynchronously and notifies callback on completion. 45*d9f75844SAndroid Build Coastguard Worker - (void)stopCaptureWithCompletionHandler:(nullable void (^)(void))completionHandler; 46*d9f75844SAndroid Build Coastguard Worker 47*d9f75844SAndroid Build Coastguard Worker // Starts the capture session asynchronously. 48*d9f75844SAndroid Build Coastguard Worker - (void)startCaptureWithDevice:(AVCaptureDevice *)device 49*d9f75844SAndroid Build Coastguard Worker format:(AVCaptureDeviceFormat *)format 50*d9f75844SAndroid Build Coastguard Worker fps:(NSInteger)fps; 51*d9f75844SAndroid Build Coastguard Worker // Stops the capture session asynchronously. 52*d9f75844SAndroid Build Coastguard Worker - (void)stopCapture; 53*d9f75844SAndroid Build Coastguard Worker 54*d9f75844SAndroid Build Coastguard Worker @end 55*d9f75844SAndroid Build Coastguard Worker 56*d9f75844SAndroid Build Coastguard Worker NS_ASSUME_NONNULL_END 57