Skip to main content

MediaSource

Trait MediaSource 

Source
pub trait MediaSource: Send + Sync {
    // Required method
    fn next_frame<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<MediaFrame>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A source that produces MediaFrames (e.g. a protocol ingest connection).

Required Methods§

Source

fn next_frame<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Option<MediaFrame>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the next frame, or Ok(None) when the source is exhausted. An Err result indicates a fatal I/O or protocol error.

Using Result<Option<T>> rather than Option<Result<T>> follows the standard Rust I/O convention: Ok(Some(frame)) = got a frame, Ok(None) = end of stream, Err(e) = unrecoverable error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§