Skip to main content

Vp9CodecExtra

Struct Vp9CodecExtra 

Source
pub struct Vp9CodecExtra {
    pub layers_scheme: [Option<usize>; 3],
    pub tid: Option<u8>,
    pub layers_widths: [Option<u16>; 3],
    pub layers_heights: [Option<u16>; 3],
    pub tl0_picture_id: Option<u64>,
    pub picture_id: Option<u64>,
    pub is_keyframe: bool,
}
Expand description

Vp9 information describing the depacketized/packetized data.

Fields§

§layers_scheme: [Option<usize>; 3]

Map of the SVC layers.

Index of each element corresponds to spatial layer index.

Each element represents the end (not including) in MediaData::data for spatial layer it belongs.

The all spatial layers (up to 3) in MediaData::data are sorted by spatial layer index from lower to greater. So, the beginning of some spatial layer is the end (including) of the previous spatial layer (for the spatial layer with index 0 the beginning is 0).

[MediaData::data]:
+-----+----------------------+---------------------------+
| SL0 |         SL1          |            SL2            |
+-----+----------------------+---------------------------+
|     |                      |                           |
V     V                      V                           V
0   layers_scheme[0]       layers_scheme[1]            layers_scheme[2]

Note: There is no syncronization between Vp9CodecExtra::layers_scheme and MediaData::data! If you need to keep Vp9CodecExtra::layers_scheme in actual state you have to update the Vp9CodecExtra::layers_scheme on mutating the MediaData::data.

§Example

Say you have a VP9 track working in “L3T3” scalability mode and you want to retranslate S1T2 layer. So you need to retranslate the all spatial and temporal layers <= target layer.

// We want to receive S1T2 layer.
let (target_spatial, target_temporal) = (1u8, 2u8);

let media_data: MediaData = todo!();

if let CodecExtra::Vp9(vp9_extra) = media_data.codec_extra {
    // Try to get current `temporal layer`. If `None` there is no SVC.
    if let Some(tid) = vp9_extra.tid {
        if let (true, Some(end_of_target_layer)) = (
            // Check whether we need this `temporal layer`.
            tid <= target_temporal,
            // Check whether we have information about the right
            // border of data for the target `spatial layer`.
            vp9_extra.layers_scheme[target_spatial as usize],
        ) {
            // Keep only the bytes for spatial layers up to `target_spatial`.
            let data = &media_data.data[..end_of_target_layer];
        }
    }
}
§tid: Option<u8>

Temporal layer id.

§layers_widths: [Option<u16>; 3]

Map of the SVC layers widths.

Specified for every spatial layer.

§layers_heights: [Option<u16>; 3]

Map of the SVC layers heights.

Specified for every spatial layer.

§tl0_picture_id: Option<u64>

Extended picture id of layer 0 frames, if present

§picture_id: Option<u64>

Extended picture id, if present

§is_keyframe: bool

Flag which indicates that within MediaData, there is an individual frame containing complete and independent visual information. This frame serves as a reference point for other frames in the video sequence.

Trait Implementations§

Source§

impl Clone for Vp9CodecExtra

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 Vp9CodecExtra

Source§

impl Debug for Vp9CodecExtra

Source§

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

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

impl Default for Vp9CodecExtra

Source§

fn default() -> Self

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

impl Eq for Vp9CodecExtra

Source§

impl PartialEq for Vp9CodecExtra

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 Vp9CodecExtra

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> CryptoSafe for T
where T: Send + Sync + Debug,

Source§

impl<T> CryptoSafe for T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more