From 3a570e46993fd397ceb5b00e4bc8691429f3c2ad Mon Sep 17 00:00:00 2001 From: flazepe <51487578+flazepe@users.noreply.github.com> Date: Fri, 22 Nov 2024 17:58:59 +0800 Subject: [PATCH] refactor: width check --- src/ffmpeg/inputs.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/ffmpeg/inputs.rs b/src/ffmpeg/inputs.rs index b5cf2c0..f6ddc9b 100644 --- a/src/ffmpeg/inputs.rs +++ b/src/ffmpeg/inputs.rs @@ -89,14 +89,8 @@ impl Inputs { for input in self.inputs.iter() { let metadata = get_input_metadata(input)?; - if auto_resize { - if let Some((resize_width, _)) = self.resize { - if metadata.width > resize_width { - self.resize = Some((metadata.width, metadata.height)); - } - } else { - self.resize = Some((metadata.width, metadata.height)); - } + if auto_resize && metadata.width > self.resize.map(|(width, _)| width).unwrap_or(0) { + self.resize = Some((metadata.width, metadata.height)); } input_metadata.push(metadata);