forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiBc1b62f2Tahinli2 months ago3587 commits

lib.rs50 lines, 2.1 KiBHistoryRawDownload
1//! The intermediate representation every edith_codecs crate is built on.
2//!
3//! One vocabulary spans demux, decode, encode and mux: a [`Packet`] of
4//! compressed bytes, a [`Frame`] of decoded samples, a [`CodecId`] naming what
5//! turns one into the other, [`CodecParameters`] describing a stream before its
6//! first packet, and a rational [`TimeBase`] that keeps `24000/1001` exact from
7//! the container to the muxer. [`bitio`] holds the one bit reader/writer pair
8//! the parsers share, and [`color`] the H.273 meaning behind [`ColorInfo`]'s raw
9//! code points — including the HDR mastering/content-light a tone map needs.
10//!
11//! Contracts worth knowing before implementing against this crate:
12//!
13//! - Timing is integer. `f64` appears only in `as_secs_f64` helpers, for
14//! display, and never flows back into a timestamp.
15//! - Truncated input is [`Error::NeedMore`], not a panic; a refusal is
16//! [`Error::Unsupported`] and always names *what* and *why*.
17//! - Codecs are push/pull ([`Decoder::send_packet`] / [`Decoder::receive_frame`]),
18//! because packets and frames do not correspond one to one.
19//! - Payloads are [`Buf`], a refcounted byte range: cloning a packet or sharing
20//! a plane is a refcount bump, not a copy.
21//!
22//! No async, no unsafe, no external dependencies.
23
24#![forbid(unsafe_code)]
25#![warn(missing_docs)]
26
27pub mod bitio;
28pub mod color;
29pub mod error;
30pub mod frame;
31pub mod packet;
32pub mod registry;
33pub mod timebase;
34
35pub use bitio::{BitReader, BitReaderLsb, BitWriter, BitWriterLsb};
36pub use color::{
37 ColorDescription, ContentLight, Matrix, Primaries, Tags, Transfer, bitstream_tags,
38 hevc_sei_light,
39};
40pub use error::{Error, Result};
41pub use frame::{
42 AudioFrame, ChannelLayout, ChannelPosition, ColorInfo, Frame, PixelFormat, Plane, SampleFormat,
43 VideoFrame,
44};
45pub use packet::{Buf, Packet, PacketFlags, SideData};
46pub use registry::{
47 AudioParameters, CodecId, CodecParameters, Decoder, Demuxer, Encoder, MediaParameters,
48 MediaType, Muxer, Rotation, SeekMode, StreamInfo, VideoParameters,
49};
50pub use timebase::{Rounding, TimeBase, Timestamp};