Struct retina::client::Stream

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

Information about a stream offered within a presentation.

Currently if multiple formats are offered, this only describes the first.

Implementations§

source§

impl Stream

source

pub fn media(&self) -> &str

Returns the media type, as specified in the IANA SDP parameters media registry.

source

pub fn encoding_name(&self) -> &str

An encoding name, as specified in the IANA media type registry, with ASCII characters in lowercase.

Commonly used but not specified in that registry: the ONVIF types claimed in the ONVIF Streaming Spec:

  • vnd.onvif.metadata
  • vnd.onvif.metadata.gzip,
  • vnd.onvif.metadata.exi.onvif
  • vnd.onvif.metadata.exi.ext
source

pub fn rtp_payload_type(&self) -> u8

Returns the RTP payload type.

See the registry. It’s common to use one of the dynamically assigned values, 96–127.

source

pub fn clock_rate_hz(&self) -> u32

Returns the RTP clock rate, in Hz.

source

pub fn channels(&self) -> Option<NonZeroU16>

Returns the number of audio channels, if applicable (media is audio) and known.

source

pub fn framerate(&self) -> Option<f32>

Returns the video framerate if present in SDP attributes.

source

pub fn control(&self) -> Option<&Url>

Returns the specified control URL.

This is needed with multiple streams to send SETUP requests and interpret the PLAY response’s RTP-Info header. RFC 2326 section C.3 says the server is allowed to omit it when there is only a single stream.

source§

impl Stream

source

pub fn parameters(&self) -> Option<ParametersRef<'_>>

Returns codec-specified parameters for this stream, if available.

Returns None on unknown codecs, bad parameters, or if parameters aren’t (yet) known.

This is initially populated from the DESCRIBE response’s SDP. Not all codecs guarantee parameters are provided in the SDP. Notably, H.264 allows parameters to be specified “in-band” (with the data packets) instead of or in addition to “out-of-band” (via SDP). Thus, it’s unspecified whether a parameters call immediately after Session::describe will return Some or None.

With Demuxed

When using Demuxed’s frame-by-frame futures::Stream impl, parameters reflects all parameters as of returned frames that have been returned from from poll_next via Poll::Ready.

It’s guaranteed to not reflect any parameter changes in the upcoming frame, even after a Poll::Pending return.

If there is no packet loss, parameters are generally available after the first frame is returned. In the case of H.264, RFC 6184 section 8.4 says “when parameter sets are added or updated, care SHOULD be taken to ensure that any parameter set is delivered prior to its usage.”

Without Demuxed

When directly using Session’s packet-by-packet futures::Stream impl, codec depacketization logic is bypassed. The parameters returned by this function may be out of date.

source

pub fn ctx(&self) -> Option<&StreamContext>

Returns a context for this stream, if it has been set up.

Trait Implementations§

source§

impl Debug for Stream

source§

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

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