pub struct NalSampleWriter {
pub vps: Vec<Vec<u8>>,
pub sps: Vec<Vec<u8>>,
pub pps: Vec<Vec<u8>>,
/* private fields */
}Expand description
Repackages Annex-B encoder frames into length-prefixed mdat samples while
collecting the parameter sets for the avcC/hvcC config box.
Two modes:
- out-of-band (default): SPS/PPS/VPS are stripped from samples and stored
in the config box. Correct for a single encoder (
avc1/hvc1). - inline ([
new_inline]): SPS/PPS/VPS are ALSO kept inline in each access unit (each IDR self-describes). Used by the multi-GPU stitch, where chunks come from independent encoders (possibly different vendors): the inline parameter sets let each chunk decode with its own SPS/PPS even if they differ cosmetically. Pairs with theavc3/hev1sample entry. The config box still gets the FIRST set as a default hint.
Fields§
§vps: Vec<Vec<u8>>HEVC VPS NAL units (empty for H.264), first-seen order, de-duplicated.
sps: Vec<Vec<u8>>§pps: Vec<Vec<u8>>Implementations§
Source§impl NalSampleWriter
impl NalSampleWriter
pub fn new(codec: NalMuxCodec) -> Self
Sourcepub fn new_inline(codec: NalMuxCodec) -> Self
pub fn new_inline(codec: NalMuxCodec) -> Self
Inline-parameter-set mode (for the multi-GPU stitch). Keeps SPS/PPS/VPS inline in each access unit AND records the first set for the config box.
Sourcepub fn push_packet(&mut self, annexb: &[u8]) -> Vec<AuSample>
pub fn push_packet(&mut self, annexb: &[u8]) -> Vec<AuSample>
Convert one encoder packet — which may carry multiple access units (HW encoders return several frames per buffer) — into one length-prefixed mdat sample per access unit. Access units are delimited by the AUD NAL (a packet with no AUD is treated as one unit). SPS/PPS/VPS are captured (for the config box) and stripped from samples.
Sourcepub fn has_param_sets(&self) -> bool
pub fn has_param_sets(&self) -> bool
Whether the parameter sets needed for the config box have been seen.