From 724eabf3263b022a544cea7d7429d9bb435b2199 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Mon, 2 Apr 2018 20:12:26 -0400 Subject: [PATCH] Use WebmBuffer in loop_server --- src/bin/loop_server.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bin/loop_server.rs b/src/bin/loop_server.rs index 6c0f85d..12e4eb5 100644 --- a/src/bin/loop_server.rs +++ b/src/bin/loop_server.rs @@ -3,11 +3,12 @@ extern crate hyper; extern crate lab_ebml; use futures::future::FutureResult; +use futures::stream::once; use futures::stream::repeat; use futures::stream::Stream; use lab_ebml::chunk::{Chunk, WebmStream, ChunkingError}; use lab_ebml::timecode_fixer::ChunkStream; -use lab_ebml::webm::*; +use lab_ebml::webm_stream::WebmBuffer; use hyper::{Get, StatusCode}; use hyper::header::ContentType; use hyper::server::{Http, Request, Response, Service}; @@ -30,10 +31,10 @@ impl Service for WebmServer { let response = match (req.method(), req.path()) { (&Get, "/loop") => { let stream: BodyStream> = Box::new( - repeat(()).take(10) - .map(|()| - parse_webm(SRC_FILE).chunk_webm() - ).flatten() + repeat(()).take(3) + .map(|()| { + WebmBuffer::new(once::<&[u8], ()>(Ok(SRC_FILE))).chunk_webm() + }).flatten() .fix_timecodes() .map_err(|err| match err { ChunkingError::IoError(io_err) => hyper::Error::Io(io_err),