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"
|
||||
version = "0.2.0"
|
||||
authors = ["Tangent 128 <Tangent128@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
bytes = "0.4.10"
|
||||
clap = "2.32.0"
|
||||
futures = "0.1.25"
|
||||
http = "0.1"
|
||||
hyper = "0.12"
|
||||
bytes = "0.4.12"
|
||||
clap = "2.33.0"
|
||||
futures = "0.1.28"
|
||||
http = "0.1.17"
|
||||
hyper = "0.12.31"
|
||||
odds = { version = "0.3.1", features = ["std-vec"] }
|
||||
tokio = "0.1.11"
|
||||
tokio = "0.1.22"
|
||||
tokio-codec = "0.1.1"
|
||||
tokio-io = "0.1.10"
|
||||
warp = "0.1"
|
||||
weak-table = "0.2"
|
||||
tokio-io = "0.1.12"
|
||||
warp = "0.1.16"
|
||||
weak-table = "0.2.3"
|
||||
|
|
|
@ -16,7 +16,7 @@ use futures::{
|
|||
};
|
||||
use odds::vec::VecExt;
|
||||
|
||||
use chunk::Chunk;
|
||||
use crate::chunk::Chunk;
|
||||
|
||||
pub enum Never {}
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ use std::{
|
|||
io::Cursor,
|
||||
mem
|
||||
};
|
||||
use ebml::EbmlEventSource;
|
||||
use error::WebmetroError;
|
||||
use webm::*;
|
||||
use crate::ebml::EbmlEventSource;
|
||||
use crate::error::WebmetroError;
|
||||
use crate::webm::*;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ClusterHead {
|
||||
|
@ -281,7 +281,7 @@ impl<T: EbmlEventSource> WebmStream for T {}
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use chunk::*;
|
||||
use crate::chunk::*;
|
||||
|
||||
#[test]
|
||||
fn enough_space_for_header() {
|
||||
|
|
|
@ -24,7 +24,8 @@ use hyper::{
|
|||
};
|
||||
use warp::{
|
||||
self,
|
||||
Filter
|
||||
Filter,
|
||||
path
|
||||
};
|
||||
use weak_table::{
|
||||
WeakValueHashMap
|
||||
|
|
|
@ -305,11 +305,11 @@ pub trait EbmlEventSource {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use bytes::{BytesMut};
|
||||
use ebml::*;
|
||||
use ebml::EbmlError::{CorruptVarint, UnknownElementId};
|
||||
use ebml::Varint::{Unknown, Value};
|
||||
use crate::ebml::*;
|
||||
use crate::ebml::EbmlError::{CorruptVarint, UnknownElementId};
|
||||
use crate::ebml::Varint::{Unknown, Value};
|
||||
use std::io::Cursor;
|
||||
use tests::TEST_FILE;
|
||||
use crate::tests::TEST_FILE;
|
||||
|
||||
#[test]
|
||||
fn fail_corrupted_varints() {
|
||||
|
|
|
@ -8,7 +8,7 @@ use std::{
|
|||
io::Error as IoError
|
||||
};
|
||||
|
||||
use ebml::EbmlError;
|
||||
use crate::ebml::EbmlError;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum WebmetroError {
|
||||
|
|
|
@ -3,8 +3,8 @@ use std::time::{Duration, Instant};
|
|||
use futures::prelude::*;
|
||||
use tokio::timer::Delay;
|
||||
|
||||
use chunk::Chunk;
|
||||
use error::WebmetroError;
|
||||
use crate::chunk::Chunk;
|
||||
use crate::error::WebmetroError;
|
||||
|
||||
pub struct ChunkTimecodeFixer<S> {
|
||||
stream: S,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::marker::PhantomData;
|
||||
|
||||
use ebml::FromEbml;
|
||||
use crate::ebml::FromEbml;
|
||||
|
||||
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 error;
|
||||
pub mod iterator;
|
||||
|
@ -16,7 +11,7 @@ pub mod webm;
|
|||
|
||||
pub mod channel;
|
||||
|
||||
pub use ebml::{EbmlError, FromEbml};
|
||||
pub use crate::ebml::{EbmlError, FromEbml};
|
||||
|
||||
#[cfg(test)]
|
||||
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;
|
||||
|
||||
use clap::{App, AppSettings};
|
||||
use clap::{App, AppSettings, crate_version};
|
||||
|
||||
use commands::{
|
||||
use crate::commands::{
|
||||
relay,
|
||||
filter,
|
||||
send,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use futures::Async;
|
||||
|
||||
use ebml::EbmlError;
|
||||
use ebml::EbmlEventSource;
|
||||
use ebml::FromEbml;
|
||||
use crate::ebml::EbmlError;
|
||||
use crate::ebml::EbmlEventSource;
|
||||
use crate::ebml::FromEbml;
|
||||
|
||||
pub struct EbmlSlice<'a>(pub &'a [u8]);
|
||||
|
||||
|
|
|
@ -8,11 +8,11 @@ use futures::{
|
|||
stream::Stream
|
||||
};
|
||||
|
||||
use ebml::{
|
||||
use crate::ebml::{
|
||||
EbmlEventSource,
|
||||
FromEbml
|
||||
};
|
||||
use error::WebmetroError;
|
||||
use crate::error::WebmetroError;
|
||||
|
||||
pub struct EbmlStreamingParser<S> {
|
||||
stream: S,
|
||||
|
@ -79,7 +79,7 @@ impl<I: Buf, S: Stream<Item = I, Error = WebmetroError>> EbmlStreamingParser<S>
|
|||
self.buffer.put(buf);
|
||||
// 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 bytes::{BigEndian, BufMut, ByteOrder};
|
||||
use ebml::*;
|
||||
use iterator::ebml_iter;
|
||||
use iterator::EbmlIterator;
|
||||
use crate::ebml::*;
|
||||
use crate::iterator::ebml_iter;
|
||||
use crate::iterator::EbmlIterator;
|
||||
|
||||
const SEGMENT_ID: u64 = 0x08538067;
|
||||
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)]
|
||||
mod tests {
|
||||
use tests::{
|
||||
use crate::tests::{
|
||||
TEST_FILE,
|
||||
ENCODE_WEBM_TEST_FILE
|
||||
};
|
||||
use webm::*;
|
||||
use crate::webm::*;
|
||||
|
||||
#[test]
|
||||
fn decode_webm_test1() {
|
||||
|
|
Loading…
Reference in a new issue