pub struct Decoder { /* private fields */ }Expand description
Decodes container payloads (the codec bitstream) into raw Frames.
The bring-your-own-payload layer under Consumer: use it
when the frames don’t come from a plain track subscription, e.g. a transcoder
serving individually fetched groups. Feed it the payload of each container
frame in decode order; it handles avc1/hvc1 -> Annex-B conversion, passes
AV1 OBU temporal units through, and gates output until the first keyframe.
Implementations§
Source§impl Decoder
impl Decoder
Sourcepub fn new(catalog: &VideoConfig, config: &Config) -> Result<Self, Error>
pub fn new(catalog: &VideoConfig, config: &Config) -> Result<Self, Error>
Build a decoder for the catalog’s video config. Errors if the codec is not supported by the native backends.
Sourcepub fn decode(
&mut self,
payload: &Bytes,
timestamp: Timestamp,
keyframe: bool,
) -> Result<Vec<Frame>, Error>
pub fn decode( &mut self, payload: &Bytes, timestamp: Timestamp, keyframe: bool, ) -> Result<Vec<Frame>, Error>
Decode one container frame, returning zero or more raw frames. timestamp is
this frame’s presentation time; it rides through the decoder and comes back on
each output frame, so a reordering decoder (B-frames) stamps every picture
with its own presentation time rather than this access unit’s. With no
reordering the two coincide.