123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- #import <Foundation/Foundation.h>
- #import <AVFoundation/AVFoundation.h>
- #if defined(__cplusplus)
- #define DTF_EXPORT extern "C"
- #else
- #define DTF_EXPORT extern
- #endif
- typedef NSString* const DTFCameraInitKey;
- typedef NSString* const DTFCameraConfigKey;
- typedef void(^DTFCameraTakePhotoCompletion)(CMSampleBufferRef imageDataSampleBuffer, NSError *error);
- DTF_EXPORT DTFCameraInitKey DTFCameraInitKeyCaptureDevicePosition;
- DTF_EXPORT DTFCameraInitKey DTFCameraInitKeySessionPreset;
- DTF_EXPORT DTFCameraInitKey DTFCameraInitKeyVideoOutputOrientation;
- DTF_EXPORT DTFCameraInitKey DTFCameraInitKeyMode;
- DTF_EXPORT DTFCameraConfigKey DTFCameraConfigKeyFocusPointOfInterest;
- DTF_EXPORT NSString *const kDTFCameraErrorDomain;
- typedef NS_ENUM(NSInteger, DTFCameraErrorCode) {
-
-
- DTFCameraUnsupportedPreset,
-
-
- DTFCameraNotAvailable,
-
-
- DTFCameraSessionFailure,
- };
- typedef NS_ENUM(NSInteger, DTFCameraMode) {
-
-
- DTFCameraModeVideo,
-
-
- DTFCameraModeStillImage
-
- };
- typedef struct camera_configuration_t{
-
- CGPoint focusPointOfInterest;
- }camera_configuration;
- @protocol DTFCameraServiceDelegate <NSObject>
- @optional
- - (void)cameraControllerCaptureOutput:(AVCaptureOutput *)captureOutput
- didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
- fromConnection:(AVCaptureConnection *)connection;
- @end
- @interface DTFCameraService : NSObject <AVCaptureVideoDataOutputSampleBufferDelegate>
- @property(nonatomic, assign, readonly)camera_configuration configuration;
- @property(nonatomic, strong) AVCaptureVideoPreviewLayer *previewLayer;
- @property (nonatomic, assign, readonly) CGSize videoOutputSize;
- - (instancetype)init NS_UNAVAILABLE;
- - (instancetype)initWithConfig:(NSDictionary *)config error:(NSError **)errPtr;
- - (void)setDelegate:(id<DTFCameraServiceDelegate>) delegate;
- - (BOOL)changeConfiguration:(NSString *)key
- desiredValue:(NSString *)value;
- - (BOOL)setWhiteBalanceMode:(AVCaptureWhiteBalanceMode)mode;
- - (BOOL)setExposureMode:(AVCaptureExposureMode)mode;
- - (void)startCamera;
- - (void)stopCamera;
- - (void)takePicture:(DTFCameraTakePhotoCompletion)completion;
- @end
|