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.

76 lines
3.1 KiB

  1. //
  2. // SCCaptureStateMachineContext.h
  3. // Snapchat
  4. //
  5. // Created by Lin Jia on 10/18/17.
  6. //
  7. //
  8. #import "SCCaptureCommon.h"
  9. #import "SCManagedCaptureDevice.h"
  10. #import <SCAudio/SCAudioConfiguration.h>
  11. #import <Foundation/Foundation.h>
  12. /*
  13. SCCaptureStateMachineContext is the central piece that glues all states together.
  14. It will pass API calls to the current state.
  15. The classic state machine design pattern:
  16. https://en.wikipedia.org/wiki/State_pattern
  17. It is also the delegate for the states it manages, so that those states can tell stateMachineContext to transit to next
  18. state.
  19. */
  20. @class SCCaptureResource;
  21. @class SCCapturerToken;
  22. @interface SCCaptureStateMachineContext : NSObject
  23. - (instancetype)initWithResource:(SCCaptureResource *)resource;
  24. - (void)initializeCaptureWithDevicePositionAsynchronously:(SCManagedCaptureDevicePosition)devicePosition
  25. completionHandler:(dispatch_block_t)completionHandler
  26. context:(NSString *)context;
  27. - (SCCapturerToken *)startRunningWithContext:(NSString *)context completionHandler:(dispatch_block_t)completionHandler;
  28. - (void)stopRunningWithCapturerToken:(SCCapturerToken *)token
  29. completionHandler:(sc_managed_capturer_stop_running_completion_handler_t)completionHandler
  30. context:(NSString *)context;
  31. - (void)stopRunningWithCapturerToken:(SCCapturerToken *)token
  32. after:(NSTimeInterval)delay
  33. completionHandler:(sc_managed_capturer_stop_running_completion_handler_t)completionHandler
  34. context:(NSString *)context;
  35. - (void)prepareForRecordingAsynchronouslyWithAudioConfiguration:(SCAudioConfiguration *)configuration
  36. context:(NSString *)context;
  37. - (void)startRecordingWithOutputSettings:(SCManagedVideoCapturerOutputSettings *)outputSettings
  38. audioConfiguration:(SCAudioConfiguration *)configuration
  39. maxDuration:(NSTimeInterval)maxDuration
  40. fileURL:(NSURL *)fileURL
  41. captureSessionID:(NSString *)captureSessionID
  42. completionHandler:(sc_managed_capturer_start_recording_completion_handler_t)completionHandler
  43. context:(NSString *)context;
  44. - (void)stopRecordingWithContext:(NSString *)context;
  45. - (void)cancelRecordingWithContext:(NSString *)context;
  46. - (void)captureStillImageAsynchronouslyWithAspectRatio:(CGFloat)aspectRatio
  47. captureSessionID:(NSString *)captureSessionID
  48. completionHandler:
  49. (sc_managed_capturer_capture_still_image_completion_handler_t)completionHandler
  50. context:(NSString *)context;
  51. #pragma mark - Scanning
  52. - (void)startScanAsynchronouslyWithScanConfiguration:(SCScanConfiguration *)configuration context:(NSString *)context;
  53. - (void)stopScanAsynchronouslyWithCompletionHandler:(dispatch_block_t)completionHandler context:(NSString *)context;
  54. @end