From 52c1843311d138326ded720af5d466168bd5acc5 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Sun, 1 Oct 2017 00:21:33 -0400 Subject: [PATCH] Add stub Webm chunking stream operator --- src/chunk.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/chunk.rs b/src/chunk.rs index 69390e4..f4c7599 100644 --- a/src/chunk.rs +++ b/src/chunk.rs @@ -1,3 +1,4 @@ +use futures::{Async, Stream}; use std::io::Cursor; use std::sync::Arc; use webm::*; @@ -69,6 +70,32 @@ impl> AsRef<[u8]> for Chunk { } } +pub struct WebmChunker { + stream: S +} + +impl<'a, S: Stream>> Stream for WebmChunker +{ + type Item = Chunk; + type Error = S::Error; + + fn poll(&mut self) -> Result>, Self::Error> { + Ok(Async::NotReady) + } +} + +pub trait WebmStream { + fn chunk_webm(self) -> WebmChunker; +} + +impl<'a, T: Stream>> WebmStream for T { + fn chunk_webm(self) -> WebmChunker { + WebmChunker { + stream: self + } + } +} + #[cfg(test)] mod tests {