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

source

pub fn stream_id(&self) -> usize

source

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.

source

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.

source

pub fn timestamp(&self) -> Timestamp

Returns this picture’s timestamp in the time base associated with the stream.

source

pub fn start_ctx(&self) -> &PacketContext

source

pub fn end_ctx(&self) -> &PacketContext

source

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.

source

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.

source

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.

source

pub fn into_data(self) -> Vec<u8>

Trait Implementations§

source§

impl Debug for VideoFrame

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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