pub struct AvcConfig {
pub nal_length_size: usize,
pub sps: Vec<Vec<u8>>,
pub pps: Vec<Vec<u8>>,
}codec-h264 and codec only.Expand description
Parsed AVC decoder configuration (the avcC record from a video sequence
header / AVCDecoderConfigurationRecord), retaining the parameter sets needed
to (a) build Annex-B config for a decoder and (b) self-contain each keyframe.
Lives in the codec layer (not a protocol module) so every consumer — the RTMP FLV path, the transcode pipeline, and any host — shares one parser.
Fields§
§nal_length_size: usizeNAL length prefix width in bytes (lengthSizeMinusOne + 1).
sps: Vec<Vec<u8>>Sequence parameter sets.
pps: Vec<Vec<u8>>Picture parameter sets.
Implementations§
Source§impl AvcConfig
impl AvcConfig
Sourcepub fn parse(rec: &[u8]) -> Option<Self>
pub fn parse(rec: &[u8]) -> Option<Self>
Parse an AVCDecoderConfigurationRecord (avcC). Returns None if the
buffer is too short or its configurationVersion is not 1.
Sourcepub fn to_annexb(&self) -> Bytes
pub fn to_annexb(&self) -> Bytes
The SPS/PPS as an Annex-B access unit (each NAL prefixed with 00 00 00 01).
Sourcepub fn to_avc_record(&self) -> Bytes
pub fn to_avc_record(&self) -> Bytes
Rebuild an AVCDecoderConfigurationRecord from the stored parameter sets
(used when serving a play request).