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.

109 lines
4.4 KiB

  1. //
  2. // SCCaptureWorker.h
  3. // Snapchat
  4. //
  5. // Created by Lin Jia on 10/19/17.
  6. //
  7. //
  8. #import "SCCaptureResource.h"
  9. #import <SCFoundation/SCQueuePerformer.h>
  10. #import <Foundation/Foundation.h>
  11. /*
  12. In general, the function of SCCapturer is to use some resources (such as SCManagedCapturerListenerAnnouncer), to do
  13. something (such as announce an event).
  14. SCCaptureWorker abstract away the "do something" part of SCCapturer. It has very little internal states/resources.
  15. SCCaptureWorker is introduced to be shared between CaptureV1 and CaptureV2, to minimize duplication code.
  16. */
  17. @interface SCCaptureWorker : NSObject
  18. + (SCCaptureResource *)generateCaptureResource;
  19. + (void)setupWithCaptureResource:(SCCaptureResource *)captureResource
  20. devicePosition:(SCManagedCaptureDevicePosition)devicePosition;
  21. + (void)setupCapturePreviewLayerController;
  22. + (void)startRunningWithCaptureResource:(SCCaptureResource *)captureResource
  23. token:(SCCapturerToken *)token
  24. completionHandler:(dispatch_block_t)completionHandler;
  25. + (BOOL)stopRunningWithCaptureResource:(SCCaptureResource *)captureResource
  26. token:(SCCapturerToken *)token
  27. completionHandler:(sc_managed_capturer_stop_running_completion_handler_t)completionHandler;
  28. + (void)setupVideoPreviewLayer:(SCCaptureResource *)resource;
  29. + (void)makeVideoPreviewLayer:(SCCaptureResource *)resource;
  30. + (void)redoVideoPreviewLayer:(SCCaptureResource *)resource;
  31. + (void)startStreaming:(SCCaptureResource *)resource;
  32. + (void)setupLivenessConsistencyTimerIfForeground:(SCCaptureResource *)resource;
  33. + (void)destroyLivenessConsistencyTimer:(SCCaptureResource *)resource;
  34. + (void)softwareZoomWithDevice:(SCManagedCaptureDevice *)device resource:(SCCaptureResource *)resource;
  35. + (void)captureStillImageWithCaptureResource:(SCCaptureResource *)captureResource
  36. aspectRatio:(CGFloat)aspectRatio
  37. captureSessionID:(NSString *)captureSessionID
  38. shouldCaptureFromVideo:(BOOL)shouldCaptureFromVideo
  39. completionHandler:
  40. (sc_managed_capturer_capture_still_image_completion_handler_t)completionHandler
  41. context:(NSString *)context;
  42. + (void)startRecordingWithCaptureResource:(SCCaptureResource *)captureResource
  43. outputSettings:(SCManagedVideoCapturerOutputSettings *)outputSettings
  44. audioConfiguration:(SCAudioConfiguration *)configuration
  45. maxDuration:(NSTimeInterval)maxDuration
  46. fileURL:(NSURL *)fileURL
  47. captureSessionID:(NSString *)captureSessionID
  48. completionHandler:(sc_managed_capturer_start_recording_completion_handler_t)completionHandler;
  49. + (void)stopRecordingWithCaptureResource:(SCCaptureResource *)captureResource;
  50. + (void)cancelRecordingWithCaptureResource:(SCCaptureResource *)captureResource;
  51. + (SCVideoCaptureSessionInfo)activeSession:(SCCaptureResource *)resource;
  52. + (BOOL)canRunARSession:(SCCaptureResource *)resource;
  53. + (void)turnARSessionOn:(SCCaptureResource *)resource;
  54. + (void)turnARSessionOff:(SCCaptureResource *)resource;
  55. + (void)clearARKitData:(SCCaptureResource *)resource;
  56. + (void)updateLensesFieldOfViewTracking:(SCCaptureResource *)captureResource;
  57. + (CMTime)firstWrittenAudioBufferDelay:(SCCaptureResource *)resource;
  58. + (BOOL)audioQueueStarted:(SCCaptureResource *)resource;
  59. + (BOOL)isLensApplied:(SCCaptureResource *)resource;
  60. + (BOOL)isVideoMirrored:(SCCaptureResource *)resource;
  61. + (BOOL)shouldCaptureImageFromVideoWithResource:(SCCaptureResource *)resource;
  62. + (void)setPortraitModePointOfInterestAsynchronously:(CGPoint)pointOfInterest
  63. completionHandler:(dispatch_block_t)completionHandler
  64. resource:(SCCaptureResource *)resource;
  65. + (void)prepareForRecordingWithAudioConfiguration:(SCAudioConfiguration *)configuration
  66. resource:(SCCaptureResource *)resource;
  67. + (void)stopScanWithCompletionHandler:(dispatch_block_t)completionHandler resource:(SCCaptureResource *)resource;
  68. + (void)startScanWithScanConfiguration:(SCScanConfiguration *)configuration resource:(SCCaptureResource *)resource;
  69. @end