Skip to main content

LayerIdentity

Struct LayerIdentity 

Source
#[non_exhaustive]
pub struct LayerIdentity { pub layer_id: u16, pub view_id: Option<u16>, pub access_unit: Option<u64>, }
Expand description

Which layer / view a decoded VideoFrame belongs to.

#[non_exhaustive]: build it with new and the with_* builders, read the public fields directly. Default is the base layer with no view and no access-unit index.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§layer_id: u16

The codec’s layer identifier for the frame (H.265 / H.266 nuh_layer_id, AV1 spatial_id, …). 0 is the base layer.

§view_id: Option<u16>

The view the frame belongs to, for multi-view content (the codec’s view identifier, e.g. H.265 Annex F ViewId). None when the stream is not multi-view or the decoder does not know the mapping.

§access_unit: Option<u64>

Running index of the access unit (the set of pictures across all layers that share one presentation instant) the frame comes from, when the decoder counts them. Lets a consumer regroup the per-layer frames of one instant without relying on equal pts values. None when not tracked.

Implementations§

Source§

impl LayerIdentity

Source

pub const WIRE_LEN: usize = 13

Size in bytes of the frame side-channel encoding (to_bytes).

Source

pub const fn new(layer_id: u16) -> Self

Identity for layer_id, with no view and no access-unit index.

Source

pub const fn base() -> Self

The base layer (layer_id == 0), no view, no access unit — identical to Default.

Source

pub const fn with_view_id(self, view_id: u16) -> Self

Builder: set the view identifier.

Source

pub const fn with_access_unit(self, index: u64) -> Self

Builder: set the access-unit index.

Source

pub const fn is_base_layer(&self) -> bool

true for the base layer (layer_id == 0).

Source

pub fn to_bytes(&self) -> [u8; 13]

Fixed-size wire form used by the VideoFrame side-channel record: one flags byte (bit 0 = view_id present, bit 1 = access_unit present), then layer_id as two little-endian bytes, view_id as two (zero when absent) and access_unit as eight (zero when absent).

Source

pub fn from_bytes(bytes: &[u8]) -> Option<Self>

Inverse of to_bytes. Accepts any slice of at least WIRE_LEN bytes (extra trailing bytes are reserved and ignored); returns None for a shorter slice. Unknown flag bits are ignored.

Trait Implementations§

Source§

impl Clone for LayerIdentity

Source§

fn clone(&self) -> Self

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 LayerIdentity

Source§

impl Debug for LayerIdentity

Source§

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

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

impl Default for LayerIdentity

Source§

fn default() -> Self

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

impl Display for LayerIdentity

Source§

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

layer N, layer N view V, optionally @au A.

Source§

impl Eq for LayerIdentity

Source§

impl Hash for LayerIdentity

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for LayerIdentity

Source§

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

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.