Add stub Webm chunking stream operator
This commit is contained in:
parent
27aff20c46
commit
52c1843311
1 changed files with 27 additions and 0 deletions
27
src/chunk.rs
27
src/chunk.rs
|
@ -1,3 +1,4 @@
|
||||||
|
use futures::{Async, Stream};
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use webm::*;
|
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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue