Skip to main content

Crate warb

Crate warb 

Source
Expand description

Unofficial Rust bindings for the Blackmagic RAW SDK on Linux. Not affiliated with or endorsed by Blackmagic Design.

The crate exposes a low-level, handle-based mirror of the SDK’s C++ interfaces (Codec, Clip, Frame, ProcessedImage, Job) plus a Callback trait that receives the SDK’s asynchronous callbacks. A small high-level Decoder is layered on top for single-frame synchronous decode; anything more sophisticated (pipelining, batching, GPU backends) is the caller’s to build.

At runtime libBlackmagicRawAPI.so is loaded via dlopen; set BRAW_RUNTIME_DIR or place it on the default loader search path.

Structs§

BrawError
Error type for the crate. Wraps SDK failure messages, path conversion errors, and invariant violations in a single stringly-typed variant — there isn’t much the caller can discriminate on that isn’t already in the message.
Clip
An opened .braw clip. Metadata getters are cheap; frame reads are asynchronous via create_read_job.
Codec
The decoder codec, owning the SDK factory, codec, and callback dispatcher. Drop order handles SDK teardown safely.
Decoder
High-level synchronous decoder: one frame in, bytes out. Built on top of the low-level primitives; see the crate-level docs for pipelining.
Frame
A frame as received in on_read_complete — bitstream loaded, not yet decoded. Configure its output format, then create a decode+process job.
HResult
BMD HRESULT code, surfaced to callbacks. is_ok() iff >= 0 per standard COM convention.
Job
A queued-but-not-yet-submitted job. Calling submit consumes the handle (the SDK takes ownership internally).
ProcessedImage
A fully-decoded image received via on_process_complete. Metadata (width, height, format, size) is queried from the SDK once at construction and cached; subsequent calls are free.

Enums§

Pipeline
Decode pipeline backend. CPU is always available on Linux.
ResolutionScale
Decode scale. Smaller scales produce smaller output buffers and faster decodes (manual p.23, p.77). Some BRAW variants silently clamp Eighth to Quarter; always trust ProcessedImage::width()/height() over divisor for actual output dimensions.
ResourceFormat
Output pixel format. Values are the SDK’s FourCC tags (manual p.22).

Traits§

Callback
Async-callback receiver. Implementations typically forward events to a channel or atomic slot. Methods take &self; use interior mutability (mpsc::Sender, AtomicU64, Mutex, …) if you need to mutate.