mirror of
https://github.com/LizardByte/Sunshine.git
synced 2024-11-19 05:11:53 +00:00
2b450839a1
This commit introduces initial support for MacOS as third major host platform. It relies on the VideoToolbox framework for audio and video processing, which enables hardware accelerated processing of the stream on most platforms. Audio capturing requires third party tools as MacOS does not offer the recording of the audio output like the other platforms do. The commit enables most features offered by Sunshine for MacOS with the big exception of gamepad support. The patch sets was tested by a few volunteers, which allowed to remove some of the early bugs. However, several bugs especially regarding corner cases have probably not surfaced yet. Besides instructions how to build from source, the commit also adds a Portfile that allows a more easy installation. After available on the release branch, a pull request for the Portfile in the MacPorts project is planned. Signed-off-by: Anselm Busse <anselm.busse@outlook.com>
44 lines
1.5 KiB
Objective-C
44 lines
1.5 KiB
Objective-C
#ifndef SUNSHINE_PLATFORM_AV_VIDEO_H
|
|
#define SUNSHINE_PLATFORM_AV_VIDEO_H
|
|
|
|
#import <AVFoundation/AVFoundation.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;
|
|
@property(nonatomic, assign) float scaling;
|
|
@property(nonatomic, assign) int paddingLeft;
|
|
@property(nonatomic, assign) int paddingRight;
|
|
@property(nonatomic, assign) int paddingTop;
|
|
@property(nonatomic, assign) int paddingBottom;
|
|
|
|
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;
|
|
|
|
- (id)initWithDisplay:(CGDirectDisplayID)displayID frameRate:(int)frameRate;
|
|
|
|
- (void)setFrameWidth:(int)frameWidth frameHeight:(int)frameHeight;
|
|
- (dispatch_semaphore_t)capture:(FrameCallbackBlock)frameCallback;
|
|
|
|
@end
|
|
|
|
#endif //SUNSHINE_PLATFORM_AV_VIDEO_H
|