Skip to main content

StreamBackend

Trait StreamBackend 

Source
pub trait StreamBackend: Send + Sync {
    // Required methods
    fn backend_type(&self) -> BackendType;
    fn can_handle(&self, manifest_url: &str, encrypted: bool) -> bool;
    fn stream_to<'life0, 'life1, 'life2, 'life3, 'async_trait, W>(
        &'life0 self,
        manifest_url: &'life1 str,
        config: &'life2 StreamConfig,
        output: &'life3 mut W,
        progress: Option<ProgressCallback>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where W: 'async_trait + AsyncWrite + Unpin + Send,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn stream_to_file<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        manifest_url: &'life1 str,
        config: &'life2 StreamConfig,
        path: &'life3 Path,
        progress: Option<ProgressCallback>,
        duration_secs: Option<u64>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

Trait for media streaming backends.

Backends are responsible for fetching segments (or invoking an external tool) and writing the resulting media bytes to either an async writer or a file on disk.

Required Methods§

Source

fn backend_type(&self) -> BackendType

The type of this backend.

Source

fn can_handle(&self, manifest_url: &str, encrypted: bool) -> bool

Returns true if this backend can handle the given manifest.

Source

fn stream_to<'life0, 'life1, 'life2, 'life3, 'async_trait, W>( &'life0 self, manifest_url: &'life1 str, config: &'life2 StreamConfig, output: &'life3 mut W, progress: Option<ProgressCallback>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where W: 'async_trait + AsyncWrite + Unpin + Send, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Stream media data to an async writer (e.g., stdout pipe).

Source

fn stream_to_file<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, manifest_url: &'life1 str, config: &'life2 StreamConfig, path: &'life3 Path, progress: Option<ProgressCallback>, duration_secs: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Stream media data to a file on disk.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§