Sunshine master
Self-hosted game stream host for Moonlight.
av_video.h
Go to the documentation of this file.
1
5#pragma once
6
7// platform includes
8#import <AVFoundation/AVFoundation.h>
9#import <CoreGraphics/CoreGraphics.h>
10
15 AVCaptureVideoDataOutput *output;
16 NSCondition *captureStopped;
17};
18
22@interface AVVideo: NSObject <AVCaptureVideoDataOutputSampleBufferDelegate>
23
27@property (nonatomic, assign) CGDirectDisplayID displayID;
31@property (nonatomic, assign) CMTime minFrameDuration;
35@property (nonatomic, assign) OSType pixelFormat;
39@property (nonatomic, assign) int frameWidth;
43@property (nonatomic, assign) int frameHeight;
44
48typedef bool (^FrameCallbackBlock)(CMSampleBufferRef);
49
53@property (nonatomic, assign) AVCaptureSession *session;
57@property (nonatomic, assign) NSMapTable<AVCaptureConnection *, AVCaptureVideoDataOutput *> *videoOutputs;
61@property (nonatomic, assign) NSMapTable<AVCaptureConnection *, FrameCallbackBlock> *captureCallbacks;
65@property (nonatomic, assign) NSMapTable<AVCaptureConnection *, dispatch_semaphore_t> *captureSignals;
66
74- (id)initWithDisplay:(CGDirectDisplayID)displayID frameRate:(int)frameRate;
75
82- (void)setFrameWidth:(int)frameWidth frameHeight:(int)frameHeight;
89- (dispatch_semaphore_t)capture:(FrameCallbackBlock)frameCallback;
90
91@end
AVFoundation video capture controller used by the macOS backend.
Definition av_video.h:22
CGDirectDisplayID displayID
Display ID property.
Definition av_video.h:27
int frameHeight
Frame height property.
Definition av_video.h:43
bool(^) FrameCallbackBlock(CMSampleBufferRef)
Objective-C block invoked for each captured sample buffer.
Definition av_video.h:48
NSMapTable< AVCaptureConnection *, dispatch_semaphore_t > * captureSignals
Capture signals property.
Definition av_video.h:65
int frameWidth
Frame width property.
Definition av_video.h:39
NSMapTable< AVCaptureConnection *, AVCaptureVideoDataOutput * > * videoOutputs
Video outputs property.
Definition av_video.h:57
AVCaptureSession * session
Capture session that owns the active AVFoundation inputs and outputs.
Definition av_video.h:53
NSMapTable< AVCaptureConnection *, FrameCallbackBlock > * captureCallbacks
Capture callbacks property.
Definition av_video.h:61
OSType pixelFormat
Pixel format property.
Definition av_video.h:35
CMTime minFrameDuration
Min frame duration property.
Definition av_video.h:31
macOS capture session and video output handles.
Definition av_video.h:14
NSCondition * captureStopped
Capture stopped.
Definition av_video.h:16
AVCaptureVideoDataOutput * output
Output.
Definition av_video.h:15