2014 snapchat source code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.0 KiB

  1. //
  2. // SCManagedCaptureSession.h
  3. // Snapchat
  4. //
  5. // Created by Derek Wang on 02/03/2018.
  6. //
  7. #import <SCBase/SCMacros.h>
  8. #import <AVFoundation/AVFoundation.h>
  9. #import <Foundation/Foundation.h>
  10. /**
  11. `SCManagedCaptureSession` is a wrapper class of `AVCaptureSession`. The purpose of this class is to provide additional
  12. functionalities to `AVCaptureSession`.
  13. For example, for black camera detection, we need to monitor when some method is called. Another example is that we can
  14. treat it as a more stable version of `AVCaptureSession` by moving some `AVCaptureSession` fixing logic to this class,
  15. and it provides reliable interfaces to the outside. That would be the next step.
  16. It also tries to mimic the `AVCaptureSession` by implmenting some methods in `AVCaptureSession`. The original methods
  17. in `AVCaptureSession` should not be used anymore
  18. */
  19. @class SCBlackCameraDetector;
  20. NS_ASSUME_NONNULL_BEGIN
  21. @interface SCManagedCaptureSession : NSObject
  22. /**
  23. Expose avSession property
  24. */
  25. @property (nonatomic, strong, readonly) AVCaptureSession *avSession;
  26. /**
  27. Expose avSession isRunning property for convenience.
  28. */
  29. @property (nonatomic, readonly, assign) BOOL isRunning;
  30. /**
  31. Wrap [AVCaptureSession startRunning] method. Monitor startRunning method. [AVCaptureSession startRunning] should not be
  32. called
  33. */
  34. - (void)startRunning;
  35. /**
  36. Wrap [AVCaptureSession stopRunning] method. Monitor stopRunning method. [AVCaptureSession stopRunning] should not be
  37. called
  38. */
  39. - (void)stopRunning;
  40. /**
  41. Wrap [AVCaptureSession beginConfiguration]. Monitor beginConfiguration method
  42. */
  43. - (void)beginConfiguration;
  44. /**
  45. Wrap [AVCaptureSession commitConfiguration]. Monitor commitConfiguration method
  46. */
  47. - (void)commitConfiguration;
  48. /**
  49. Configurate internal AVCaptureSession with block
  50. @params block. configuration block with AVCaptureSession as parameter
  51. */
  52. - (void)performConfiguration:(void (^)(void))block;
  53. - (instancetype)initWithBlackCameraDetector:(SCBlackCameraDetector *)detector NS_DESIGNATED_INITIALIZER;
  54. SC_INIT_AND_NEW_UNAVAILABLE
  55. @end
  56. NS_ASSUME_NONNULL_END