From 6840f1219d90c1c84fcc697c34481846de00af73 Mon Sep 17 00:00:00 2001 From: Jaro Habiger Date: Mon, 11 Mar 2024 19:45:40 +0100 Subject: [PATCH] =?UTF-8?q?CinemaDngReader:=E2=80=AFadd=20support=20for=20?= =?UTF-8?q?reading=20files=20with=20missing=20FPS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nodes_io/reader_cinema_dng.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/nodes_io/reader_cinema_dng.rs b/src/nodes_io/reader_cinema_dng.rs index de02d6b..d070d20 100644 --- a/src/nodes_io/reader_cinema_dng.rs +++ b/src/nodes_io/reader_cinema_dng.rs @@ -114,10 +114,11 @@ impl ProcessingNode for CinemaDngReader { bit_depth: get_tag_as_u32(tags::ifd::BitsPerSample)?, fps: dng .get_entry_by_path(&main_ifd.chain_tag(tags::ifd::FrameRate)) - .ok_or(anyhow!("couldnt read frame rate of DNG {path:?}"))? - .value - .as_f64() - .ok_or(anyhow!("couldnt interpret frame rate of DNG {path:?} as f64"))?, + .map(|entry| entry.value.as_f64().ok_or(anyhow!("couldnt interpret frame rate of DNG {path:?} as f64"))) + .unwrap_or_else(|| { + eprintln!("DNG has no fps, falling back to 24"); + Ok(24.0) + })?, cfa, };