use std::task::Poll;
use bytes::Bytes;
mod consumer;
pub(crate) mod jitter;
mod producer;
mod source;
#[cfg(test)]
pub(crate) mod test_util;
pub mod flv;
pub mod fmp4;
pub mod legacy;
pub mod loc;
pub mod mkv;
pub mod ts;
pub use consumer::Consumer;
pub use producer::Producer;
pub(crate) use source::ExportSource;
#[derive(Clone, Debug)]
pub struct Frame {
pub timestamp: moq_net::Timestamp,
pub duration: Option<moq_net::Timestamp>,
pub payload: Bytes,
pub keyframe: bool,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
#[error("missing keyframe: a group must open on a keyframe")]
pub struct MissingKeyframe;
pub trait Container {
type Error: std::error::Error + Send + Sync + Unpin + From<moq_net::Error> + From<MissingKeyframe>;
fn write(&self, group: &mut moq_net::group::Producer, frames: &[Frame]) -> Result<(), Self::Error>;
fn poll_read(
&self,
group: &mut moq_net::group::Consumer,
waiter: &kio::Waiter,
) -> Poll<Result<Option<Vec<Frame>>, Self::Error>>;
fn read(
&self,
group: &mut moq_net::group::Consumer,
) -> impl std::future::Future<Output = Result<Option<Vec<Frame>>, Self::Error>>
where
Self: Sync,
{
async { kio::wait(|waiter| self.poll_read(group, waiter)).await }
}
}