styx-core
Core primitives shared across the stack: buffer pools, frame leases/layouts, bounded queues, FourCc/format types, controls, and lightweight metrics.
Documentation
Install
[]
= "0.1.0"
Modules
buffer:BufferPool,BufferLease,FrameLease, plane views, and helpers likeplane_layout_from_dims/plane_layout_with_stride.queue: bounded/newest/unbounded queues with backpressure-awareSendOutcome/RecvOutcome.format:FourCc,Resolution,MediaFormat,Interval/IntervalStepwise, andColorSpace.controls:ControlId,ControlMeta,ControlValue, and validation logic.metrics: simple hit/miss/allocation counters for pools.
Zero-copy buffers and frames
Frames are built from pooled buffers to avoid churn:
use *;
let pool = with_limits;
let res = new.unwrap;
let layout = plane_layout_from_dims;
let meta = new;
let frame = single_plane;
FrameLease exposes immutable/mutable plane views and returns buffers to the pool on drop. Use planes_mut for in-place writes; multi-plane layouts are supported via FrameLease::multi_plane.
Bounded queues
queue::bounded provides a non-blocking bounded channel:
use *;
let = ;
match tx.send
match rx.recv
Formats and controls
MediaFormat bundles FourCc, resolution, and color space; Interval describes frame pacing; ControlMeta + ControlValue carry backend controls with validation helpers.