Commit 59b8d640 authored by Luca Barbato's avatar Luca Barbato Committed by Luca Barbato
Browse files

Add a threads option

parent 65fd09f7
......@@ -36,6 +36,14 @@ pub fn parse_cli() -> CliOptions {
.version(env!("CARGO_PKG_VERSION"))
.about("AV1 video encoder")
.setting(AppSettings::DeriveDisplayOrder)
// THREADS
.arg(
Arg::with_name("THREADS")
.help("Set the threadpool size")
.long("threads")
.takes_value(true)
.default_value("0")
)
// INPUT/OUTPUT
.arg(
Arg::with_name("INPUT")
......@@ -212,6 +220,10 @@ pub fn parse_cli() -> CliOptions {
)
.get_matches();
if let Some(threads) = matches.value_of("THREADS").map(|v| v.parse().expect("Threads must be an integer")) {
rayon::ThreadPoolBuilder::new().num_threads(threads).build_global().unwrap();
}
let io = EncoderIO {
input: match matches.value_of("INPUT").unwrap() {
"-" => Box::new(io::stdin()) as Box<dyn Read>,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment