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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
use super::internal::SCStreamConfiguration;
/// Presenter overlay privacy alert setting (macOS 14.0+)
///
/// Controls when the system displays a privacy alert for presenter overlay.
#[repr(i32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub enum SCPresenterOverlayAlertSetting {
/// Let the system decide when to show the alert
#[default]
System = 0,
/// Never show the privacy alert
Never = 1,
/// Always show the privacy alert
Always = 2,
}
impl SCStreamConfiguration {
/// Sets whether to ignore shadows for single window capture.
///
/// A Boolean value that indicates whether the stream omits the shadow effects
/// of the windows it captures.
/// Available on macOS 14.0+
///
/// Requires the `macos_14_0` feature flag to be enabled.
#[cfg(feature = "macos_14_0")]
pub fn set_ignores_shadows_single_window(&mut self, ignores_shadows: bool) -> &mut Self {
unsafe {
crate::ffi::sc_stream_configuration_set_ignores_shadows_single_window(
self.as_ptr(),
ignores_shadows,
);
}
self
}
/// Sets whether to ignore shadows for single window capture (builder pattern)
#[cfg(feature = "macos_14_0")]
#[must_use]
pub fn with_ignores_shadows_single_window(mut self, ignores_shadows: bool) -> Self {
self.set_ignores_shadows_single_window(ignores_shadows);
self
}
/// Get whether shadows are ignored for single-window capture (macOS 14.0+).
#[cfg(feature = "macos_14_0")]
pub fn ignores_shadows_single_window(&self) -> bool {
unsafe {
crate::ffi::sc_stream_configuration_get_ignores_shadows_single_window(self.as_ptr())
}
}
/// Sets whether captured content should be treated as opaque.
///
/// A Boolean value that indicates whether the stream treats the transparency
/// of the captured content as opaque.
///
/// Available on macOS 14.0+ (`SCStreamConfiguration.shouldBeOpaque` is
/// annotated `API_AVAILABLE(macos(14.0))`), so this requires the
/// `macos_14_0` feature flag. On older systems the bridge ignores the
/// assignment.
#[cfg(feature = "macos_14_0")]
pub fn set_should_be_opaque(&mut self, should_be_opaque: bool) -> &mut Self {
unsafe {
crate::ffi::sc_stream_configuration_set_should_be_opaque(
self.as_ptr(),
should_be_opaque,
);
}
self
}
/// Sets whether captured content should be treated as opaque (builder pattern)
#[cfg(feature = "macos_14_0")]
#[must_use]
pub fn with_should_be_opaque(mut self, should_be_opaque: bool) -> Self {
self.set_should_be_opaque(should_be_opaque);
self
}
/// Get whether captured content is treated as opaque (macOS 14.0+).
#[cfg(feature = "macos_14_0")]
pub fn should_be_opaque(&self) -> bool {
unsafe { crate::ffi::sc_stream_configuration_get_should_be_opaque(self.as_ptr()) }
}
/// Sets whether to include child windows in capture.
///
/// A Boolean value that indicates whether the content includes child windows.
/// Available on macOS 14.2+
///
/// Requires the `macos_14_2` feature flag to be enabled.
#[cfg(feature = "macos_14_2")]
pub fn set_includes_child_windows(&mut self, includes_child_windows: bool) -> &mut Self {
unsafe {
crate::ffi::sc_stream_configuration_set_includes_child_windows(
self.as_ptr(),
includes_child_windows,
);
}
self
}
/// Sets whether to include child windows (builder pattern)
#[cfg(feature = "macos_14_2")]
#[must_use]
pub fn with_includes_child_windows(mut self, includes_child_windows: bool) -> Self {
self.set_includes_child_windows(includes_child_windows);
self
}
/// Get whether child windows are included (macOS 14.2+).
#[cfg(feature = "macos_14_2")]
pub fn includes_child_windows(&self) -> bool {
unsafe { crate::ffi::sc_stream_configuration_get_includes_child_windows(self.as_ptr()) }
}
/// Sets the presenter overlay privacy alert setting.
///
/// A configuration for the privacy alert that the capture session displays.
///
/// Available on macOS 14.0+ — `presenterOverlayPrivacyAlertSetting` is
/// annotated `API_AVAILABLE(macos(14.0))`, not 14.2 as this binding
/// previously assumed — so it only needs the `macos_14_0` feature flag.
#[cfg(feature = "macos_14_0")]
pub fn set_presenter_overlay_privacy_alert_setting(
&mut self,
setting: SCPresenterOverlayAlertSetting,
) -> &mut Self {
unsafe {
crate::ffi::sc_stream_configuration_set_presenter_overlay_privacy_alert_setting(
self.as_ptr(),
setting as i32,
);
}
self
}
/// Sets the presenter overlay privacy alert setting (builder pattern, macOS 14.0+)
#[cfg(feature = "macos_14_0")]
#[must_use]
pub fn with_presenter_overlay_privacy_alert_setting(
mut self,
setting: SCPresenterOverlayAlertSetting,
) -> Self {
self.set_presenter_overlay_privacy_alert_setting(setting);
self
}
/// Get the presenter overlay privacy alert setting (macOS 14.0+).
#[cfg(feature = "macos_14_0")]
pub fn presenter_overlay_privacy_alert_setting(&self) -> SCPresenterOverlayAlertSetting {
let value = unsafe {
crate::ffi::sc_stream_configuration_get_presenter_overlay_privacy_alert_setting(
self.as_ptr(),
)
};
match value {
1 => SCPresenterOverlayAlertSetting::Never,
2 => SCPresenterOverlayAlertSetting::Always,
_ => SCPresenterOverlayAlertSetting::System,
}
}
/// Sets whether to ignore shadow display configuration.
///
/// Available on macOS 14.0+
///
/// Requires the `macos_14_0` feature flag to be enabled.
#[cfg(feature = "macos_14_0")]
pub fn set_ignores_shadow_display_configuration(&mut self, ignores_shadow: bool) -> &mut Self {
unsafe {
crate::ffi::sc_stream_configuration_set_ignores_shadow_display_configuration(
self.as_ptr(),
ignores_shadow,
);
}
self
}
/// Sets whether to ignore shadow display configuration (builder pattern)
#[cfg(feature = "macos_14_0")]
#[must_use]
pub fn with_ignores_shadow_display_configuration(mut self, ignores_shadow: bool) -> Self {
self.set_ignores_shadow_display_configuration(ignores_shadow);
self
}
/// Get whether the shadow display configuration is ignored (macOS 14.0+).
#[cfg(feature = "macos_14_0")]
pub fn ignores_shadow_display_configuration(&self) -> bool {
unsafe {
crate::ffi::sc_stream_configuration_get_ignores_shadow_display_configuration(
self.as_ptr(),
)
}
}
}