Skip to content

v11.0.0

Choose a tag to compare

@1313 1313 released this 24 Sep 22:29
· 11 commits to main since this release

Security

  • SCStreamConfiguration, SCRecordingOutputConfiguration and
    SCScreenshotConfiguration are mutable Objective-C objects, and the bridge
    handed the caller's own object to work that outlives the call: the Task
    behind every screenshot and update_configuration (which keeps running after
    a synchronous wait times out or an async future is dropped) and the
    framework objects behind SCStream::new and SCRecordingOutput::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, an assign property, 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::identity built its StreamIdentity with
    NonZeroUsize::new_unchecked although 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/height and SCWindow.windowLayer, the
    UInt32(len) and offset arithmetic of the batched shareable-content string
    buffers, and the UInt32(_:) conversion of picker excludedWindowIDs.
  • A large SCREENCAPTUREKIT_COMPLETION_TIMEOUT_SECS made 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 the Default impls 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 that ScreenCaptureKit refused, and picker operations below
    macOS 14. See Changed.
  • The cm audio 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=1 is set, so
    a plain cargo test never captures the screen, and even then they check
    CGPreflightScreenCaptureAccess and skip without Screen Recording
    permission instead of raising the permission prompt or failing. The live
    recording tests write under target/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.dylib through /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
    Swift Int where Rust passed and read an i32, and the raw
    cm::ffi::cv_pixel_buffer_{lock,unlock}_base_address declarations passed
    u32 flags to apple-cf exports that take UInt64. The presenter overlay
    exports now use Int32; the setter rejects raw values that are not a known
    SCPresenterOverlayAlertSetting instead of ignoring them, and the getter
    hands the raw value to Rust instead of mapping unknown values to System.
  • Values ScreenCaptureKit reports that this crate doesn't know were replaced
    by a default: capture_dynamic_range read them as SDR,
    capture_resolution_type as Automatic, the filter and content-info
    style as None, stream_type as Window, MetalTexture::pixel_format
    as BGRA8Unorm, the screenshot display_intent and dynamic_range as
    None, and frame_status as "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: every SCStreamConfiguration property that needs
    macOS 14.0, 14.2 or 15.0 and SCContentFilterBuilder::with_include_menu_bar
    (14.2). from_preset returned a configuration without the preset before
    macOS 15, and used CaptureHDRStreamLocalDisplay instead of the macOS 26
    HDR10 recording preset before macOS 26. See Changed.
  • Docs: SCStream had lost its rustdoc to StreamIdentity; 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 the audio-input entitlement to system
    audio instead of microphone capture and pointed at files that don't exist.

