Skip to main content

Crate rff_format

Crate rff_format 

Source
Expand description

rff-format — the container (muxer/demuxer) abstraction layer (FFmpeg’s libavformat core, minus the formats themselves).

A container is the file wrapper (AVI, MP4, Matroska, …) that interleaves one or more elementary streams. This crate defines:

  • Stream — the description of one elementary stream inside a container,
  • Demuxer — reads a container, exposing streams and Packets,
  • Muxer — writes streams + packets back into a container,
  • FormatRegistry — what individual format crates register into.

Concrete formats live in their own crates (rff-format-avi, …).

Modules§

aac
AAC configuration helpers shared by containers (MP4 esds, Matroska CodecPrivate, ADTS): the AudioSpecificConfig for AAC-LC.
av1
AV1 bitstream helpers shared by containers (MP4 av1C, Matroska CodecPrivate): locate the sequence-header OBU and build the AV1CodecConfigurationRecord around it.
avc
H.264 bitstream helpers shared by demuxers (FFmpeg’s h264_mp4toannexb bitstream filter plus a minimal SPS reader).
hvc
HEVC bitstream helpers for containers: the hvcC (HEVCDecoderConfigurationRecord, ISO/IEC 14496-15 §8.3.3) parser and builder, plus a minimal SPS reader.

Structs§

Format
Static description of a container format and its read/write support.
FormatRegistry
Holds every container format known to a running engine.
MuxCaps
What a container’s muxer will accept: the machine-readable half of the rules each muxer already enforces when it writes a header.
Stream
Description of one elementary stream within a container.

Traits§

Demuxer
Reads a container format: parses the header into Streams, then yields Packets until the input is exhausted.
Muxer
Writes a container format: declare streams, write packets, finalize.
ReadSeek
A byte source that can also seek — what a local file or an in-memory buffer offers and a pipe or socket does not. Blanket-implemented for every Read + Seek type.
WriteSeek
A byte sink that can also seek – a local file, an in-memory buffer; not a pipe or socket. Blanket-implemented for every Write + Seek type.

Type Aliases§

DemuxerFactory
Factory opening a demuxer over an input byte source.
Input
A byte source a demuxer reads from. (Box<dyn Read + Send> keeps the trait object-safe and lets inputs be files, network streams, or in-memory buffers.)
MuxerFactory
Factory opening a muxer over an output byte sink.
Output
A byte sink a muxer writes to.
PathMuxerFactory
Factory opening a muxer that owns its own file set (HLS/DASH write a playlist/manifest plus many segment files, so a single byte sink cannot model them). Receives the output path and the format options (-hls_time 6 → {"hls_time": "6"}).
ProbeFn
Content sniffer: scores how strongly a byte prefix looks like this format, 0 (no match) to 100 (certain) — mirrors FFmpeg’s AVInputFormat::read_probe.
SeekInput
A seekable Input. Formats whose index can sit anywhere in the file (MP4’s moov) use it to read only that index and fetch each payload on demand, instead of buffering the whole file. It upcasts to Input for formats that only stream.
SeekOutput
A seekable Output. Containers whose header records sizes or an index that is only known at the end (MP4 mdat/moov, Matroska Segment/Cues, AVI movi/idx1, WAV RIFF/data) use it to stream the payload as it arrives and patch the header afterwards, instead of holding the whole output in memory until the trailer (#28). It upcasts to Output for muxers that only stream.
SeekableDemuxerFactory
Factory opening a demuxer over a SeekInput — registered alongside the format’s DemuxerFactory by formats that read less when they can seek.
SeekableMuxerFactory
Factory opening a muxer over a SeekOutput – registered alongside the format’s MuxerFactory by formats that can stream when they can seek.