streamer-rs 0.1.0

Backend-agnostic async library for streaming audio and video, with GStreamer as the first implementation.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * SpinorML Ltd 🚀 AGPL-3.0 License - https://spinorml.com/license
 */

use async_trait::async_trait;

use crate::error::Result;
use crate::frame::{FrameData, VideoFrame};

#[async_trait]
pub trait VideoSource: Send {
    type Frame: FrameData;

    async fn start(&mut self) -> Result<()>;
    /// Returns `None` on end of stream.
    async fn next_frame(&mut self) -> Result<Option<VideoFrame<Self::Frame>>>;
    async fn stop(&mut self) -> Result<()>;
}