RTCCameraVideoCapturer.h 2.5 KB

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