Skip to main content

DependencyDescriptorWriter

Struct DependencyDescriptorWriter 

Source
pub struct DependencyDescriptorWriter { /* private fields */ }
Expand description

The send side of the Dependency Descriptor for one RTP stream (AV1 RTP specification A.4, A.8.3).

For each frame, in decode order, next_frame takes what the encoder says about it and returns a FrameDescriptor, which writes the header extension of each of the frame’s packets. The writer

  • numbers the frames (frame_number, one more per frame, wrapping after 65535);
  • picks, among the structure’s templates of the frame’s layer, the one that needs the fewest custom bits (none, when the frame follows a template);
  • attaches the structure to the first packet of a coded video sequence and to no other;
  • signals the active decode targets when they change, on every packet until active_decode_targets_acknowledged or a new coded video sequence with all of them active.

Implementations§

Source§

impl DependencyDescriptorWriter

Source

pub fn new( structure: FrameDependencyStructure, initial_frame_number: u16, ) -> Result<Self>

A writer for a stream with this structure. initial_frame_number is the first frame’s number, which “MAY start on a random number”.

§Errors

A structure that does not validate.

Source

pub fn structure(&self) -> &FrameDependencyStructure

The structure in force.

Source

pub fn next_frame_number(&self) -> u16

The number the next frame gets.

Source

pub fn set_structure( &mut self, structure: FrameDependencyStructure, ) -> Result<()>

Replaces the structure, for the coded video sequence the next frame starts. All decode targets of the new structure are active.

Its template_id_offset SHOULD keep its template ids clear of the current structure’s (FrameDependencyStructure::next_template_id_offset gives one that does), so that a receiver that missed the new structure does not read the old templates into the new ids.

§Errors

A structure that does not validate, or one with the current template_id_offset and anything else different: “when template_id_offset of a new template_dependency_structure is the same as in the existing template_dependency_structure, all fields in both template_dependency_structures MUST have identical values”.

Source

pub fn active_decode_targets(&self) -> u32

The active decode targets, as a bitmask.

Source

pub fn set_active_decode_targets(&mut self, bitmask: u32) -> Result<()>

Changes the set of active decode targets (bit i for decode target i), for example when the encoder stops producing a spatial layer. “Whenever the set of active Decode targets changes, the sender MUST signal the new set”: from the next packet on every descriptor carries the bitmask.

§Errors

A bitmask with bits beyond the structure’s decode targets.

Source

pub fn active_decode_targets_acknowledged(&mut self)

Stops repeating the bitmask: the receiver is known to have a packet that carried it (a receiver report acknowledged one). One of the techniques A.4 names.

Source

pub fn next_frame( &mut self, frame: &FrameDependencyTemplate, starts_coded_video_sequence: bool, ) -> Result<FrameDescriptor>

Describes the next frame in decode order.

frame holds the frame’s own layer, decode target indications, frame differences (how many frames back each frame it refers to is, in the frames given to this writer) and chain differences. starts_coded_video_sequence is set for the first frame of a coded video sequence (a key frame the stream can be joined at): its first packet carries the structure.

§Errors

The stream’s first frame, or the first after set_structure, does not start a coded video sequence (the receiver would never get the structure); the structure has no template of the frame’s layer; or the frame’s values are ones DependencyDescriptor::marshal refuses.

Trait Implementations§

Source§

impl Clone for DependencyDescriptorWriter

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 DependencyDescriptorWriter

Source§

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

Formats the value using the given formatter. Read more

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.