Skip to main content

Crate decode

Crate decode 

Source
Expand description

decode — video decode → BGRA frames, trait-based.

§Why a trait

The recorder decodes MP4s through GStreamer today (the workspace’s single media stack — see CLAUDE.md “Stack” section and AUT-144). Multiple backends still exist as a contract: the gstreamer_pipe CLI-subprocess implementation, a future in-process gstreamer-rs bindings implementation for encode (appsrc-fed), and the mock deterministic test source. The consumer (wisp’s VideoTexture::upload_bgra path) is uniform: it wants a stream of BGRA frames at known dimensions, ticked at known timestamps.

VideoStream is that uniform contract. Any implementation can be swapped in at runtime without changing the player loop.

§Layers

  • VideoStream — pull-based interface returning VideoFrame values.
  • mock::MockVideoStream — deterministic test source. No external deps; useful for tests and as the harness target for examples until M-DEC.2 wires in a real codec.

§Quick start

use decode::{VideoFrame, VideoStream, mock::MockVideoStream};

let mut stream = MockVideoStream::scrolling_gradient(64, 36, 8);
let frame: VideoFrame = stream.next_frame().expect("first frame");
assert_eq!(frame.width, 64);
assert_eq!(frame.bgra.len(), (64 * 36 * 4) as usize);

Re-exports§

pub use editor_stream::EditorVideoStream;

Modules§

editor_stream
Random-access decode for the editor (ED.3 / M-EDIT).
gstreamer_pipe
Real video decode via the gst-launch-1.0 and gst-discoverer-1.0 CLIs.
mock
Deterministic mock video sources.

Structs§

VideoFrame
One decoded frame in BGRA8 layout, the canonical wgpu input format for per-frame texture uploads.

Traits§

VideoStream
Pull-based source of decoded video frames.