Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Av1 #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Av1 #10

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
10 changes: 7 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions src/sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
7 changes: 3 additions & 4 deletions src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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);
}
Expand All @@ -96,7 +95,7 @@ impl Source {
}
},
Err(err) => {
warn!("No more events {:?}", err);
error!("No more events {:?}", err);
Err("TBD".to_owned())
}
}
Expand Down