FreeRDP
Loading...
Searching...
No Matches
mac_capture.h
1
19#ifndef FREERDP_SERVER_SHADOW_MAC_CAPTURE_H
20#define FREERDP_SERVER_SHADOW_MAC_CAPTURE_H
21
22#include <winpr/wtypes.h>
23
24#include <CoreGraphics/CoreGraphics.h>
25#include <CoreVideo/CoreVideo.h>
26
27/* The screen as ScreenCaptureKit gives it: a C interface, so that the rest of
28 * the subsystem stays plain C. */
29typedef struct mac_capture macCapture;
30
31/* Called on the capture queue for every frame that changed something. frame
32 * is a 32-bit BGRA buffer of the size asked for; the dirty rectangles are in
33 * its pixels. The frame is only valid during the call: CFRetain it to keep it. */
34typedef void (*macCaptureFrameFn)(void *context, CVPixelBufferRef frame, const CGRect *dirty,
35 size_t count);
36
37/* Called on the capture queue with interleaved 32-bit float samples. */
38typedef void (*macCaptureAudioFn)(void *context, const float *samples, size_t frames,
39 UINT32 channels, UINT32 rate);
40
41/* The stream stopped by itself (the display went away, permission revoked). */
42typedef void (*macCaptureStoppedFn)(void *context);
43
44typedef struct
45{
46 CGDirectDisplayID display;
47 size_t width; /* of the frames, in pixels */
48 size_t height; /* of the frames, in pixels */
49 UINT32 fps;
50 BOOL showCursor;
51 BOOL audio; /* capture the sound the computer plays (macOS 13) */
52 UINT32 audioRate; /* e.g. 48000 */
53 UINT32 audioChannels;
54 macCaptureFrameFn onFrame;
55 macCaptureAudioFn onAudio;
56 macCaptureStoppedFn onStopped;
57 void *context;
59
60#ifdef __cplusplus
61extern "C"
62{
63#endif
64
65 /* Screen Recording permission: TRUE when granted; when not, asks for it
66 * once (the system shows its own prompt) and returns FALSE. */
67 WINPR_ATTR_NODISCARD
68 BOOL mac_capture_check_access(void);
69
70 void mac_capture_free(macCapture *capture);
71
72 WINPR_ATTR_MALLOC(mac_capture_free, 1)
73 macCapture *mac_capture_new(const macCaptureConfig *config);
74
75 WINPR_ATTR_NODISCARD
76 BOOL mac_capture_start(macCapture *capture);
77
78 void mac_capture_stop(macCapture *capture);
79
80#ifdef __cplusplus
81}
82#endif
83
84#endif /* FREERDP_SERVER_SHADOW_MAC_CAPTURE_H */