Skip to main content

Vp9CodecConfig

Struct Vp9CodecConfig 

Source
pub struct Vp9CodecConfig {
    pub profile: u8,
    pub level: u8,
    pub bit_depth: u8,
    pub chroma_subsampling: u8,
    pub video_full_range: bool,
    pub color_primaries: u8,
    pub transfer_characteristics: u8,
    pub matrix_coefficients: u8,
}
Expand description

A VP9 stream’s codec configuration: what an MP4 vpcC box or a WebM CodecPrivate element says about it.

The VP9 bitstream describes itself, so this is a summary for capability discovery and codec strings rather than something decoding needs. The vpcC box is version 1 of the VP Codec ISO Media File Format Binding (VPCodecConfigurationRecord); version 0, an earlier draft some muxers still write, is read as well. WebM’s CodecPrivate is the optional list of (ID, length, value) features of the WebM VP9 codec mapping, of which profile (1), level (2), bit depth (3) and chroma subsampling (4) are defined; any it leaves out take the profile 0 defaults.

Fields§

§profile: u8§level: u8

The VP9 level times ten (31 is level 3.1), or 0 when unspecified.

§bit_depth: u8§chroma_subsampling: u8

0 and 1 are 4:2:0 (vertical and colocated chroma), 2 is 4:2:2 and 3 is 4:4:4.

§video_full_range: bool§color_primaries: u8

ISO/IEC 23091-2 color description; 2 means unspecified.

§transfer_characteristics: u8§matrix_coefficients: u8

Implementations§

Source§

impl Vp9CodecConfig

Source

pub fn parse(bytes: &[u8]) -> Result<Vp9CodecConfig, Error>

Reads a complete vpcC box (size, type and payload) or, when the bytes are not one, a WebM CodecPrivate. Empty bytes are an empty CodecPrivate.

Source

pub fn parse_vpcc(whole: &[u8]) -> Result<Vp9CodecConfig, Error>

Reads a complete vpcC box.

Source

pub fn parse_webm_codec_private(bytes: &[u8]) -> Result<Vp9CodecConfig, Error>

Reads a WebM VP9 CodecPrivate.

Source

pub fn is_420(&self) -> bool

Whether the stream is 4:2:0.

Source

pub fn codec_profile(&self) -> Result<CodecProfile, Error>

The normalized profile.

Source

pub fn to_vpcc(&self) -> Vec<u8> ⓘ

The complete version 1 vpcC box describing this configuration, with no codec initialization data.

Source

pub fn codec_string(&self) -> String

The vp09.PP.LL.DD codec string of the VP9 ISO-BMFF binding, which WebCodecs and MediaSource accept. An unspecified or invalid level is written as level 1.0, since the string requires one.

Trait Implementations§

Source§

impl Clone for Vp9CodecConfig

Source§

fn clone(&self) -> Vp9CodecConfig

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 Copy for Vp9CodecConfig

Source§

impl Debug for Vp9CodecConfig

Source§

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

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

impl Default for Vp9CodecConfig

Source§

fn default() -> Vp9CodecConfig

Returns the “default value” for a type. Read more
Source§

impl Eq for Vp9CodecConfig

Source§

impl PartialEq for Vp9CodecConfig

Source§

fn eq(&self, other: &Vp9CodecConfig) -> 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 Vp9CodecConfig

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.