@@ -22,7 +22,7 @@ static constexpr std::array<double, 2> dropframe_timecode_rates{ {
2222// ST 12-1:2014 - SMPTE Standard - Time and Control Code
2323// https://ieeexplore.ieee.org/document/7291029
2424//
25- static constexpr std::array<double , 11 > smpte_timecode_rates{
25+ static constexpr std::array<double , 22 > smpte_timecode_rates{
2626 { 24000.0 / 1001.0 ,
2727 24.0 ,
2828 25.0 ,
@@ -32,19 +32,19 @@ static constexpr std::array<double, 11> smpte_timecode_rates{
3232 48.0 ,
3333 50.0 ,
3434 60000.0 / 1001.0 ,
35- 60.0
36- 72.0
35+ 60.0 ,
3736 72000.0 / 1001.0 ,
38- 96.0
37+ 72.0 ,
3938 96000.0 / 1001.0 ,
40- 120.0
39+ 96.0 ,
4140 120000.0 / 1001.0 ,
42- 144.0
41+ 120.0 ,
4342 144000.0 / 1001.0 ,
44- 192.0
43+ 144.0 ,
4544 192000.0 / 1001.0 ,
46- 240.0
45+ 192.0 ,
4746 240000.0 / 1001.0 ,
47+ 240.0
4848 }
4949};
5050
@@ -470,7 +470,7 @@ RationalTime::to_timecode(
470470 // so as a convenience we will snap the rate to the nearest
471471 // SMPTE rate if it is close enough.
472472 double nearest_smpte_rate = nearest_smpte_timecode_rate (rate);
473- double error_margin = nearest_smpte_rate * 0.002
473+ double error_margin = nearest_smpte_rate * 0.002 ;
474474 if (abs (nearest_smpte_rate - rate) > error_margin)
475475 {
476476 if (error_status)
@@ -575,8 +575,11 @@ RationalTime::to_timecode(
575575 int hours =
576576 static_cast <int >(std::floor (std::floor (seconds_total / 60 ) / 60 ));
577577
578+ std::string frames_digits = (nominal_fps < 100 ) ? " 2" : " 3" ;
579+ std::string timecode_format_string = " %02d:%02d:%02d%c%0" +frames_digits+" d" ;
580+
578581 return string_printf (
579- " %02d:%02d:%02d%c%02d " ,
582+ timecode_format_string. c_str () ,
580583 hours,
581584 minutes,
582585 seconds,
0 commit comments