Crate screencapturekit

Crate screencapturekit 

Source
Expand description

§ScreenCaptureKit-rs

Rust bindings for macOS ScreenCaptureKit framework.

This crate provides safe, idiomatic Rust bindings for capturing screen content, windows, and applications on macOS 12.3+.

§Features

  • Screen and window capture
  • Audio capture
  • Real-time frame processing
  • Configurable capture settings
  • Zero external dependencies (uses custom Swift bridge)

§Quick Start

use screencapturekit::prelude::*;

// Get shareable content
let content = SCShareableContent::get()?;
let display = &content.displays()[0];

// Create filter and configuration
let filter = SCContentFilter::builder()
    .display(display)
    .exclude_windows(&[])
    .build();
let mut config = SCStreamConfiguration::default();
config.set_width(1920);
config.set_height(1080);

// Create and start stream
let mut stream = SCStream::new(&filter, &config);
stream.start_capture()?;

§Module Organization

  • cm - Core Media types (CMSampleBuffer, CMTime, etc.)
  • cg - Core Graphics types (CGRect, CGSize, etc.)
  • stream - Stream configuration and management
  • shareable_content - Display and window information
  • output - Frame buffer and pixel access
  • error - Error types
  • utils - Utility functions

Re-exports§

pub use cm::codec_types;
pub use cm::media_types;
pub use cm::AudioBuffer;
pub use cm::AudioBufferList;
pub use cm::CMFormatDescription;
pub use cm::CMSampleBuffer;
pub use cm::CMSampleTimingInfo;
pub use cm::CMTime;
pub use cm::CVPixelBuffer;
pub use cm::CVPixelBufferPool;
pub use cm::IOSurface;
pub use cm::SCFrameStatus;
pub use utils::four_char_code::FourCharCode;

Modules§

async_api
Async API for ScreenCaptureKit
cg
Core Graphics types for screen coordinates and dimensions
cm
Core Media types and wrappers
content_sharing_picker
SCContentSharingPicker - UI for selecting content to share
dispatch_queue
Dispatch Queue wrapper for custom queue management
error
Error types for ScreenCaptureKit operations
ffi
Swift FFI bridge to ScreenCaptureKit
output
Frame buffer and pixel access
prelude
Prelude module for convenient imports
recording_output
SCRecordingOutput - Direct video file recording
screenshot_manager
SCScreenshotManager - Single-shot screenshot capture
shareable_content
Shareable content types - displays, windows, and applications
stream
Screen capture stream functionality
utils
Utility modules