Skip to content

Commit

Permalink
fixup! settings: merge video_params into get_default_arguments
Browse files Browse the repository at this point in the history
Put default parameters at the beginning of the array. Many cli programs have
subsequent arguments take precedence over preceding arguments.
  • Loading branch information
FlyingWombat committed Jan 6, 2024
1 parent 34b48b7 commit cabe43b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions av1an-core/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::process::{exit, Command};

use anyhow::{bail, ensure};
use ffmpeg::format::Pixel;
use itertools::Itertools;
use itertools::{Itertools, chain};
use serde::{Deserialize, Serialize};

use crate::concat::ConcatMethod;
Expand Down Expand Up @@ -171,6 +171,7 @@ properly into a mkv file. Specify mkvmerge as the concatenation method by settin
// TODO: consider using hashmap to store program arguments instead of string vector
let default_video_params = self.encoder.get_default_arguments(self.input.calculate_tiles());
let mut skip = false;
let mut _default_params: Vec<String> = Vec::new();
for param in default_video_params {
if skip && !(param.starts_with("-") && param != "-1") {
skip = false;
Expand All @@ -180,9 +181,10 @@ properly into a mkv file. Specify mkvmerge as the concatenation method by settin
skip = true;
continue;
} else {
self.video_params.push(param);
_default_params.push(param);
}
}
self.video_params = chain!(_default_params, self.video_params.clone()).collect();
}
}

Expand Down

0 comments on commit cabe43b

Please sign in to comment.