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, CMTime, SCFrameStatus};
fn process_frame(sample: CMSampleBuffer) {
// Check frame status
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());
}
}
}
}Re-exports§
pub use iosurface::IOSurface;pub use iosurface::IOSurfaceLockGuard;pub use iosurface::IOSurfaceLockOptions;pub use iosurface::PlaneProperties;
Modules§
- codec_
types - Common codec type constants
- ffi
- Raw FFI bindings for Core Media types.
- iosurface
IOSurface- Hardware-accelerated surface- 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 - CMSample
Buffer - Opaque handle to
CMSampleBuffer - CMSample
Timing Info - Sample timing information
- CMTime
CMTimerepresentation matching Core Media’sCMTime
Enums§
- SCFrame
Status - Frame status for captured screen content