Skip to main content

ClientSession

Struct ClientSession 

Source
pub struct ClientSession { /* private fields */ }
Expand description

A driveable RTSP client session (RFC 2326 §A.1).

Implementations§

Source§

impl ClientSession

Source

pub fn new() -> Self

Creates a fresh client session in the Init state with CSeq starting at 1.

Source

pub fn with_credentials(self, credentials: Credentials) -> Self

Attaches credentials so the engine can answer 401 challenges (§14).

Source

pub fn with_user_agent(self, ua: impl Into<String>) -> Self

Overrides the User-Agent header value sent on requests.

Source

pub fn state(&self) -> SessionState

The current session state.

Source

pub fn session_id(&self) -> Option<&str>

The negotiated session id, once a SETUP response has been processed.

Source

pub fn session_timeout(&self) -> Option<u64>

The session timeout in seconds, if the SETUP response declared one.

Source

pub fn negotiated_transport(&self) -> Option<&Transport>

The transport negotiated in the SETUP response, if any.

Source

pub fn options(&mut self, uri: &str) -> Result<Vec<u8>>

Builds an OPTIONS request (state-neutral).

Source

pub fn describe(&mut self, uri: &str) -> Result<Vec<u8>>

Builds a DESCRIBE request with Accept: application/sdp (state-neutral).

Source

pub fn setup(&mut self, uri: &str, transport: &Transport) -> Result<Vec<u8>>

Builds a SETUP request carrying the given Transport (Init/Ready/…).

Source

pub fn play(&mut self, uri: &str) -> Result<Vec<u8>>

Builds a PLAY request (valid in Ready/Playing).

Source

pub fn pause(&mut self, uri: &str) -> Result<Vec<u8>>

Builds a PAUSE request (valid in Playing/Recording).

Source

pub fn teardown(&mut self, uri: &str) -> Result<Vec<u8>>

Builds a TEARDOWN request (valid in any non-Init state, and Init).

Source

pub fn get_parameter(&mut self, uri: &str, body: &[u8]) -> Result<Vec<u8>>

Builds a GET_PARAMETER request, optionally with a body (state-neutral; an empty body is the liveness ping).

Source

pub fn handle_data(&mut self, data: &[u8]) -> Result<Vec<ClientEvent>>

Feeds inbound bytes and returns the events produced. Retains any partial trailing message or frame internally for the next call.

Trait Implementations§

Source§

impl Debug for ClientSession

Source§

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

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

impl Default for ClientSession

Source§

fn default() -> Self

Returns the “default value” for a type. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

Source§

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