24 const int brevity_level,
25 const float time_seconds,
27 const short timecode_style)
29 int hours = 0, minutes = 0, seconds = 0, frames = 0;
30 float time = time_seconds;
41 if (time >= 3600.0f) {
47 hours = int(time) / 3600;
48 time =
fmodf(time, 3600);
53 minutes = int(time) / 60;
54 time =
fmodf(time, 60);
57 if (brevity_level <= 0) {
63 frames =
round_fl_to_int(
float((
double(time) -
double(seconds)) * fps));
70 switch (timecode_style) {
79 if (brevity_level <= 0) {
83 str, maxncpy,
"%s%02d:%02d:%02d+%02d", neg, hours, minutes, seconds, frames);
87 str, maxncpy,
"%s%02d:%02d+%02d", neg, minutes, seconds, frames);
109 str, maxncpy,
"%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames);
120 const int ms_dp = (brevity_level <= 0) ? (1 - brevity_level) : 1;
124 const int s_pad = ms_dp + 3;
128 str, maxncpy,
"%s%02d:%02d:%0*.*f", neg, hours, minutes, s_pad, ms_dp, time);
140 const int ms_dp = (brevity_level <= 0) ? (1 - brevity_level) : 1;
144 str, maxncpy,
"%s%02d:%02d:%02d,%0*d", neg, hours, minutes, seconds, ms_dp, ms);
150 if (brevity_level <= 0) {
162 str, maxncpy,
"%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames);
size_t BLI_timecode_string_from_time(char *str, const size_t maxncpy, const int brevity_level, const float time_seconds, const double fps, const short timecode_style)