use std::task::Poll;
use bytes::Bytes;
pub type Timestamp = moq_lite::Timescale<1_000_000>;
#[derive(Clone, Debug)]
pub struct Frame {
pub timestamp: Timestamp,
pub payload: Bytes,
pub keyframe: bool,
}
pub trait Container {
type Error: std::error::Error + Send + Sync + Unpin + From<moq_lite::Error>;
fn write(&self, group: &mut moq_lite::GroupProducer, frames: &[Frame]) -> Result<(), Self::Error>;
fn poll_read(
&self,
group: &mut moq_lite::GroupConsumer,
waiter: &conducer::Waiter,
) -> Poll<Result<Option<Vec<Frame>>, Self::Error>>;
fn read(
&self,
group: &mut moq_lite::GroupConsumer,
) -> impl std::future::Future<Output = Result<Option<Vec<Frame>>, Self::Error>>
where
Self: Sync,
{
async { conducer::wait(|waiter| self.poll_read(group, waiter)).await }
}
}