Merge branch 'edition_2018'
This commit is contained in:
commit
992f0be6be
14 changed files with 739 additions and 412 deletions
1059
Cargo.lock
generated
1059
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
19
Cargo.toml
19
Cargo.toml
|
@ -2,16 +2,17 @@
|
||||||
name = "webmetro"
|
name = "webmetro"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
authors = ["Tangent 128 <Tangent128@gmail.com>"]
|
authors = ["Tangent 128 <Tangent128@gmail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bytes = "0.4.10"
|
bytes = "0.4.12"
|
||||||
clap = "2.32.0"
|
clap = "2.33.0"
|
||||||
futures = "0.1.25"
|
futures = "0.1.28"
|
||||||
http = "0.1"
|
http = "0.1.17"
|
||||||
hyper = "0.12"
|
hyper = "0.12.31"
|
||||||
odds = { version = "0.3.1", features = ["std-vec"] }
|
odds = { version = "0.3.1", features = ["std-vec"] }
|
||||||
tokio = "0.1.11"
|
tokio = "0.1.22"
|
||||||
tokio-codec = "0.1.1"
|
tokio-codec = "0.1.1"
|
||||||
tokio-io = "0.1.10"
|
tokio-io = "0.1.12"
|
||||||
warp = "0.1"
|
warp = "0.1.16"
|
||||||
weak-table = "0.2"
|
weak-table = "0.2.3"
|
||||||
|
|
|
@ -16,7 +16,7 @@ use futures::{
|
||||||
};
|
};
|
||||||
use odds::vec::VecExt;
|
use odds::vec::VecExt;
|
||||||
|
|
||||||
use chunk::Chunk;
|
use crate::chunk::Chunk;
|
||||||
|
|
||||||
pub enum Never {}
|
pub enum Never {}
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ use std::{
|
||||||
io::Cursor,
|
io::Cursor,
|
||||||
mem
|
mem
|
||||||
};
|
};
|
||||||
use ebml::EbmlEventSource;
|
use crate::ebml::EbmlEventSource;
|
||||||
use error::WebmetroError;
|
use crate::error::WebmetroError;
|
||||||
use webm::*;
|
use crate::webm::*;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct ClusterHead {
|
pub struct ClusterHead {
|
||||||
|
@ -281,7 +281,7 @@ impl<T: EbmlEventSource> WebmStream for T {}
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use chunk::*;
|
use crate::chunk::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn enough_space_for_header() {
|
fn enough_space_for_header() {
|
||||||
|
|
|
@ -24,7 +24,8 @@ use hyper::{
|
||||||
};
|
};
|
||||||
use warp::{
|
use warp::{
|
||||||
self,
|
self,
|
||||||
Filter
|
Filter,
|
||||||
|
path
|
||||||
};
|
};
|
||||||
use weak_table::{
|
use weak_table::{
|
||||||
WeakValueHashMap
|
WeakValueHashMap
|
||||||
|
|
|
@ -305,11 +305,11 @@ pub trait EbmlEventSource {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use bytes::{BytesMut};
|
use bytes::{BytesMut};
|
||||||
use ebml::*;
|
use crate::ebml::*;
|
||||||
use ebml::EbmlError::{CorruptVarint, UnknownElementId};
|
use crate::ebml::EbmlError::{CorruptVarint, UnknownElementId};
|
||||||
use ebml::Varint::{Unknown, Value};
|
use crate::ebml::Varint::{Unknown, Value};
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
use tests::TEST_FILE;
|
use crate::tests::TEST_FILE;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn fail_corrupted_varints() {
|
fn fail_corrupted_varints() {
|
||||||
|
|
|
@ -8,7 +8,7 @@ use std::{
|
||||||
io::Error as IoError
|
io::Error as IoError
|
||||||
};
|
};
|
||||||
|
|
||||||
use ebml::EbmlError;
|
use crate::ebml::EbmlError;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum WebmetroError {
|
pub enum WebmetroError {
|
||||||
|
|
|
@ -3,8 +3,8 @@ use std::time::{Duration, Instant};
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use tokio::timer::Delay;
|
use tokio::timer::Delay;
|
||||||
|
|
||||||
use chunk::Chunk;
|
use crate::chunk::Chunk;
|
||||||
use error::WebmetroError;
|
use crate::error::WebmetroError;
|
||||||
|
|
||||||
pub struct ChunkTimecodeFixer<S> {
|
pub struct ChunkTimecodeFixer<S> {
|
||||||
stream: S,
|
stream: S,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use ebml::FromEbml;
|
use crate::ebml::FromEbml;
|
||||||
|
|
||||||
pub struct EbmlIterator<'a, T: FromEbml<'a>>(&'a [u8], PhantomData<fn() -> T>);
|
pub struct EbmlIterator<'a, T: FromEbml<'a>>(&'a [u8], PhantomData<fn() -> T>);
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
|
|
||||||
extern crate bytes;
|
|
||||||
extern crate futures;
|
|
||||||
extern crate odds;
|
|
||||||
extern crate tokio;
|
|
||||||
|
|
||||||
pub mod ebml;
|
pub mod ebml;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod iterator;
|
pub mod iterator;
|
||||||
|
@ -16,7 +11,7 @@ pub mod webm;
|
||||||
|
|
||||||
pub mod channel;
|
pub mod channel;
|
||||||
|
|
||||||
pub use ebml::{EbmlError, FromEbml};
|
pub use crate::ebml::{EbmlError, FromEbml};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
15
src/main.rs
15
src/main.rs
|
@ -1,20 +1,9 @@
|
||||||
extern crate bytes;
|
|
||||||
#[macro_use] extern crate clap;
|
|
||||||
extern crate futures;
|
|
||||||
extern crate http;
|
|
||||||
extern crate hyper;
|
|
||||||
extern crate tokio;
|
|
||||||
extern crate tokio_codec;
|
|
||||||
extern crate tokio_io;
|
|
||||||
#[macro_use] extern crate warp;
|
|
||||||
extern crate weak_table;
|
|
||||||
extern crate webmetro;
|
|
||||||
|
|
||||||
mod commands;
|
mod commands;
|
||||||
|
|
||||||
use clap::{App, AppSettings};
|
use clap::{App, AppSettings, crate_version};
|
||||||
|
|
||||||
use commands::{
|
use crate::commands::{
|
||||||
relay,
|
relay,
|
||||||
filter,
|
filter,
|
||||||
send,
|
send,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use futures::Async;
|
use futures::Async;
|
||||||
|
|
||||||
use ebml::EbmlError;
|
use crate::ebml::EbmlError;
|
||||||
use ebml::EbmlEventSource;
|
use crate::ebml::EbmlEventSource;
|
||||||
use ebml::FromEbml;
|
use crate::ebml::FromEbml;
|
||||||
|
|
||||||
pub struct EbmlSlice<'a>(pub &'a [u8]);
|
pub struct EbmlSlice<'a>(pub &'a [u8]);
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,11 @@ use futures::{
|
||||||
stream::Stream
|
stream::Stream
|
||||||
};
|
};
|
||||||
|
|
||||||
use ebml::{
|
use crate::ebml::{
|
||||||
EbmlEventSource,
|
EbmlEventSource,
|
||||||
FromEbml
|
FromEbml
|
||||||
};
|
};
|
||||||
use error::WebmetroError;
|
use crate::error::WebmetroError;
|
||||||
|
|
||||||
pub struct EbmlStreamingParser<S> {
|
pub struct EbmlStreamingParser<S> {
|
||||||
stream: S,
|
stream: S,
|
||||||
|
@ -79,7 +79,7 @@ impl<I: Buf, S: Stream<Item = I, Error = WebmetroError>> EbmlStreamingParser<S>
|
||||||
self.buffer.put(buf);
|
self.buffer.put(buf);
|
||||||
// ok can retry decoding now
|
// ok can retry decoding now
|
||||||
},
|
},
|
||||||
other => return other.map(|async| async.map(|_| None))
|
other => return other.map(|async_status| async_status.map(|_| None))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
10
src/webm.rs
10
src/webm.rs
|
@ -1,8 +1,8 @@
|
||||||
use std::io::{Cursor, Error as IoError, ErrorKind, Result as IoResult, Write, Seek};
|
use std::io::{Cursor, Error as IoError, ErrorKind, Result as IoResult, Write, Seek};
|
||||||
use bytes::{BigEndian, BufMut, ByteOrder};
|
use bytes::{BigEndian, BufMut, ByteOrder};
|
||||||
use ebml::*;
|
use crate::ebml::*;
|
||||||
use iterator::ebml_iter;
|
use crate::iterator::ebml_iter;
|
||||||
use iterator::EbmlIterator;
|
use crate::iterator::EbmlIterator;
|
||||||
|
|
||||||
const SEGMENT_ID: u64 = 0x08538067;
|
const SEGMENT_ID: u64 = 0x08538067;
|
||||||
const SEEK_HEAD_ID: u64 = 0x014D9B74;
|
const SEEK_HEAD_ID: u64 = 0x014D9B74;
|
||||||
|
@ -131,11 +131,11 @@ pub fn encode_webm_element<T: Write + Seek>(element: WebmElement, output: &mut T
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use tests::{
|
use crate::tests::{
|
||||||
TEST_FILE,
|
TEST_FILE,
|
||||||
ENCODE_WEBM_TEST_FILE
|
ENCODE_WEBM_TEST_FILE
|
||||||
};
|
};
|
||||||
use webm::*;
|
use crate::webm::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn decode_webm_test1() {
|
fn decode_webm_test1() {
|
||||||
|
|
Loading…
Reference in a new issue