Skip to main content

zencodec_media/
lib.rs

1//! Media contracts for zen codecs: what a video (and later audio) codec, a
2//! container and a pipeline say to each other.
3//!
4//! `no_std + alloc`, no I/O, no async, no codec implementations. The image
5//! contract in [`zencodec`] stays as it is; this crate adds the pieces video
6//! needs and reuses the image side's shapes wherever they fit:
7//!
8//! - [`packet`]: compressed access units with optional timestamps, container
9//!   random-access evidence and configuration epochs.
10//! - [`track`]: codec identity separate from the container, validated track
11//!   descriptions.
12//! - [`frame`]: decoded frames as owned, refcounted handles over backend
13//!   pictures, with planar views and an immutable per-frame interpretation.
14//! - [`session`]: codec sessions with explicit backpressure (`send` /
15//!   `receive`), drain at end of input, and discard-only reset.
16//! - [`container`]: a sans-I/O [`Demuxer`](container::Demuxer) speaking the
17//!   image decoders' `Input`/`InputRequest` dialogue (so every `zencodec-io`
18//!   driver serves it), and a [`Muxer`](container::Muxer) whose bytes are
19//!   pulled like a streaming image encoder's.
20//! - [`adapt`]: the animation traits as a layer over demuxer + decoder and
21//!   encoder + muxer.
22//!
23//! Time comes from [`zencodec::time`]. Design and rationale:
24//! `docs/media-design.md` in the repository; the rules every implementation
25//! follows: `docs/media-contract.md`.
26#![no_std]
27#![forbid(unsafe_code)]
28
29extern crate alloc;
30#[cfg(feature = "std")]
31extern crate std;
32
33pub mod adapt;
34pub mod container;
35pub mod frame;
36pub mod limits;
37/// Checked synchronous output drivers (requires `std`).
38#[cfg(feature = "std")]
39pub mod output;
40pub mod packet;
41pub mod policy;
42pub mod session;
43/// Owned finite video encoding with admitted compressed staging (requires `std`).
44#[cfg(feature = "std")]
45pub mod staged;
46/// Explicit memory/disk compressed packet staging (requires `std`).
47#[cfg(feature = "std")]
48pub mod staging;
49pub mod track;