26 const int brevity_level,
27 const float time_seconds,
29 const short timecode_style)
31 int hours = 0, minutes = 0, seconds = 0, frames = 0;
32 float time = time_seconds;
43 if (time >= 3600.0f) {
49 hours = int(time) / 3600;
50 time =
fmodf(time, 3600);
55 minutes = int(time) / 60;
56 time =
fmodf(time, 60);
59 if (brevity_level <= 0) {
65 frames =
round_fl_to_int(
float((
double(time) -
double(seconds)) * fps));
72 switch (timecode_style) {
81 if (brevity_level <= 0) {
85 str, maxncpy,
"%s%02d:%02d:%02d+%02d", neg, hours, minutes, seconds, frames);
89 str, maxncpy,
"%s%02d:%02d+%02d", neg, minutes, seconds, frames);
111 str, maxncpy,
"%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames);
122 const int ms_dp = (brevity_level <= 0) ? (1 - brevity_level) : 1;
126 const int s_pad = ms_dp + 3;
130 str, maxncpy,
"%s%02d:%02d:%0*.*f", neg, hours, minutes, s_pad, ms_dp, time);
142 const int ms_dp = (brevity_level <= 0) ? (1 - brevity_level) : 1;
146 str, maxncpy,
"%s%02d:%02d:%02d,%0*d", neg, hours, minutes, seconds, ms_dp, ms);
152 if (brevity_level <= 0) {
164 str, maxncpy,
"%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames);
size_t BLI_timecode_string_from_time(char *str, size_t maxncpy, int brevity_level, float time_seconds, double fps, short timecode_style) ATTR_NONNULL()