Skip to content

Commit

Permalink
Both is_valid_timecode and nearest_valid_timecode adhere to ST 12-1:2…
Browse files Browse the repository at this point in the history
…014 - SMPTE Standard - Time and Control Code.

Signed-off-by: Joshua Minor <[email protected]>
  • Loading branch information
jminor committed May 11, 2023
1 parent 661a556 commit 9c88ba3
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions src/opentime/rationalTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,28 @@ static constexpr std::array<double, 2> dropframe_timecode_rates{ {
60000.0 / 1001.0,
} };

// See the official source of these numbers here:
// ST 12-1:2014 - SMPTE Standard - Time and Control Code
// https://ieeexplore.ieee.org/document/7291029
//
static constexpr std::array<double, 11> smpte_timecode_rates{
{ 1.0,
12.0,
24000.0 / 1001.0,
{ 24000.0 / 1001.0,
24.0,
25.0,
30000.0 / 1001.0,
30.0,
48000.0 / 1001.0,
48.0,
50.0,
60000.0 / 1001.0,
60.0 }
};

static constexpr std::array<double, 12> valid_timecode_rates{
{ 1.0,
12.0,
24000.0 / 1001.0,
24.0,
25.0,
29.97,
30000.0 / 1001.0,
30.0,
48.0,
50.0,
60000.0 / 1001.0,
60.0 }
60.0
}
};

bool
RationalTime::is_valid_timecode_rate(double fps)
{
auto b = valid_timecode_rates.begin(), e = valid_timecode_rates.end();
auto b = smpte_timecode_rates.begin(), e = smpte_timecode_rates.end();
return std::find(b, e, fps) != e;
}

Expand Down

0 comments on commit 9c88ba3

Please sign in to comment.