STCamera.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // STCamera.h
  3. //
  4. // Created by sluin on 16/5/4.
  5. // Copyright © 2016年 SenseTime. All rights reserved.
  6. //
  7. #import <Foundation/Foundation.h>
  8. #import <AVFoundation/AVFoundation.h>
  9. @protocol STCameraDelegate <NSObject>
  10. // call back in bufferQueue
  11. - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection;
  12. @end
  13. @interface STCamera : NSObject
  14. @property (nonatomic , assign) id <STCameraDelegate> delegate;
  15. @property (nonatomic , readonly) dispatch_queue_t bufferQueue;
  16. @property (nonatomic , assign) AVCaptureDevicePosition devicePosition; // default AVCaptureDevicePositionFront
  17. @property (nonatomic , assign) AVCaptureVideoOrientation videoOrientation;
  18. @property (nonatomic , assign) BOOL needVideoMirrored;
  19. @property (nonatomic , strong , readonly) AVCaptureConnection *videoConnection;
  20. @property (nonatomic , copy) NSString *sessionPreset; // default 640x480
  21. @property (nonatomic , strong) AVCaptureVideoPreviewLayer *previewLayer;
  22. @property (nonatomic , assign) BOOL bSessionPause;
  23. @property (nonatomic , assign) int iExpectedFPS;
  24. @property (nonatomic, readwrite, strong) NSDictionary *videoCompressingSettings;
  25. - (instancetype)initWithDevicePosition:(AVCaptureDevicePosition)iDevicePosition
  26. sessionPresset:(AVCaptureSessionPreset)sessionPreset
  27. fps:(int)iFPS
  28. needYuvOutput:(BOOL)needYuvOutput;
  29. - (void)setExposurePoint:(CGPoint)point inPreviewFrame:(CGRect)frame;
  30. - (void)setISOValue:(float)value;
  31. - (void)startRunning;
  32. - (void)stopRunning;
  33. - (void)snapStillImageCompletionHandler:(void (^)(CMSampleBufferRef imageDataSampleBuffer, NSError *error))handler;
  34. - (CGRect)getZoomedRectWithRect:(CGRect)rect scaleToFit:(BOOL)bScaleToFit;
  35. @end