Expand description
Core Media types and wrappers
This module provides Rust wrappers for Core Media framework types used in screen capture operations.
§Main Types
CMSampleBuffer- Container for media samples (audio/video frames)CMTime- Time value with rational timescale for precise timingIOSurface- Hardware-accelerated surface for zero-copy GPU accessCMBlockBuffer- Block of contiguous data (audio/compressed video)AudioBuffer- Audio data buffer with sample dataAudioBufferList- Collection of audio buffers for multi-channel audioSCFrameStatus- Status of a captured frame (complete, idle, dropped, etc.)
§Example
use screencapturekit::cm::{CMSampleBuffer, CMSampleBufferExt, CMSampleBufferSCExt, CMTime, SCFrameStatus};
fn process_frame(sample: CMSampleBuffer) {
// Check frame status (SCStream-specific attachment).
if sample.frame_status() == Some(SCFrameStatus::Complete) {
// Get timestamp.
let pts = sample.presentation_timestamp();
println!("Frame at {:?}", pts);
// Access pixel buffer for CPU processing.
if let Some(pixel_buffer) = sample.image_buffer() {
// Access IOSurface for GPU processing.
if let Some(surface) = pixel_buffer.io_surface() {
println!("Surface: {}x{}", surface.width(), surface.height());
}
}
}
}Modules§
- codec_
types - Common codec type constants
- ffi
- Raw FFI bindings for Core Media types.
- iosurface
IOSurface— re-exported fromapple-cfso all doom-fish crates share one canonicalIOSurfacetype.- media_
types - Common media type constants
Structs§
- Audio
Buffer - Raw audio buffer containing sample data
- Audio
Buffer List - List of audio buffers from an audio sample
- Audio
Buffer List Iter - Iterator over audio buffers in an
AudioBufferList - Audio
Buffer List Raw - List of audio buffers from an audio sample
- Audio
Buffer Ref - Reference to an audio buffer with convenience methods
- CMBlock
Buffer - Block buffer containing contiguous media data
- CMClock
CMClockwrapper for synchronization clock- CMFormat
Description - Owned wrapper around
CMFormatDescriptionRef. - CMSample
Buffer - Re-exported
CMSampleBuffer— same opaque-pointer wrapper used across the doom-fish suite. Owned reference to aCoreMediaCMSampleBufferRef. - CMSample
Timing Info - Sample timing information
- CMTime
CMTimerepresentation matching Core Media’sCMTime- Frame
Info - Snapshot of every
SCStreamFrameInfoattachment on a sample buffer. - IOSurface
- Hardware-accelerated surface for efficient frame delivery
- IOSurface
Lock Guard - RAII guard for locked
IOSurface - IOSurface
Lock Options - Lock options for
IOSurface - Plane
Properties - Properties for a single plane in a multi-planar
IOSurface
Enums§
- SCFrame
Status - Frame status for captured screen content
Traits§
- CMSample
Buffer Data Buffer Ext - Convenience: like
apple_cf::cm::CMSampleBuffer::data_bufferbut returns the localcrate::cm::CMBlockBuffer(which is currently a different wrapper around the same underlying type). - CMSample
Buffer Ext - Extension trait carrying generic
CMSampleBufferaccessors that aren’t available onapple_cf::cm::CMSampleBufferyet (planned for anapple-cfv0.2 release). - CMSample
BufferSC Ext - Extension trait that exposes
SCStreamFrameInfoattachment accessors on anyCMSampleBufferproduced byScreenCaptureKit.