BEVideoCapture.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright (C) 2018 Beijing Bytedance Network Technology Co., Ltd.
  2. #import <AVFoundation/AVFoundation.h>
  3. #import <Foundation/Foundation.h>
  4. #import "BEGLView.h"
  5. #define AVCaptureSessionPreset NSString*
  6. @class BEVideoCapture;
  7. typedef NS_ENUM(NSInteger, VideoCaptureError) {
  8. VideoCaptureErrorAuthNotGranted = 0,
  9. VideoCaptureErrorFailedCreateInput = 1,
  10. VideoCaptureErrorFailedAddDataOutput = 2,
  11. VideoCaptureErrorFailedAddDeviceInput = 3,
  12. };
  13. @protocol BEVideoCaptureDelegate <NSObject>
  14. - (void)videoCapture:(BEVideoCapture *)camera didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer andType:(int )type;//1video 2audio
  15. - (void)videoCapture:(BEVideoCapture *)camera didFailedToStartWithError:(VideoCaptureError)error;
  16. @end
  17. @interface BEVideoCapture : NSObject
  18. @property (nonatomic, assign) id <BEVideoCaptureDelegate> delegate;
  19. @property (nonatomic, readonly) AVCaptureDevicePosition devicePosition; // default AVCaptureDevicePositionFront
  20. @property (nonatomic, assign) AVCaptureVideoOrientation videoOrientation;
  21. @property (nonatomic, copy) AVCaptureSessionPreset sessionPreset; // default 1280x720
  22. @property (nonatomic, assign) BOOL isOutputWithYUV; // default NO
  23. - (CGSize)videoSize;
  24. - (void)startRunning;
  25. - (void)stopRunning;
  26. - (void)pause;
  27. - (void)resume;
  28. - (void)switchCamera;
  29. - (void)switchCamera:(AVCaptureDevicePosition)position;
  30. - (void) switchToQRCodeScanWithTopView:(BEGLView*) topView;
  31. - (void) switchToVideoCaptureWithTopView:(BEGLView*) topView;
  32. - (CGRect)getZoomedRectWithRect:(CGRect)rect scaleToFit:(BOOL)scaleToFit;
  33. - (void)setFlip:(BOOL)isFlip;
  34. - (void)setOrientation:(AVCaptureVideoOrientation)orientation;
  35. - (void) setExposure:(float) exposure;
  36. - (void) setExposurePointOfInterest:(CGPoint) point;
  37. - (void) setFocusPointOfInterest:(CGPoint) point;
  38. - (CGRect)getZoomedRectWithRect1:(CGRect)rect scaleToFit:(BOOL)bScaleToFit;
  39. @end