Repository navigation
v11.0.0
Security
SCStreamConfiguration,SCRecordingOutputConfigurationand
SCScreenshotConfigurationare mutable Objective-C objects, and the bridge
handed the caller's own object to work that outlives the call: theTask
behind every screenshot andupdate_configuration(which keeps running after
a synchronous wait times out or an async future is dropped) and the
framework objects behindSCStream::newandSCRecordingOutput::new. The
async futures don't borrow the configuration, so safe code could mutate it
while ScreenCaptureKit read it on another thread; for
SCScreenshotConfiguration.contentType, anassignproperty, that could
read a freed object. ScreenCaptureKit now always gets a private copy.- CI: every action is pinned to a commit SHA, the release jobs check out
without persisted credentials and give the automatic token only
contents: read, and the release-PR job no longer receives the crates.io
token.
Fixed
SCStream::identitybuilt itsStreamIdentitywith
NonZeroUsize::new_uncheckedalthough no constructor rejected a null native
stream. The constructors now check the pointer once and report
SCError::NullPointer.- Process aborts in the Swift bridge:
Int32(_:)conversions of
NSError.code,SCDisplay.width/heightandSCWindow.windowLayer, the
UInt32(len)and offset arithmetic of the batched shareable-content string
buffers, and theUInt32(_:)conversion of pickerexcludedWindowIDs. - A large
SCREENCAPTUREKIT_COMPLETION_TIMEOUT_SECSmade every async call
panic with "overflow when adding duration to instant"; an unrepresentable
deadline now means no deadline. - Panics on an ordinary unsupported system: the picker, recording and
screenshot configuration constructors,SCContentFilterBuilder::build
without a display or window, and theDefaultimpls built on them. See
Changed. - Inputs that were silently ignored, sometimes with only an
eprintln!:
string setters with an interior NUL byte, non-UTF-8 output paths, output
handlers thatScreenCaptureKitrefused, and picker operations below
macOS 14. See Changed. - The
cmaudio views come from apple-cf 0.11, which checks each buffer's
pointer and length against the contiguous block buffer; the removed Swift
audio bridge clamped every buffer to the whole block-buffer length. - Live capture tests run only when
SCREENCAPTUREKIT_LIVE_TESTS=1is set, so
a plaincargo testnever captures the screen, and even then they check
CGPreflightScreenCaptureAccessand skip without Screen Recording
permission instead of raising the permission prompt or failing. The live
recording tests write undertarget/tmp. - The build script, and the Tauri example's, no longer add the toolchain's
Swift 5.5 back-deployment directory (usr/lib/swift-5.5/macosx) to the
rpath. It pointed into Xcode, so it never made back-deployment work on
users' machines, and the bridge's macOS 13 minimum doesn't need it: binaries
resolve@rpath/libswift_Concurrency.dylibthrough/usr/lib/swift. - Mismatched integer widths across the Swift boundary, where the callee read
the undefined upper half of a 32-bit argument register on arm64:
the presenter overlay privacy alert setter and getter took and returned a
SwiftIntwhere Rust passed and read ani32, and the raw
cm::ffi::cv_pixel_buffer_{lock,unlock}_base_addressdeclarations passed
u32flags to apple-cf exports that takeUInt64. The presenter overlay
exports now useInt32; the setter rejects raw values that are not a known
SCPresenterOverlayAlertSettinginstead of ignoring them, and the getter
hands the raw value to Rust instead of mapping unknown values toSystem. - Values ScreenCaptureKit reports that this crate doesn't know were replaced
by a default:capture_dynamic_rangeread them asSDR,
capture_resolution_typeasAutomatic, the filter and content-info
styleasNone,stream_typeasWindow,MetalTexture::pixel_format
asBGRA8Unorm, the screenshotdisplay_intentanddynamic_rangeas
None, andframe_statusas "no status". The bridge also handed samples of
an output type it doesn't know to the audio handlers, and truncated frame
status values, so a large one could alias a known status. See Changed. - Setters for properties that need a newer macOS than the running one
silently did nothing: everySCStreamConfigurationproperty that needs
macOS 14.0, 14.2 or 15.0 andSCContentFilterBuilder::with_include_menu_bar
(14.2).from_presetreturned a configuration without the preset before
macOS 15, and usedCaptureHDRStreamLocalDisplayinstead of the macOS 26
HDR10 recording preset before macOS 26. See Changed. - Docs:
SCStreamhad lost its rustdoc toStreamIdentity; the coverage
files were a v3.1.1 snapshot against an SDK that is no longer installed
(they now measure 11.0.0 against the macOS 26.5 and 27.0 SDKs and say what
the numbers mean); the README tied theaudio-inputentitlement to system
audio instead of microphone capture and pointed at files that don't exist.
Changed
- Breaking: requires
apple-cf >=0.11, <0.12and
apple-metal >=0.10, <0.11. Their breaking changes reach callers through the
re-exportedcg,cm,cv,dispatch_queueandapple_metalmodules; for
exampleCMBlockBuffer::as_sliceandcursor_refareunsafe. - Breaking:
cm::{AudioBuffer, AudioBufferList, AudioBufferListRaw, AudioBufferRef, AudioBufferListIter}are apple-cf's types, and
sample.audio_buffer_list()is apple-cf's inherent
CMSampleBuffer::audio_buffer_list, returning
Result<AudioBufferList, i32>. The buffers are read-only. - Breaking:
SCStream::new,SCStream::new_with_delegateand
AsyncSCStream::newreturnSCResult<Self>.AsyncSCStream::newalso
returns the output-handler registration error instead of a stream whose
queue is already closed. - Breaking:
SCContentFilterBuilder::buildreturns
SCResult<SCContentFilter>(SCError::InvalidConfigurationwithout a
display or window). - Breaking:
SCContentSharingPickerConfiguration::newand
default_from_system,SCContentSharingPicker::default_configuration,
SCRecordingOutputConfiguration::newandSCScreenshotConfiguration::new
returnResult<_, SCError>withSCError::FeatureNotAvailableon an older
macOS. - Breaking:
SCStreamConfiguration::{set,with}_color_space_name,
{set,with}_color_matrix,{set,with}_stream_nameand
{set,with}_microphone_capture_device_id,
SCScreenshotConfiguration::{set,with}_file_pathandwith_content_type,
SCRecordingOutputConfiguration::with_output_urland
SCContentSharingPickerConfiguration::set_excluded_bundle_idsreturn a
Result(InteriorNulError,InvalidScreenshotPathor
InvalidOutputPath) and leave the configuration unchanged on error. - Breaking:
SCStream::add_output_handlerand
add_output_handler_with_queuereturnResult<usize, SCError>instead of
Option<usize>,remove_output_handlerreturnsResult<bool, SCError>, and
AsyncSCStream::add_output_typereturnsResult<(), SCError>instead of
bool. - Breaking:
SCContentSharingPicker::add_observerreturns
Result<SCPickerSubscription, SCPickerConfigurationError>, andpresent,
present_using_style,present_for_stream,
present_for_stream_using_style,set_activeand
set_maximum_stream_countreturnResult<(), SCPickerConfigurationError>. - Breaking: a configuration handed to a stream, recording output,
configuration update or screenshot is copied, so later changes to it no
longer reach that work; useupdate_configurationto change a running
stream. - Breaking:
SCStreamConfiguration::set_presenter_overlay_privacy_alert_setting
returnsSCResult<&mut Self>,with_presenter_overlay_privacy_alert_setting
returnsSCResult<Self>andpresenter_overlay_privacy_alert_setting
returnsSCResult<SCPresenterOverlayAlertSetting>. Where the property
doesn't exist (before macOS 14) they returnSCError::FeatureNotAvailable
instead of ignoring the value or reportingSystem, and the getter returns
SCError::UnknownValuefor a raw value this crate doesn't know. - Breaking: the raw
cm::ffi::cv_pixel_buffer_lock_base_addressand
cv_pixel_buffer_unlock_base_addressdeclarations takeu64flags, matching
apple-cf's exports. - Breaking: getters of values ScreenCaptureKit may extend report an unknown
value instead of a default.SCStreamConfiguration::capture_dynamic_range
andcapture_resolution_type,SCContentFilter::styleandstream_type,
SCShareableContentInfo::styleandSCScreenshotConfiguration::display_intent
anddynamic_rangereturn anSCResult:SCError::UnknownValuefor a value
this crate doesn't know, andSCError::FeatureNotAvailablewhere the
property doesn't exist yet.MetalTexture::pixel_formatreturns
Result<MetalPixelFormat, MetalError>(MetalError::UnknownPixelFormat). - Breaking:
SCFrameStatushas anUnknown(i32)variant, so matches need
an arm for it andraw()replacesas i32;SCFrameStatus::from_raw
returnsSelf, andframe_status()returnsNoneonly when a sample has no
status. - Breaking:
From<i32>forSCShareableContentStyleandSCStreamType,
which mapped unknown values toNoneandWindow, is replaced by
from_raw(i32) -> Option<Self>. - Breaking: the setters of
SCStreamConfigurationproperties that need
macOS 14.0, 14.2 or 15.0 returnSCResult<&mut Self>, and their builders
SCResult<Self>, withSCError::FeatureNotAvailableon an older system:
should_be_opaque,ignores_shadow_display_configuration,
preserves_aspect_ratio,capture_resolution_type,
ignores_shadows_single_window,includes_child_windows,
captures_shadows_only,captures_microphone,
microphone_capture_device_id,stream_name,capture_dynamic_range,
shows_mouse_clicks,ignores_shadows_display,ignore_global_clip_display
andignore_global_clip_single_window, plus
clear_microphone_capture_device_id.set_stream_nameand
set_microphone_capture_device_idreport an interior NUL byte as
SCError::InvalidConfigurationinstead ofInteriorNulError. - Breaking:
SCStreamConfiguration::from_presetreturnsSCResult<Self>
(SCError::FeatureNotAvailablebefore macOS 15, or before macOS 26 for
CaptureHDRRecordingPreservedSDRHDR10), andSCContentFilterBuilder::build
returnsSCError::FeatureNotAvailablewhenwith_include_menu_barwas used
before macOS 14.2. - Breaking: the raw
ffideclarations of those setters and getters changed
to match: the setters returnbool, the enum getters write through an
*mut i32and returnbool, andcm::ffi::cm_sample_buffer_get_frame_status
does the same. rust-versionis 1.82 (was 1.76, which the crate's use ofoffset_of!
already contradicted).
Added
SCStreamErrorCode::InsufficientStorage(-3822) andNotSupported
(-3823) from the macOS 27 SDK.SCPresenterOverlayAlertSetting::from_raw, which returnsNonefor an
unknown raw value, and the samefrom_rawonSCCaptureDynamicRange,
SCCaptureResolutionType,SCShareableContentStyle,SCStreamType,
SCScreenshotDisplayIntentandSCScreenshotDynamicRange.SCError::UnknownValue { type_name, raw },MetalError::UnknownPixelFormat,
SCFrameStatus::raw, andFrom<InteriorNulError> for SCError.
Removed
- Breaking: the
try_*twins of the now-fallible APIs:
SCContentFilterBuilder::try_build,
SCContentSharingPickerConfiguration::try_new,
SCRecordingOutputConfiguration::try_new,try_set_color_space_name,
try_set_color_matrix,try_set_stream_name,
try_set_microphone_capture_device_id,try_with_output_url,
try_set_file_pathandSCStream::try_remove_output_handler. - Breaking: the
Defaultimpls ofSCContentSharingPickerConfiguration,
SCRecordingOutputConfigurationandSCScreenshotConfiguration. - Breaking: deprecated aliases: the pre-1.5
SCContentFilterBuilderand
SCShareableContentOptionsbuilder names,CMSampleBufferExt::image_buffer,
utils::completion::abandoned_context_count, and
SCStreamDelegateTrait::stream_did_stop, which the stream engine had not
called since 8.0. - Breaking:
CMSampleBufferExt::audio_buffer_listand
unsafe AudioBufferList::data_mut, replaced by apple-cf's read-only views. - Breaking: the unused raw
ffi::sc_shareable_content_get_sync
declaration and its Swift export. - Breaking: raw declarations that could not work:
cm::ffi::cv_pixel_buffer_pool_*, which no bridge exports, so any use
failed to link (usecv::CVPixelBufferPool), and
ffi::dispatch_queue_create(label, qos). Since apple-cf renamed its export
toacf_dispatch_queue_create, that declaration bound the system
dispatch_queue_create(label, attr)and passed its integer as the attribute
pointer (usedispatch_queue::DispatchQueue::new).
Full Changelog: v10.0.3...v11.0.0