41 lines
1.3 KiB
Objective-C
41 lines
1.3 KiB
Objective-C
/**
|
|
* @file src/platform/macos/av_video.h
|
|
* @brief todo
|
|
*/
|
|
#pragma once
|
|
|
|
#import <AVFoundation/AVFoundation.h>
|
|
#import <AppKit/AppKit.h>
|
|
|
|
struct CaptureSession {
|
|
AVCaptureVideoDataOutput *output;
|
|
NSCondition *captureStopped;
|
|
};
|
|
|
|
@interface AVVideo: NSObject <AVCaptureVideoDataOutputSampleBufferDelegate>
|
|
|
|
#define kMaxDisplays 32
|
|
|
|
@property (nonatomic, assign) CGDirectDisplayID displayID;
|
|
@property (nonatomic, assign) CMTime minFrameDuration;
|
|
@property (nonatomic, assign) OSType pixelFormat;
|
|
@property (nonatomic, assign) int frameWidth;
|
|
@property (nonatomic, assign) int frameHeight;
|
|
|
|
typedef bool (^FrameCallbackBlock)(CMSampleBufferRef);
|
|
|
|
@property (nonatomic, assign) AVCaptureSession *session;
|
|
@property (nonatomic, assign) NSMapTable<AVCaptureConnection *, AVCaptureVideoDataOutput *> *videoOutputs;
|
|
@property (nonatomic, assign) NSMapTable<AVCaptureConnection *, FrameCallbackBlock> *captureCallbacks;
|
|
@property (nonatomic, assign) NSMapTable<AVCaptureConnection *, dispatch_semaphore_t> *captureSignals;
|
|
|
|
+ (NSArray<NSDictionary *> *)displayNames;
|
|
+ (NSString *)getDisplayName:(CGDirectDisplayID)displayID;
|
|
|
|
- (id)initWithDisplay:(CGDirectDisplayID)displayID frameRate:(int)frameRate;
|
|
|
|
- (void)setFrameWidth:(int)frameWidth frameHeight:(int)frameHeight;
|
|
- (dispatch_semaphore_t)capture:(FrameCallbackBlock)frameCallback;
|
|
|
|
@end
|