CameraCapture.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #pragma once
  2. #import <AVFoundation/AVFoundation.h>
  3. @interface CameraCaptureController : NSObject<AVCaptureVideoDataOutputSampleBufferDelegate, AVCaptureDataOutputSynchronizerDelegate>
  4. - (bool)initCapture:(AVCaptureDevice*)device;
  5. - (bool)initCapture:(AVCaptureDevice*)device preset:(NSString*)preset fps:(float)fps;
  6. - (void)setCaptureFPS:(float)fps;
  7. - (bool)initColorAndDepthCameraCapture:(AVCaptureDevice*)device preset:(NSString*)preset fps:(float)fps isDepth:(bool)isDepth;
  8. - (void)initColorAndDepthCameraCaptureSession;
  9. - (void)clearColorAndDepthCameraCaptureSession;
  10. - (void)captureOutput:(AVCaptureOutput*)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection*)connection;
  11. - (void)depthDataOutput:(AVCaptureDepthDataOutput*)captureDepthOutput didOutputDepthData:(AVDepthData*)depthData timestamp:(CMTime)timestamp connection:(AVCaptureConnection*)connection;
  12. - (void)dataOutputSynchronizer:(AVCaptureDataOutputSynchronizer *)synchronizer didOutputSynchronizedDataCollection:(AVCaptureSynchronizedDataCollection *)synchronizedDataCollection;
  13. + (NSMutableArray<CameraCaptureController*>*)getActiveColorAndDepthCameraControllers;
  14. + (void)addColorAndDepthCameraController:(CameraCaptureController*)controller;
  15. + (void)removeColorAndDepthCameraController:(CameraCaptureController*)controller;
  16. + (void)clearColorAndDepthCameraControllers;
  17. + (CameraCaptureController*)findColorAndDepthCameraController:(AVCaptureDevice*)device isDepth:(bool)isDepth;
  18. - (void)capturePixelBufferToMemBuffer:(uint8_t*)dst;
  19. - (int)isCVTextureFlipped;
  20. + (BOOL)focusPointSupported:(AVCaptureDevice*)captureDevice withFocusMode:(AVCaptureFocusMode)focusMode;
  21. - (int)setFocusPointWithX:(float)x Y:(float)y;
  22. - (int)setFocusPoint;
  23. - (void)start;
  24. - (void)pause;
  25. - (void)stop;
  26. @property (nonatomic, retain) AVCaptureDevice* captureDevice;
  27. @property (nonatomic, retain) AVCaptureSession* captureSession;
  28. @property (nonatomic, retain) AVCaptureDeviceInput* captureInput;
  29. @property (nonatomic, retain) AVCaptureVideoDataOutput* captureOutput;
  30. @property (nonatomic, retain) AVCaptureDepthDataOutput* captureDepthOutput;
  31. @property (nonatomic, retain) AVCaptureDataOutputSynchronizer* captureSynchronizer;
  32. - (float)pickAvailableFrameRate:(float)fps;
  33. @end
  34. enum WebCamKind
  35. {
  36. kWebCamWideAngle = 1,
  37. kWebCamTelephoto = 2,
  38. kWebCamColorAndDepth = 3,
  39. kWebCamUltraWideAngle = 4,
  40. };
  41. @interface CameraCaptureDevice : NSObject
  42. - (bool)isColorAndDepthCaptureDevice;
  43. - (WebCamKind)getKind;
  44. - (void)fillCaptureDeviceResolutions;
  45. - (NSString*)pickPresetFromWidth:(int)w height:(int)h;
  46. - (bool)initCaptureForController:(CameraCaptureController*)controller width:(int)w height:(int)h fps:(float)fps isDepth:(bool)isDepth;
  47. + (bool)initialized;
  48. + (void)createCameraCaptureDevicesArray;
  49. + (void)addCameraCaptureDevice:(AVCaptureDevice*)device;
  50. @end