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;
53 minutes = (int)
time / 60;
57 if (brevity_level <= 0) {
70 switch (timecode_style) {
78 if (brevity_level <= 0) {
82 str, maxncpy,
"%s%02d:%02d:%02d+%02d", neg, hours, minutes, seconds, frames);
86 str, maxncpy,
"%s%02d:%02d+%02d", neg, minutes, seconds, frames);
108 str, maxncpy,
"%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames);
119 const int ms_dp = (brevity_level <= 0) ? (1 - brevity_level) : 1;
123 const int s_pad = ms_dp + 3;
127 str, maxncpy,
"%s%02d:%02d:%0*.*f", neg, hours, minutes, s_pad, ms_dp,
time);
139 const int ms_dp = (brevity_level <= 0) ? (1 - brevity_level) : 1;
143 str, maxncpy,
"%s%02d:%02d:%02d,%0*d", neg, hours, minutes, seconds, ms_dp, ms);
149 if (brevity_level <= 0) {
161 str, maxncpy,
"%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames);
170 const size_t maxncpy,
171 const double time_seconds)
176 const int hr = ((int)time_seconds) / (60 * 60);
177 const int min = (((int)time_seconds) / 60) % 60;
178 const int sec = ((int)time_seconds) % 60;
179 const int hun = ((int)(fmod(time_seconds, 1.0) * 100));
192 const size_t maxncpy,
193 const int brevity_level,
194 const float time_seconds)
199 if (brevity_level <= 0) {
MINLINE int round_fl_to_int(float a)
Strict compiler flags for areas of code we want to ensure don't do conversions without us knowing abo...
size_t BLI_snprintf_rlen(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
@ USER_TIMECODE_SMPTE_FULL
@ USER_TIMECODE_SECONDS_ONLY
@ USER_TIMECODE_MILLISECONDS
@ USER_TIMECODE_SMPTE_MSF
size_t BLI_timecode_string_from_time_simple(char *str, const size_t maxncpy, const double time_seconds)
size_t BLI_timecode_string_from_time_seconds(char *str, const size_t maxncpy, const int brevity_level, const float time_seconds)
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)