Skip to main content

Module cm

Module cm 

Source
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 timing
  • IOSurface - Hardware-accelerated surface for zero-copy GPU access
  • CMBlockBuffer - Block of contiguous data (audio/compressed video)
  • AudioBuffer - Audio data buffer with sample data
  • AudioBufferList - Collection of audio buffers for multi-channel audio
  • SCFrameStatus - 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 from apple-cf so all doom-fish crates share one canonical IOSurface type.
media_types
Common media type constants

Structs§

AudioBuffer
Raw audio buffer containing sample data
AudioBufferList
List of audio buffers from an audio sample
AudioBufferListIter
Iterator over audio buffers in an AudioBufferList
AudioBufferListRaw
List of audio buffers from an audio sample
AudioBufferRef
Reference to an audio buffer with convenience methods
CMBlockBuffer
Block buffer containing contiguous media data
CMClock
CMClock wrapper for synchronization clock
CMFormatDescription
Owned wrapper around CMFormatDescriptionRef.
CMSampleBuffer
Re-exported CMSampleBuffer — same opaque-pointer wrapper used across the doom-fish suite. Owned reference to a CoreMedia CMSampleBufferRef.
CMSampleTimingInfo
Sample timing information
CMTime
CMTime representation matching Core Media’s CMTime
FrameInfo
Snapshot of every SCStreamFrameInfo attachment on a sample buffer.
IOSurface
Hardware-accelerated surface for efficient frame delivery
IOSurfaceLockGuard
RAII guard for locked IOSurface
IOSurfaceLockOptions
Lock options for IOSurface
PlaneProperties
Properties for a single plane in a multi-planar IOSurface

Enums§

SCFrameStatus
Frame status for captured screen content

Traits§

CMSampleBufferDataBufferExt
Convenience: like apple_cf::cm::CMSampleBuffer::data_buffer but returns the local crate::cm::CMBlockBuffer (which is currently a different wrapper around the same underlying type).
CMSampleBufferExt
Extension trait carrying generic CMSampleBuffer accessors that aren’t available on apple_cf::cm::CMSampleBuffer yet (planned for an apple-cf v0.2 release).
CMSampleBufferSCExt
Extension trait that exposes SCStreamFrameInfo attachment accessors on any CMSampleBuffer produced by ScreenCaptureKit.