Skip to content

Commit

Permalink
Fixed reading of OpenEXR's new rational FramesPerSecond attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Mar 27, 2024
1 parent 56c6577 commit 676b80d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/tlIO/OpenEXRRead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <array>
#include <cstring>
#include <sstream>

namespace tl
{
Expand Down Expand Up @@ -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<double>(num) / static_cast<double>(den);
}
out.videoTime = otime::TimeRange::range_from_start_end_time_inclusive(
otime::RationalTime(_startFrame, speed),
otime::RationalTime(_endFrame, speed));
Expand Down

0 comments on commit 676b80d

Please sign in to comment.