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: boolstart_of_frame: the packet’s payload begins a frame.
end_of_frame: boolend_of_frame: the packet is the last of its frame.
frame_number: u16frame_number: the same on every packet of a frame, one more for each frame in decode
order, wrapping after 65535.
template_id: u8frame_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: u8The frame’s spatial layer (FrameSpatialId).
temporal_id: u8The 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
impl DependencyDescriptor
Sourcepub fn from_template(
structure: &FrameDependencyStructure,
template_index: usize,
frame_number: u16,
) -> Option<Self>
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.
Sourcepub fn referred_frame_number(&self, fdiff: u16) -> u16
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”.
Sourcepub fn marshal(&self, structure: &FrameDependencyStructure) -> Result<Bytes>
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.
Sourcepub fn unmarshal_mandatory(data: &[u8]) -> Result<(bool, bool, u8, u16)>
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.
Sourcepub fn unmarshal(
data: &[u8],
structure: Option<&FrameDependencyStructure>,
) -> Result<Option<Self>>
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.