Struct retina::codec::VideoFrame
source · pub struct VideoFrame { /* private fields */ }
Expand description
A single video frame (aka video sample or video access unit).
Typically this is an encoded picture. It could also be a single field of an interlaced picture.
Durations aren’t specified here; they can be calculated from the timestamp of a following picture, or approximated via the frame rate.
Implementations§
source§impl VideoFrame
impl VideoFrame
pub fn stream_id(&self) -> usize
sourcepub fn has_new_parameters(&self) -> bool
pub fn has_new_parameters(&self) -> bool
Returns true if this frame set new video parameters.
The parameters can be obtained via crate::client::Stream::parameters
.
sourcepub fn loss(&self) -> u16
pub fn loss(&self) -> u16
Returns the number of lost RTP packets before this video frame. See
crate::rtp::ReceivedPacket::loss
.
Note that if loss occurs during a fragmented frame, more than this number of packets’ worth of data may be skipped.
sourcepub fn timestamp(&self) -> Timestamp
pub fn timestamp(&self) -> Timestamp
Returns this picture’s timestamp in the time base associated with the stream.
pub fn start_ctx(&self) -> &PacketContext
pub fn end_ctx(&self) -> &PacketContext
sourcepub fn is_random_access_point(&self) -> bool
pub fn is_random_access_point(&self) -> bool
Returns if this is a “random access point (RAP)” aka “instantaneous decoding refresh (IDR)” picture.
The former is defined in ISO/IEC 14496-12; the latter in H.264. Both mean that this picture can be decoded without any other AND no pictures following this one depend on any pictures before this one.
sourcepub fn is_disposable(&self) -> bool
pub fn is_disposable(&self) -> bool
Returns if no other pictures require this one to be decoded correctly.
In H.264 terms, this is a frame with nal_ref_idc == 0
.
sourcepub fn data(&self) -> &[u8] ⓘ
pub fn data(&self) -> &[u8] ⓘ
Returns the data in a codec-specific format.
H.264 is currently the only supported video codec. A frame is encoded in AAC format with
four-byte lengths. That is, each NAL is encoded as a u32
length in big-endian format
followed by the actual contents of the NAL (including “emulation prevention three” bytes).
In the future, a configuration parameter may allow the caller to request Annex B encoding
instead. See #44.