-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAVCaptureSession+Convenience.h
75 lines (43 loc) · 2.06 KB
/
AVCaptureSession+Convenience.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//
// AVCaptureSession+Convenience.h
// Scans
//
// Created by Alexander Ivanov on 29.03.2018.
// Copyright © 2018 Alexander Ivanov. All rights reserved.
//
#import <AVFoundation/AVFoundation.h>
#import "NSObject+Convenience.h"
@interface AVCaptureSession (Convenience)
+ (instancetype)sessionWithPreset:(AVCaptureSessionPreset)sessionPreset;
@end
@interface AVCaptureDeviceInput (Convenience)
+ (instancetype)deviceInputWithDevice:(AVCaptureDevice *)device;
+ (instancetype)deviceInputWithMediaType:(AVMediaType)mediaType;
+ (instancetype)deviceInputWithUniqueID:(NSString *)deviceUniqueID;
+ (instancetype)deviceInputWithDeviceType:(AVCaptureDeviceType)deviceType mediaType:(AVMediaType)mediaType position:(AVCaptureDevicePosition)position;
@end
@interface AVCaptureVideoDataOutput (Convenience)
+ (instancetype)videoDataOutputWithSampleBufferDelegate:(id<AVCaptureVideoDataOutputSampleBufferDelegate>)sampleBufferDelegate queue:(dispatch_queue_t)sampleBufferCallbackQueue;
@end
@interface AVCaptureMetadataOutput (Convenience)
+ (instancetype)metadataOutputWithMetadataObjectsDelegate:(id<AVCaptureMetadataOutputObjectsDelegate>)objectsDelegate queue:(dispatch_queue_t)objectsCallbackQueue;
- (void)setAvailableMetadataObjectTypes:(NSArray<AVMetadataObjectType> *)metadataObjectTypes;
@end
#if __has_include(<UIKit/UIKit.h>)
#import <UIKit/UIKit.h>
@interface AVCapturePhoto (Convenience)
@property (strong, nonatomic, readonly) UIImage *image;
@end
@interface AVCapturePhotoViewController : UIViewController
@property (strong, nonatomic, readonly) AVCaptureVideoPreviewLayer *previewLayer;
@property (strong, nonatomic, readonly) UIButton *doneButton;
@property (strong, nonatomic, readonly) UIButton *cancelButton;
@property (copy, nonatomic) void (^capturePhotoHandler)(AVCapturePhoto *photo);
@end
#endif
#if __has_include("UIApplication+Convenience.h")
#import "UIApplication+Convenience.h"
@interface AVCaptureDevice (Convenience)
+ (void)requestAccessIfNeededForMediaType:(AVMediaType)mediaType completionHandler:(void (^)(BOOL granted))handler;
@end
#endif