Struct retina::codec::VideoParameters

source ·
pub struct VideoParameters { /* private fields */ }
Expand description

Parameters which describe a video stream.

A video stream’s parameters are often, but not always, available immediately after DESCRIBE via crate::client::Stream::parameters. They should always be available after the first frame. They may change mid-stream.

Video streams’ parameters may change mid-stream; if so, the frame which changed them will have VideoFrame::new_parameters set, and subsequent calls to crate::client::Stream::parameters will return the new value.

Implementations§

source§

impl VideoParameters

source

pub fn rfc6381_codec(&self) -> &str

Returns a codec description in RFC-6381 form, eg avc1.4D401E.

source

pub fn pixel_dimensions(&self) -> (u32, u32)

Returns the overall dimensions of the video frame in pixels, as (width, height).

source

pub fn pixel_aspect_ratio(&self) -> Option<(u32, u32)>

Returns the displayed size of a pixel, if known, as a dimensionless ratio (h_spacing, v_spacing). This is as specified in ISO/IEC 14496-12:2015 section 12.1.4.

It’s common for IP cameras to use anamorphic sub streams. Eg a 16x9 camera may export the same video source as a 1920x1080 “main” stream and a 704x480 “sub” stream, without cropping. The former has a pixel aspect ratio of (1, 1) while the latter has a pixel aspect ratio of (40, 33).

source

pub fn frame_rate(&self) -> Option<(u32, u32)>

Returns the maximum frame rate in seconds as (numerator, denominator), if known.

May not be minimized, and may not be in terms of the clock rate. Eg 15 frames per second might be returned as (1, 15) or (6000, 90000). The standard NTSC framerate (roughly 29.97 fps) might be returned as (1001, 30000).

TODO: maybe return in clock rate units instead? TODO: expose fixed vs max distinction (see H.264 fixed_frame_rate_flag).

source

pub fn extra_data(&self) -> &[u8]

The codec-specific “extra data” to feed to eg ffmpeg to decode the video frames.

  • H.264: an AvcDecoderConfig.

Trait Implementations§

source§

impl Clone for VideoParameters

source§

fn clone(&self) -> VideoParameters

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for VideoParameters

source§

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

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

impl Hash for VideoParameters

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for VideoParameters

source§

fn eq(&self, other: &VideoParameters) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for VideoParameters

source§

impl StructuralPartialEq for VideoParameters

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.

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> ToOwned for T
where T: Clone,

§

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>,

§

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

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

source§

fn vzip(self) -> V