Skip to main content

Module demuxer

Module demuxer 

Source
Expand description

The demux tier — the track table, the five-arm packet envelope, and the Demuxer session face.

A container file is a bundle of tracks; reading it produces a single interleaved stream of packets, each belonging to one track. This module names both halves: TrackInfo describes a track, DemuxedPacket delivers one packet with its track coordinate attached, and Demuxer is the pull session that hands them out.

§The session is pull-style

The caller owns the loop. Demuxer::next_packet returns the next packet in interleaved file order and Ok(None) at end of file. One packet is in hand at a time, whatever the file’s length, and the caller pulls only when it is ready to consume — backpressure with no machinery. This is the same rhythm the decoder faces already keep (the caller schedules; see crate::decoder).

§Construction is not on the trait

Demuxer covers the opened session only: tracks, next_packet, seek. Opening is each backend’s own business and each backend’s is different — FFmpeg opens from a path or from a Read + Seek reader, a WebAssembly container parser opens from a byte slice. Putting a constructor on the trait would force one of those spellings onto all of them, which is exactly what the decoder traits already decline to do.

§Not every backend is a demuxer

R3D and BRAW are clip-oriented SDKs: they expose frames by index, never packets, so there is nothing for them to demux. They deliberately do not implement this trait and join a pipeline one tier up, through crate::decoder::VideoFrameSource and crate::decoder::AudioFrameSource. A graph that wants both shapes unifies them at the frame tier, not here.

Structs§

AttachmentPacket
An attachment packet — a whole file carried inside the container.
AttachmentTrackPacket
Payload for DemuxedPacket::Attachment.
AttachmentTrackParams
Payload for TrackParams::Attachment.
AudioTrackPacket
Payload for DemuxedPacket::Audio.
AudioTrackParams
Payload for TrackParams::Audio.
DataPacket
A timed opaque-data packet — timecode, KLV, timed ID3.
DataTrackPacket
Payload for DemuxedPacket::Data.
DataTrackParams
Payload for TrackParams::Data.
SubtitleTrackPacket
Payload for DemuxedPacket::Subtitle.
SubtitleTrackParams
Payload for TrackParams::Subtitle.
TrackIndex
A track’s position in the table Demuxer::tracks returns.
TrackInfo
One row of the track table Demuxer::tracks returns.
UnknownTrackParams
Payload for TrackParams::Unknown.
VideoTrackPacket
Payload for DemuxedPacket::Video.
VideoTrackParams
Payload for TrackParams::Video.

Enums§

DemuxedPacket
One demuxed packet, with the track it came from.
TrackKind
What a track carries.
TrackParams
A track’s codec and per-kind parameters.

Traits§

DemuxAdapter
Backend vocabulary for the demux tier.
Demuxer
An opened container session: the track table, a pull loop, and a seek.

Type Aliases§

DemuxAttachmentPacket
The AttachmentPacket a DemuxAdapter delivers over buffer D.
DemuxAudioPacket
The AudioPacket a DemuxAdapter delivers over buffer D.
DemuxDataPacket
The DataPacket a DemuxAdapter delivers over buffer D.
DemuxSubtitlePacket
The SubtitlePacket a DemuxAdapter delivers over buffer D.
DemuxVideoPacket
The VideoPacket a DemuxAdapter delivers over buffer D.