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.

135 lines
5.8 KiB

  1. //#!announcer.rb
  2. //
  3. // SCManagedCaptuerListener
  4. // Snapchat
  5. //
  6. // Created by Liu Liu on 4/23/15.
  7. // Copyright (c) 2015 Liu Liu. All rights reserved.
  8. //
  9. #import "SCCapturer.h"
  10. #import "SCManagedCaptureDevice.h"
  11. #import "SCManagedRecordedVideo.h"
  12. #import "SCVideoCaptureSessionInfo.h"
  13. #import <SCFoundation/SCFuture.h>
  14. #import <AVFoundation/AVFoundation.h>
  15. #import <Foundation/Foundation.h>
  16. @class SCManagedCapturer;
  17. @class SCManagedCapturerState;
  18. @class LSAGLView;
  19. @class SCManagedCapturerSampleMetadata;
  20. @protocol SCManagedCapturerListener <NSObject>
  21. @optional
  22. // All these calbacks are invoked on main queue
  23. // Start / stop / reset
  24. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didStartRunning:(SCManagedCapturerState *)state;
  25. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didStopRunning:(SCManagedCapturerState *)state;
  26. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didResetFromRuntimeError:(SCManagedCapturerState *)state;
  27. // Change state methods
  28. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didChangeState:(SCManagedCapturerState *)state;
  29. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didChangeNightModeActive:(SCManagedCapturerState *)state;
  30. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didChangePortraitModeActive:(SCManagedCapturerState *)state;
  31. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didChangeFlashActive:(SCManagedCapturerState *)state;
  32. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didChangeLensesActive:(SCManagedCapturerState *)state;
  33. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didChangeARSessionActive:(SCManagedCapturerState *)state;
  34. - (void)managedCapturer:(id<SCCapturer>)managedCapturer
  35. didChangeFlashSupportedAndTorchSupported:(SCManagedCapturerState *)state;
  36. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didChangeZoomFactor:(SCManagedCapturerState *)state;
  37. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didChangeLowLightCondition:(SCManagedCapturerState *)state;
  38. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didChangeAdjustingExposure:(SCManagedCapturerState *)state;
  39. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didChangeCaptureDevicePosition:(SCManagedCapturerState *)state;
  40. // The video preview layer is not maintained as a state, therefore, its change is not related to the state of
  41. // the camera at all, listener show only manage the setup of the videoPreviewLayer.
  42. // Since the AVCaptureVideoPreviewLayer can only attach to one AVCaptureSession per app, it is recommended you
  43. // have a view and controller which manages the video preview layer, and for upper layer, only manage that view
  44. // or view controller, which maintains the pointer consistency. The video preview layer is required to recreate
  45. // every now and then because otherwise we will have cases that the old video preview layer may contain
  46. // residual images.
  47. - (void)managedCapturer:(id<SCCapturer>)managedCapturer
  48. didChangeVideoPreviewLayer:(AVCaptureVideoPreviewLayer *)videoPreviewLayer;
  49. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didChangeVideoPreviewGLView:(LSAGLView *)videoPreviewGLView;
  50. // Video recording-related methods
  51. - (void)managedCapturer:(id<SCCapturer>)managedCapturer
  52. didBeginVideoRecording:(SCManagedCapturerState *)state
  53. session:(SCVideoCaptureSessionInfo)session;
  54. - (void)managedCapturer:(id<SCCapturer>)managedCapturer
  55. didBeginAudioRecording:(SCManagedCapturerState *)state
  56. session:(SCVideoCaptureSessionInfo)session;
  57. - (void)managedCapturer:(id<SCCapturer>)managedCapturer
  58. willFinishRecording:(SCManagedCapturerState *)state
  59. session:(SCVideoCaptureSessionInfo)session
  60. recordedVideoFuture:(SCFuture<id<SCManagedRecordedVideo>> *)recordedVideoFuture
  61. videoSize:(CGSize)videoSize
  62. placeholderImage:(UIImage *)placeholderImage;
  63. - (void)managedCapturer:(id<SCCapturer>)managedCapturer
  64. didFinishRecording:(SCManagedCapturerState *)state
  65. session:(SCVideoCaptureSessionInfo)session
  66. recordedVideo:(SCManagedRecordedVideo *)recordedVideo;
  67. - (void)managedCapturer:(id<SCCapturer>)managedCapturer
  68. didFailRecording:(SCManagedCapturerState *)state
  69. session:(SCVideoCaptureSessionInfo)session
  70. error:(NSError *)error;
  71. - (void)managedCapturer:(id<SCCapturer>)managedCapturer
  72. didCancelRecording:(SCManagedCapturerState *)state
  73. session:(SCVideoCaptureSessionInfo)session;
  74. - (void)managedCapturer:(id<SCCapturer>)managedCapturer
  75. didGetError:(NSError *)error
  76. forType:(SCManagedVideoCapturerInfoType)type
  77. session:(SCVideoCaptureSessionInfo)session;
  78. - (void)managedCapturerDidCallLenseResume:(id<SCCapturer>)managedCapturer session:(SCVideoCaptureSessionInfo)session;
  79. - (void)managedCapturer:(id<SCCapturer>)managedCapturer
  80. didAppendVideoSampleBuffer:(CMSampleBufferRef)sampleBuffer
  81. sampleMetadata:(SCManagedCapturerSampleMetadata *)sampleMetadata;
  82. // Photo methods
  83. - (void)managedCapturer:(id<SCCapturer>)managedCapturer
  84. willCapturePhoto:(SCManagedCapturerState *)state
  85. sampleMetadata:(SCManagedCapturerSampleMetadata *)sampleMetadata;
  86. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didCapturePhoto:(SCManagedCapturerState *)state;
  87. - (BOOL)managedCapturer:(id<SCCapturer>)managedCapturer isUnderDeviceMotion:(SCManagedCapturerState *)state;
  88. - (BOOL)managedCapturer:(id<SCCapturer>)managedCapturer shouldProcessFileInput:(SCManagedCapturerState *)state;
  89. // Face detection
  90. - (void)managedCapturer:(id<SCCapturer>)managedCapturer
  91. didDetectFaceBounds:(NSDictionary<NSNumber *, NSValue *> *)faceBoundsByFaceID;
  92. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didChangeExposurePoint:(CGPoint)exposurePoint;
  93. - (void)managedCapturer:(id<SCCapturer>)managedCapturer didChangeFocusPoint:(CGPoint)focusPoint;
  94. @end