Changed

  • Breaking: requires apple-cf >=0.11, <0.12 and
    apple-metal >=0.10, <0.11. Their breaking changes reach callers through the
    re-exported cg, cm, cv, dispatch_queue and apple_metal modules; for
    example CMBlockBuffer::as_slice and cursor_ref are unsafe.
  • 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_delegate and
    AsyncSCStream::new return SCResult<Self>. AsyncSCStream::new also
    returns the output-handler registration error instead of a stream whose
    queue is already closed.
  • Breaking: SCContentFilterBuilder::build returns
    SCResult<SCContentFilter> (SCError::InvalidConfiguration without a
    display or window).
  • Breaking: SCContentSharingPickerConfiguration::new and
    default_from_system, SCContentSharingPicker::default_configuration,
    SCRecordingOutputConfiguration::new and SCScreenshotConfiguration::new
    return Result<_, SCError> with SCError::FeatureNotAvailable on an older
    macOS.
  • Breaking: SCStreamConfiguration::{set,with}_color_space_name,
    {set,with}_color_matrix, {set,with}_stream_name and
    {set,with}_microphone_capture_device_id,
    SCScreenshotConfiguration::{set,with}_file_path and with_content_type,
    SCRecordingOutputConfiguration::with_output_url and
    SCContentSharingPickerConfiguration::set_excluded_bundle_ids return a
    Result (InteriorNulError, InvalidScreenshotPath or
    InvalidOutputPath) and leave the configuration unchanged on error.
  • Breaking: SCStream::add_output_handler and
    add_output_handler_with_queue return Result<usize, SCError> instead of
    Option<usize>, remove_output_handler returns Result<bool, SCError>, and
    AsyncSCStream::add_output_type returns Result<(), SCError> instead of
    bool.
  • Breaking: SCContentSharingPicker::add_observer returns
    Result<SCPickerSubscription, SCPickerConfigurationError>, and present,
    present_using_style, present_for_stream,
    present_for_stream_using_style, set_active and
    set_maximum_stream_count return Result<(), 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; use update_configuration to change a running
    stream.
  • Breaking: SCStreamConfiguration::set_presenter_overlay_privacy_alert_setting
    returns SCResult<&mut Self>, with_presenter_overlay_privacy_alert_setting
    returns SCResult<Self> and presenter_overlay_privacy_alert_setting
    returns SCResult<SCPresenterOverlayAlertSetting>. Where the property
    doesn't exist (before macOS 14) they return SCError::FeatureNotAvailable
    instead of ignoring the value or reporting System, and the getter returns
    SCError::UnknownValue for a raw value this crate doesn't know.
  • Breaking: the raw cm::ffi::cv_pixel_buffer_lock_base_address and
    cv_pixel_buffer_unlock_base_address declarations take u64 flags, matching
    apple-cf's exports.
  • Breaking: getters of values ScreenCaptureKit may extend report an unknown
    value instead of a default. SCStreamConfiguration::capture_dynamic_range
    and capture_resolution_type, SCContentFilter::style and stream_type,
    SCShareableContentInfo::style and SCScreenshotConfiguration::display_intent
    and dynamic_range return an SCResult: SCError::UnknownValue for a value
    this crate doesn't know, and SCError::FeatureNotAvailable where the
    property doesn't exist yet. MetalTexture::pixel_format returns
    Result<MetalPixelFormat, MetalError> (MetalError::UnknownPixelFormat).
  • Breaking: SCFrameStatus has an Unknown(i32) variant, so matches need
    an arm for it and raw() replaces as i32; SCFrameStatus::from_raw
    returns Self, and frame_status() returns None only when a sample has no
    status.
  • Breaking: From<i32> for SCShareableContentStyle and SCStreamType,
    which mapped unknown values to None and Window, is replaced by
    from_raw(i32) -> Option<Self>.
  • Breaking: the setters of SCStreamConfiguration properties that need
    macOS 14.0, 14.2 or 15.0 return SCResult<&mut Self>, and their builders
    SCResult<Self>, with SCError::FeatureNotAvailable on 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
    and ignore_global_clip_single_window, plus
    clear_microphone_capture_device_id. set_stream_name and
    set_microphone_capture_device_id report an interior NUL byte as
    SCError::InvalidConfiguration instead of InteriorNulError.
  • Breaking: SCStreamConfiguration::from_preset returns SCResult<Self>
    (SCError::FeatureNotAvailable before macOS 15, or before macOS 26 for
    CaptureHDRRecordingPreservedSDRHDR10), and SCContentFilterBuilder::build
    returns SCError::FeatureNotAvailable when with_include_menu_bar was used
    before macOS 14.2.
  • Breaking: the raw ffi declarations of those setters and getters changed
    to match: the setters return bool, the enum getters write through an
    *mut i32 and return bool, and cm::ffi::cm_sample_buffer_get_frame_status
    does the same.
  • rust-version is 1.82 (was 1.76, which the crate's use of offset_of!
    already contradicted).

Added

  • SCStreamErrorCode::InsufficientStorage (-3822) and NotSupported
    (-3823) from the macOS 27 SDK.
  • SCPresenterOverlayAlertSetting::from_raw, which returns None for an
    unknown raw value, and the same from_raw on SCCaptureDynamicRange,
    SCCaptureResolutionType, SCShareableContentStyle, SCStreamType,
    SCScreenshotDisplayIntent and SCScreenshotDynamicRange.
  • SCError::UnknownValue { type_name, raw }, MetalError::UnknownPixelFormat,
    SCFrameStatus::raw, and From<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_path and SCStream::try_remove_output_handler.
  • Breaking: the Default impls of SCContentSharingPickerConfiguration,
    SCRecordingOutputConfiguration and SCScreenshotConfiguration.
  • Breaking: deprecated aliases: the pre-1.5 SCContentFilterBuilder and
    SCShareableContentOptions builder 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_list and
    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 (use cv::CVPixelBufferPool), and
    ffi::dispatch_queue_create(label, qos). Since apple-cf renamed its export
    to acf_dispatch_queue_create, that declaration bound the system
    dispatch_queue_create(label, attr) and passed its integer as the attribute
    pointer (use dispatch_queue::DispatchQueue::new).

Full Changelog: v10.0.3...v11.0.0