From f83b984f0a7647d4bccda20cde555e7b5e698589 Mon Sep 17 00:00:00 2001 From: Joshua Minor Date: Tue, 8 Nov 2022 11:15:02 -0800 Subject: [PATCH] Both is_valid_timecode and nearest_valid_timecode adhere to ST 12-1:2014 - SMPTE Standard - Time and Control Code. Signed-off-by: Joshua Minor --- src/opentime/rationalTime.cpp | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/opentime/rationalTime.cpp b/src/opentime/rationalTime.cpp index bc4b404090..7ee9348bc9 100644 --- a/src/opentime/rationalTime.cpp +++ b/src/opentime/rationalTime.cpp @@ -18,39 +18,28 @@ static constexpr std::array 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 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 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; }