Skip to main content

DependencyDescriptor

Struct DependencyDescriptor 

Source
pub struct DependencyDescriptor {
    pub start_of_frame: bool,
    pub end_of_frame: bool,
    pub frame_number: u16,
    pub template_id: u8,
    pub attached_structure: Option<FrameDependencyStructure>,
    pub active_decode_targets_bitmask: Option<u32>,
    pub spatial_id: u8,
    pub temporal_id: u8,
    pub dtis: Vec<DecodeTargetIndication>,
    pub fdiffs: Vec<u16>,
    pub chain_fdiffs: Vec<u8>,
    pub resolution: Option<RenderResolution>,
}
Expand description

One Dependency Descriptor: what one RTP packet says about its frame (AV1 RTP specification A.8).

The fields from spatial_id on are the frame dependency definition. On the wire they are taken from the template template_id names unless the descriptor overrides them; here they always hold the frame’s own values, and DependencyDescriptor::marshal works out which of them need the custom fields.

Fields§

§start_of_frame: bool

start_of_frame: the packet’s payload begins a frame.

§end_of_frame: bool

end_of_frame: the packet is the last of its frame.

§frame_number: u16

frame_number: the same on every packet of a frame, one more for each frame in decode order, wrapping after 65535.

§template_id: u8

frame_dependency_template_id: the template the frame uses, the same on every packet of the frame.

§attached_structure: Option<FrameDependencyStructure>

The structure this packet carries (template_dependency_structure): on the first packet of a coded video sequence, and on no other.

§active_decode_targets_bitmask: Option<u32>

active_decode_targets_bitmask, when the packet carries one: bit i is set when decode target i is available. A packet with a structure and without a bitmask means all of them are.

§spatial_id: u8

The frame’s spatial layer (FrameSpatialId).

§temporal_id: u8

The frame’s temporal layer (FrameTemporalId).

§dtis: Vec<DecodeTargetIndication>

frame_dti: the frame’s indication for each decode target.

§fdiffs: Vec<u16>

FrameFdiff: for each frame this one refers to, how many frame numbers back it is (1 to 4096).

§chain_fdiffs: Vec<u8>

frame_chain_fdiff: for each chain, how many frame numbers back the previous frame of the chain is; 0 when no earlier frame is needed.

§resolution: Option<RenderResolution>

FrameMaxWidth / FrameMaxHeight, when the structure has resolutions. Derived when reading; not written.

Implementations§

Source§

impl DependencyDescriptor

Source

pub fn from_template( structure: &FrameDependencyStructure, template_index: usize, frame_number: u16, ) -> Option<Self>

A descriptor for a frame that uses the template at template_index of structure exactly: the frame dependency definition is the template’s.

Source

pub fn referred_frame_number(&self, fdiff: u16) -> u16

The frame number of a frame this one refers to (fdiff is one of fdiffs) or of the previous frame of a chain (one of chain_fdiffs): “the calculation is done modulo the size of the frame_number field”.

Source

pub fn marshal(&self, structure: &FrameDependencyStructure) -> Result<Bytes>

Writes the descriptor: the payload of the header extension element.

structure is the structure in force for the frame; when the descriptor attaches one it is that one. The frame’s indications, frame differences and chain differences are compared with the template template_id names, and written as custom fields (frame_dtis, frame_fdiffs, frame_chain_fdiff) only where they differ. A descriptor with no structure, no bitmask and nothing custom is three bytes.

§Errors

What A.8.3 forbids or the syntax cannot carry: a template_id outside the structure’s range; a spatial or temporal layer other than the template’s; a wrong number of indications or chain differences; a frame difference outside 1 to 4096; a bitmask with bits beyond the decode targets; an attached structure that is not structure or does not validate.

Source

pub fn unmarshal_mandatory(data: &[u8]) -> Result<(bool, bool, u8, u16)>

Reads the mandatory fields, which every descriptor has and which need no structure: (start_of_frame, end_of_frame, frame_dependency_template_id, frame_number).

§Errors

Fewer than three bytes.

Source

pub fn unmarshal( data: &[u8], structure: Option<&FrameDependencyStructure>, ) -> Result<Option<Self>>

Reads a descriptor: data is the payload of the header extension element and structure the structure in force before this packet, if one is known.

Returns Ok(None) when the descriptor cannot be interpreted because the structure it refers to is not known: it carries none and structure is None, or its template id is outside the known structure’s range, which per A.8.3 means “a packet with the new template dependency structure was lost or delayed”. The mandatory fields of such a packet are still readable with unmarshal_mandatory.

zero_padding is ignored, whatever it holds.

§Errors

A descriptor that ends before its fields do, or a structure with more than 64 templates.

Trait Implementations§

Source§

impl Clone for DependencyDescriptor

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 Debug for DependencyDescriptor

Source§

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

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

impl Default for DependencyDescriptor

Source§

fn default() -> Self

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

impl Eq for DependencyDescriptor

Source§

impl PartialEq for DependencyDescriptor

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 DependencyDescriptor

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.