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.

92 lines
3.2 KiB

  1. //
  2. // SCManagedStillImageCapturer.h
  3. // Snapchat
  4. //
  5. // Created by Liu Liu on 4/30/15.
  6. // Copyright (c) 2015 Liu Liu. All rights reserved.
  7. //
  8. #import "SCCoreCameraLogger.h"
  9. #import "SCManagedCaptureDevice.h"
  10. #import "SCManagedCapturerListener.h"
  11. #import "SCManagedCapturerState.h"
  12. #import "SCManagedDeviceCapacityAnalyzerListener.h"
  13. #import <SCCameraFoundation/SCManagedVideoDataSourceListener.h>
  14. #import <SCLogger/SCCameraMetrics+ExposureAdjustment.h>
  15. #import <AVFoundation/AVFoundation.h>
  16. #import <Foundation/Foundation.h>
  17. SC_EXTERN_C_BEGIN
  18. extern BOOL SCPhotoCapturerIsEnabled(void);
  19. SC_EXTERN_C_END
  20. @protocol SCPerforming;
  21. @protocol SCManagedStillImageCapturerDelegate;
  22. @class SCCaptureResource;
  23. typedef void (^sc_managed_still_image_capturer_capture_still_image_completion_handler_t)(UIImage *fullScreenImage,
  24. NSDictionary *metadata,
  25. NSError *error);
  26. @interface SCManagedStillImageCapturer
  27. : NSObject <SCManagedDeviceCapacityAnalyzerListener, SCManagedCapturerListener, SCManagedVideoDataSourceListener> {
  28. SCManagedCapturerState *_state;
  29. BOOL _shouldCaptureFromVideo;
  30. BOOL _captureImageFromVideoImmediately;
  31. CGFloat _aspectRatio;
  32. float _zoomFactor;
  33. float _fieldOfView;
  34. BOOL _adjustingExposureManualDetect;
  35. sc_managed_still_image_capturer_capture_still_image_completion_handler_t _completionHandler;
  36. }
  37. + (instancetype)capturerWithCaptureResource:(SCCaptureResource *)captureResource;
  38. SC_INIT_AND_NEW_UNAVAILABLE;
  39. @property (nonatomic, weak) id<SCManagedStillImageCapturerDelegate> delegate;
  40. - (void)setupWithSession:(AVCaptureSession *)session;
  41. - (void)setAsOutput:(AVCaptureSession *)session;
  42. - (void)removeAsOutput:(AVCaptureSession *)session;
  43. - (void)setHighResolutionStillImageOutputEnabled:(BOOL)highResolutionStillImageOutputEnabled;
  44. - (void)setPortraitModeCaptureEnabled:(BOOL)enabled;
  45. - (void)setPortraitModePointOfInterest:(CGPoint)pointOfInterest;
  46. - (void)enableStillImageStabilization;
  47. - (void)captureStillImageWithAspectRatio:(CGFloat)aspectRatio
  48. atZoomFactor:(float)zoomFactor
  49. fieldOfView:(float)fieldOfView
  50. state:(SCManagedCapturerState *)state
  51. captureSessionID:(NSString *)captureSessionID
  52. shouldCaptureFromVideo:(BOOL)shouldCaptureFromVideo
  53. completionHandler:
  54. (sc_managed_still_image_capturer_capture_still_image_completion_handler_t)completionHandler;
  55. - (void)captureStillImageFromVideoBuffer;
  56. @end
  57. @protocol SCManagedStillImageCapturerDelegate <NSObject>
  58. - (BOOL)managedStillImageCapturerIsUnderDeviceMotion:(SCManagedStillImageCapturer *)managedStillImageCapturer;
  59. - (BOOL)managedStillImageCapturerShouldProcessFileInput:(SCManagedStillImageCapturer *)managedStillImageCapturer;
  60. @optional
  61. - (void)managedStillImageCapturerWillCapturePhoto:(SCManagedStillImageCapturer *)managedStillImageCapturer;
  62. - (void)managedStillImageCapturerDidCapturePhoto:(SCManagedStillImageCapturer *)managedStillImageCapturer;
  63. @end