Add stub Webm chunking stream operator

This commit is contained in:
Tangent 128 2017-10-01 00:21:33 -04:00
parent 27aff20c46
commit 52c1843311
1 changed files with 27 additions and 0 deletions

View File

@ -1,3 +1,4 @@
use futures::{Async, Stream};
use std::io::Cursor;
use std::sync::Arc;
use webm::*;
@ -69,6 +70,32 @@ impl<B: AsRef<[u8]>> AsRef<[u8]> for Chunk<B> {
}
}
pub struct WebmChunker<S> {
stream: S
}
impl<'a, S: Stream<Item = WebmElement<'a>>> Stream for WebmChunker<S>
{
type Item = Chunk;
type Error = S::Error;
fn poll(&mut self) -> Result<Async<Option<Self::Item>>, Self::Error> {
Ok(Async::NotReady)
}
}
pub trait WebmStream<T> {
fn chunk_webm(self) -> WebmChunker<T>;
}
impl<'a, T: Stream<Item = WebmElement<'a>>> WebmStream<T> for T {
fn chunk_webm(self) -> WebmChunker<T> {
WebmChunker {
stream: self
}
}
}
#[cfg(test)]
mod tests {