diff --git a/Cargo.toml b/Cargo.toml index 6b586f9..f311b8f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,5 +20,6 @@ libvpx = { git = "https://github.com/rust-av/vpx-rs", features=["codec-trait"] } libopus = { git = "https://github.com/rust-av/opus-rs", features=["codec-trait"] } libaom = { git = "https://github.com/rust-av/aom-rs", features=["codec-trait"] } av-vorbis = { git = "https://github.com/rust-av/av-vorbis" } +rav1e-av = { git = "https://github.com/rust-av/rav1e-av" } matroska = { git = "https://github.com/rust-av/matroska" } diff --git a/src/main.rs b/src/main.rs index 2a466e1..3d3b533 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,6 +18,8 @@ extern crate libaom as aom; extern crate libopus as opus; extern crate libvpx as vpx; +extern crate rav1e_av; + // Command line interface use std::path::PathBuf; use structopt::StructOpt; @@ -60,7 +62,7 @@ use codec::encoder::Context as EncoderCtx; use format::stream::Stream; -use aom::encoder::AV1_DESCR; +use rav1e_av::AV1_DESCR; use opus::encoder::OPUS_DESCR; use vpx::encoder::VP9_DESCR; @@ -109,7 +111,7 @@ fn main() { ); stream.id = st.id; - stream.index = st.id as usize; + stream.index = st.index; let idx = info.add_stream(stream); // decoder -> encoder @@ -134,6 +136,7 @@ fn main() { use codec::error::*; match e { Error::MoreDataNeeded => (), + Error::Unsupported(ref val) if val == "Encoded" => (), _ => { error!("flush ctx.receive_packet: {:?}", e); } @@ -161,6 +164,7 @@ fn main() { use codec::error::*; match e { Error::MoreDataNeeded => (), + Error::Unsupported(ref val) if val == "Encoded" => (), _ => { error!("flush ctx.receive_packet: {:?}", e); } @@ -189,7 +193,7 @@ fn main() { (encoders, recv_packet) }; - info!("Encoders set {:?}", info); + trace!("Encoders set {:#?}", info); let mut sink = Sink::from_path(&opt.output, info); diff --git a/src/sink.rs b/src/sink.rs index a5f2570..373631d 100644 --- a/src/sink.rs +++ b/src/sink.rs @@ -19,6 +19,7 @@ impl Sink { let mux = Box::new(MkvMuxer::matroska()); let output = File::create(path).unwrap(); let mut muxer = MuxerCtx::new(mux, Box::new(output)); + muxer.configure().unwrap(); muxer.set_global_info(info).unwrap(); muxer.write_header().unwrap(); diff --git a/src/source.rs b/src/source.rs index 3d67b9c..bc36ae6 100644 --- a/src/source.rs +++ b/src/source.rs @@ -36,7 +36,7 @@ impl Source { let decoder_list = Decoders::from_list(&[VP9_DEC, OPUS_DEC, VORBIS_DEC, AV1_DEC]); let r = File::open(path).unwrap(); - let ar = AccReader::with_capacity(4 * 1024, r); + let ar = AccReader::new(r); let mut demuxer = DemuxerCtx::new(Box::new(MkvDemuxer::new()), Box::new(ar)); demuxer .read_headers() @@ -74,8 +74,7 @@ impl Source { let idx = pkt.stream_index as usize; if let Some(dec) = decs.get_mut(&idx) { debug!("Decoding packet at index {}", pkt.stream_index); - // TODO report error - dec.0.send_packet(&pkt).unwrap(); + dec.0.send_packet(&pkt); if let Some(frame) = dec.0.receive_frame().ok() { dec.1.as_mut().unwrap().send(frame); } @@ -96,7 +95,7 @@ impl Source { } }, Err(err) => { - warn!("No more events {:?}", err); + error!("No more events {:?}", err); Err("TBD".to_owned()) } }