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: boolFlag 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.