Commit 05ec186c authored by Raphaël Zumer's avatar Raphaël Zumer
Browse files

Honor explicitly unspecified color range in CLI

parent e3b01898
......@@ -30,6 +30,7 @@ pub struct CliOptions {
pub io: EncoderIO,
pub enc: EncoderConfig,
pub limit: usize,
pub color_range_specified: bool,
pub skip: usize,
pub verbose: bool,
pub threads: usize,
......@@ -334,6 +335,9 @@ pub fn parse_cli() -> CliOptions {
enc: parse_config(&matches),
limit: matches.value_of("LIMIT").unwrap().parse().unwrap(),
// Use `occurrences_of()` because `is_present()` is always true
// if a parameter has a default value.
color_range_specified: matches.occurrences_of("PIXEL_RANGE") > 0,
skip: matches.value_of("SKIP").unwrap().parse().unwrap(),
verbose: matches.is_present("VERBOSE"),
......@@ -165,7 +165,7 @@ fn main() {
// If no pixel range is specified via CLI, assume limited,
// as it is the default for the Y4M format.
if cli.enc.pixel_range == PixelRange::Unspecified {
if !cli.color_range_specified {
cli.enc.pixel_range = PixelRange::Limited;
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