This commit is contained in:
Ericson Soares 2024-12-10 12:37:14 -03:00
parent 8b3e9a1408
commit dd56820898

View File

@ -232,16 +232,16 @@ fn thumb_scale_filter_args(
// if the pixel aspect ratio is defined and is not 1, we have an anamorphic stream // if the pixel aspect ratio is defined and is not 1, we have an anamorphic stream
if pixel_aspect_ratio.num != 0 && pixel_aspect_ratio.num != pixel_aspect_ratio.den { if pixel_aspect_ratio.num != 0 && pixel_aspect_ratio.num != pixel_aspect_ratio.den {
match std::panic::catch_unwind(|| { match std::panic::catch_unwind(|| {
width width
.checked_mul(pixel_aspect_ratio.num.unsigned_abs()) .checked_mul(pixel_aspect_ratio.num.unsigned_abs())
.and_then(|v| v.checked_div(pixel_aspect_ratio.den.unsigned_abs())) .and_then(|v| v.checked_div(pixel_aspect_ratio.den.unsigned_abs()))
}) { }) {
Ok(Some(w)) => width = w, Ok(Some(w)) => width = w,
Ok(None) | Err(_) => { Ok(None) | Err(_) => {
eprintln!("Warning: Failed to calculate width with pixel aspect ratio"); eprintln!("Warning: Failed to calculate width with pixel aspect ratio");
// Keep the original width as fallback // Keep the original width as fallback
} }
}; };
if size != 0 { if size != 0 {
if height > width { if height > width {
width = (width * size) / height; width = (width * size) / height;