12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- // Copyright (C) 2018 Beijing Bytedance Network Technology Co., Ltd.
- #import <AVFoundation/AVFoundation.h>
- #import <Foundation/Foundation.h>
- #import "BEGLView.h"
- #define AVCaptureSessionPreset NSString*
- @class BEVideoCapture;
- typedef NS_ENUM(NSInteger, VideoCaptureError) {
- VideoCaptureErrorAuthNotGranted = 0,
- VideoCaptureErrorFailedCreateInput = 1,
- VideoCaptureErrorFailedAddDataOutput = 2,
- VideoCaptureErrorFailedAddDeviceInput = 3,
- };
- @protocol BEVideoCaptureDelegate <NSObject>
- - (void)videoCapture:(BEVideoCapture *)camera didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer andType:(int )type;//1video 2audio
- - (void)videoCapture:(BEVideoCapture *)camera didFailedToStartWithError:(VideoCaptureError)error;
- @end
- @interface BEVideoCapture : NSObject
- @property (nonatomic, assign) id <BEVideoCaptureDelegate> delegate;
- @property (nonatomic, readonly) AVCaptureDevicePosition devicePosition; // default AVCaptureDevicePositionFront
- @property (nonatomic, assign) AVCaptureVideoOrientation videoOrientation;
- @property (nonatomic, copy) AVCaptureSessionPreset sessionPreset; // default 1280x720
- @property (nonatomic, assign) BOOL isOutputWithYUV; // default NO
- - (CGSize)videoSize;
- - (void)startRunning;
- - (void)stopRunning;
- - (void)pause;
- - (void)resume;
- - (void)switchCamera;
- - (void)switchCamera:(AVCaptureDevicePosition)position;
- - (void) switchToQRCodeScanWithTopView:(BEGLView*) topView;
- - (void) switchToVideoCaptureWithTopView:(BEGLView*) topView;
- - (CGRect)getZoomedRectWithRect:(CGRect)rect scaleToFit:(BOOL)scaleToFit;
- - (void)setFlip:(BOOL)isFlip;
- - (void)setOrientation:(AVCaptureVideoOrientation)orientation;
- - (void) setExposure:(float) exposure;
- - (void) setExposurePointOfInterest:(CGPoint) point;
- - (void) setFocusPointOfInterest:(CGPoint) point;
- - (CGRect)getZoomedRectWithRect1:(CGRect)rect scaleToFit:(BOOL)bScaleToFit;
- @end
|