pub struct AvcConfigurationRecord {
pub profile_idc: u8,
pub constraint_flags: u8,
pub level_idc: u8,
pub length_size: usize,
pub sequence_parameter_sets: Vec<Vec<u8>>,
pub picture_parameter_sets: Vec<Vec<u8>>,
pub chroma_format_idc: u8,
pub bit_depth_luma: u8,
pub bit_depth_chroma: u8,
}Expand description
An H.264 track’s AVCDecoderConfigurationRecord, as an MP4 avcC box or a
Matroska CodecPrivate element carries it.
The parameter sets are kept as the NAL units the record stores, header byte included and emulation prevention intact, which is the form every platform decoder takes them in. The chroma format and bit depths are read from the first sequence parameter set, not from the record’s optional High-profile extension, since a record from a Baseline or Main stream has no extension and some muxers write one that disagrees with the stream.
Fields§
§profile_idc: u8AVCProfileIndication: 66 is Baseline, 77 Main, 100 High.
constraint_flags: u8profile_compatibility, the constraint_set0..5_flag byte.
level_idc: u8AVCLevelIndication, the level times ten (31 is level 3.1).
length_size: usizeThe size in bytes of each sample’s NAL unit length prefix: 1, 2 or 4.
sequence_parameter_sets: Vec<Vec<u8>>The sequence parameter sets, as NAL units.
picture_parameter_sets: Vec<Vec<u8>>The picture parameter sets, as NAL units.
chroma_format_idc: u80 is monochrome, 1 is 4:2:0, 2 is 4:2:2 and 3 is 4:4:4, from the first sequence parameter set.
bit_depth_luma: u8bit_depth_luma_minus8 + 8, from the first sequence parameter set.
bit_depth_chroma: u8bit_depth_chroma_minus8 + 8, from the first sequence parameter set.
Implementations§
Source§impl AvcConfigurationRecord
impl AvcConfigurationRecord
Sourcepub fn parse(decoder_config: &[u8]) -> Result<AvcConfigurationRecord, Error>
pub fn parse(decoder_config: &[u8]) -> Result<AvcConfigurationRecord, Error>
Parses a complete avcC box (size and fourcc included) or its bare
payload, which begins with configurationVersion 1.
Sourcepub fn codec_string(&self) -> String
pub fn codec_string(&self) -> String
The WebCodecs codec string for this record, avc1.PPCCLL (RFC 6381
3.3): the profile, constraint flags and level as two hex digits each.
Sourcepub fn codec_profile(&self) -> Result<CodecProfile, Error>
pub fn codec_profile(&self) -> Result<CodecProfile, Error>
The normalized profile: Baseline (constrained or not), Main or High.
Every other profile - Extended, and the High 10, 4:2:2 and 4:4:4 profiles none of zvidlib’s decoders output - is reported unsupported.
Sourcepub fn is_8bit_420(&self) -> bool
pub fn is_8bit_420(&self) -> bool
Whether the stream is 8-bit 4:2:0, the only format the hardware decoders’ NV12 output carries.
Trait Implementations§
Source§impl Clone for AvcConfigurationRecord
impl Clone for AvcConfigurationRecord
Source§fn clone(&self) -> AvcConfigurationRecord
fn clone(&self) -> AvcConfigurationRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more