Skip to main content

AvcConfigurationRecord

Struct AvcConfigurationRecord 

Source
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: u8

AVCProfileIndication: 66 is Baseline, 77 Main, 100 High.

§constraint_flags: u8

profile_compatibility, the constraint_set0..5_flag byte.

§level_idc: u8

AVCLevelIndication, the level times ten (31 is level 3.1).

§length_size: usize

The 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: u8

0 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: u8

bit_depth_luma_minus8 + 8, from the first sequence parameter set.

§bit_depth_chroma: u8

bit_depth_chroma_minus8 + 8, from the first sequence parameter set.

Implementations§

Source§

impl AvcConfigurationRecord

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> AvcConfigurationRecord

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AvcConfigurationRecord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for AvcConfigurationRecord

Source§

impl PartialEq for AvcConfigurationRecord

Source§

fn eq(&self, other: &AvcConfigurationRecord) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AvcConfigurationRecord

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.