Use WebmBuffer in loop_server
This commit is contained in:
parent
12cd1bdd4b
commit
724eabf326
1 changed files with 6 additions and 5 deletions
|
@ -3,11 +3,12 @@ extern crate hyper;
|
||||||
extern crate lab_ebml;
|
extern crate lab_ebml;
|
||||||
|
|
||||||
use futures::future::FutureResult;
|
use futures::future::FutureResult;
|
||||||
|
use futures::stream::once;
|
||||||
use futures::stream::repeat;
|
use futures::stream::repeat;
|
||||||
use futures::stream::Stream;
|
use futures::stream::Stream;
|
||||||
use lab_ebml::chunk::{Chunk, WebmStream, ChunkingError};
|
use lab_ebml::chunk::{Chunk, WebmStream, ChunkingError};
|
||||||
use lab_ebml::timecode_fixer::ChunkStream;
|
use lab_ebml::timecode_fixer::ChunkStream;
|
||||||
use lab_ebml::webm::*;
|
use lab_ebml::webm_stream::WebmBuffer;
|
||||||
use hyper::{Get, StatusCode};
|
use hyper::{Get, StatusCode};
|
||||||
use hyper::header::ContentType;
|
use hyper::header::ContentType;
|
||||||
use hyper::server::{Http, Request, Response, Service};
|
use hyper::server::{Http, Request, Response, Service};
|
||||||
|
@ -30,10 +31,10 @@ impl Service for WebmServer {
|
||||||
let response = match (req.method(), req.path()) {
|
let response = match (req.method(), req.path()) {
|
||||||
(&Get, "/loop") => {
|
(&Get, "/loop") => {
|
||||||
let stream: BodyStream<Vec<u8>> = Box::new(
|
let stream: BodyStream<Vec<u8>> = Box::new(
|
||||||
repeat(()).take(10)
|
repeat(()).take(3)
|
||||||
.map(|()|
|
.map(|()| {
|
||||||
parse_webm(SRC_FILE).chunk_webm()
|
WebmBuffer::new(once::<&[u8], ()>(Ok(SRC_FILE))).chunk_webm()
|
||||||
).flatten()
|
}).flatten()
|
||||||
.fix_timecodes()
|
.fix_timecodes()
|
||||||
.map_err(|err| match err {
|
.map_err(|err| match err {
|
||||||
ChunkingError::IoError(io_err) => hyper::Error::Io(io_err),
|
ChunkingError::IoError(io_err) => hyper::Error::Io(io_err),
|
||||||
|
|
Loading…
Reference in a new issue