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
impl VideoParameters
sourcepub fn rfc6381_codec(&self) -> &str
pub fn rfc6381_codec(&self) -> &str
Returns a codec description in
RFC-6381 form, eg avc1.4D401E
.
sourcepub fn pixel_dimensions(&self) -> (u32, u32)
pub fn pixel_dimensions(&self) -> (u32, u32)
Returns the overall dimensions of the video frame in pixels, as (width, height)
.
sourcepub fn pixel_aspect_ratio(&self) -> Option<(u32, u32)>
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)
.
sourcepub fn frame_rate(&self) -> Option<(u32, u32)>
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).
sourcepub fn extra_data(&self) -> &[u8] ⓘ
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
impl Clone for VideoParameters
source§fn clone(&self) -> VideoParameters
fn clone(&self) -> VideoParameters
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for VideoParameters
impl Debug for VideoParameters
source§impl Hash for VideoParameters
impl Hash for VideoParameters
source§impl PartialEq for VideoParameters
impl PartialEq for VideoParameters
source§fn eq(&self, other: &VideoParameters) -> bool
fn eq(&self, other: &VideoParameters) -> bool
self
and other
values to be equal, and is used
by ==
.