Skip to content

Commit 2e9c94a

Browse files
committed
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 <[email protected]>
1 parent a0f8404 commit 2e9c94a

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

src/opentime/rationalTime.cpp

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,28 @@ static constexpr std::array<double, 2> dropframe_timecode_rates{ {
1818
60000.0 / 1001.0,
1919
} };
2020

21+
// See the official source of these numbers here:
22+
// ST 12-1:2014 - SMPTE Standard - Time and Control Code
23+
// https://ieeexplore.ieee.org/document/7291029
24+
//
2125
static constexpr std::array<double, 11> smpte_timecode_rates{
22-
{ 1.0,
23-
12.0,
24-
24000.0 / 1001.0,
26+
{ 24000.0 / 1001.0,
2527
24.0,
2628
25.0,
2729
30000.0 / 1001.0,
2830
30.0,
31+
48000.0 / 1001.0,
2932
48.0,
3033
50.0,
3134
60000.0 / 1001.0,
32-
60.0 }
33-
};
34-
35-
static constexpr std::array<double, 12> valid_timecode_rates{
36-
{ 1.0,
37-
12.0,
38-
24000.0 / 1001.0,
39-
24.0,
40-
25.0,
41-
29.97,
42-
30000.0 / 1001.0,
43-
30.0,
44-
48.0,
45-
50.0,
46-
60000.0 / 1001.0,
47-
60.0 }
35+
60.0
36+
}
4837
};
4938

5039
bool
5140
RationalTime::is_valid_timecode_rate(double fps)
5241
{
53-
auto b = valid_timecode_rates.begin(), e = valid_timecode_rates.end();
42+
auto b = smpte_timecode_rates.begin(), e = smpte_timecode_rates.end();
5443
return std::find(b, e, fps) != e;
5544
}
5645

0 commit comments

Comments
 (0)