From 676b80dd983949a52091da1cb65fe9efbec3db1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Garramu=C3=B1o?= Date: Tue, 26 Mar 2024 21:48:47 -0300 Subject: [PATCH] Fixed reading of OpenEXR's new rational FramesPerSecond attribute. --- lib/tlIO/OpenEXRRead.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/tlIO/OpenEXRRead.cpp b/lib/tlIO/OpenEXRRead.cpp index cc23fa1b..f9d6b76f 100644 --- a/lib/tlIO/OpenEXRRead.cpp +++ b/lib/tlIO/OpenEXRRead.cpp @@ -15,6 +15,7 @@ #include #include +#include namespace tl { @@ -495,12 +496,21 @@ namespace tl { io::Info out = File(fileName, memory, _channelGrouping, _ignoreDisplayWindow, _logSystem.lock()).getInfo(); float speed = _defaultSpeed; - const auto i = out.tags.find("Frame Per Second"); + auto i = out.tags.find("Frame Per Second"); if (i != out.tags.end()) { locale::SetAndRestore saved; speed = std::stof(i->second); } + i = out.tags.find("FramesPerSecond"); + if (i != out.tags.end()) + { + int num = 1; + int den = 24; + std::stringstream s(i->second); + s >> num >> den; + speed = static_cast(num) / static_cast(den); + } out.videoTime = otime::TimeRange::range_from_start_end_time_inclusive( otime::RationalTime(_startFrame, speed), otime::RationalTime(_endFrame, speed));