Skip to main content

AsyncRtspServer

Struct AsyncRtspServer 

Source
pub struct AsyncRtspServer<S> { /* private fields */ }
Expand description

An async RTSP server connection that owns a socket and drives a ServerSession.

Reads requests off the socket (buffering partial reads until a full RTSP message parses), calls ServerSession::handle_request, writes the response bytes back, and returns the ServerEvents.

Implementations§

Source§

impl AsyncRtspServer<TcpStream>

Source

pub fn accept(stream: TcpStream) -> Self

Wraps an accepted plain-TCP connection with a fresh ServerSession.

Source

pub fn accept_with(stream: TcpStream, session: ServerSession) -> Self

Wraps an accepted plain-TCP connection with a pre-configured session.

Source§

impl AsyncRtspServer<TlsStream<TcpStream>>

Source

pub async fn accept_tls(stream: TcpStream, config: ServerConfig) -> Result<Self>

Performs the TLS handshake over an accepted TCP connection (an rtsps:// server), then wraps the TLS stream with a fresh session.

Source§

impl<S> AsyncRtspServer<S>
where S: AsyncRead + AsyncWrite + Unpin,

Source

pub fn with_stream(stream: S, session: ServerSession) -> Self

Wraps an already-connected stream (plain or TLS) and a session.

Source

pub fn state(&self) -> SessionState

The current session state.

Source

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

The allocated session id, once a SETUP has been handled.

Source

pub fn stream_mut(&mut self) -> &mut S

Mutable access to the underlying stream, for writing raw bytes (e.g. deliberately fragmenting an interleaved frame, or sending several frames back-to-back) alongside the framed send_interleaved helper.

Source

pub async fn next_request(&mut self) -> Result<Option<Vec<ServerEvent>>>

Reads the next complete request, handles it (writing the response back), and returns the produced events.

Returns Ok(None) when the peer closes the connection cleanly before a full request arrives.

Source

pub async fn send_interleaved( &mut self, channel: u8, payload: &[u8], ) -> Result<()>

Sends an interleaved ($-framed) media frame to the client on channel (§10.12), e.g. an RTP or RTCP packet during PLAY.

Trait Implementations§

Source§

impl<S: Debug> Debug for AsyncRtspServer<S>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> Freeze for AsyncRtspServer<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for AsyncRtspServer<S>
where S: RefUnwindSafe,

§

impl<S> Send for AsyncRtspServer<S>
where S: Send,

§

impl<S> Sync for AsyncRtspServer<S>
where S: Sync,

§

impl<S> Unpin for AsyncRtspServer<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for AsyncRtspServer<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for AsyncRtspServer<S>
where S: UnwindSafe,

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