53 const int brevity_level,
54 const float time_seconds,
56 const short timecode_style)
58 int hours = 0, minutes = 0, seconds = 0, frames = 0;
59 float time = time_seconds;
70 if (
time >= 3600.0f) {
76 hours = (int)
time / 3600;
82 minutes = (int)
time / 60;
86 if (brevity_level <= 0) {
99 switch (timecode_style) {
107 if (brevity_level <= 0) {
111 str, maxncpy,
"%s%02d:%02d:%02d+%02d", neg, hours, minutes, seconds, frames);
115 str, maxncpy,
"%s%02d:%02d+%02d", neg, minutes, seconds, frames);
137 str, maxncpy,
"%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames);
148 const int ms_dp = (brevity_level <= 0) ? (1 - brevity_level) : 1;
152 const int s_pad = ms_dp + 3;
156 str, maxncpy,
"%s%02d:%02d:%0*.*f", neg, hours, minutes, s_pad, ms_dp,
time);
168 const int ms_dp = (brevity_level <= 0) ? (1 - brevity_level) : 1;
172 str, maxncpy,
"%s%02d:%02d:%02d,%0*d", neg, hours, minutes, seconds, ms_dp, ms);
178 if (brevity_level <= 0) {
190 str, maxncpy,
"%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames);
207 const size_t maxncpy,
208 const double time_seconds)
213 const int hr = ((int)time_seconds) / (60 * 60);
214 const int min = (((int)time_seconds) / 60) % 60;
215 const int sec = ((int)time_seconds) % 60;
216 const int hun = ((int)(fmod(time_seconds, 1.0) * 100));
241 const size_t maxncpy,
242 const int brevity_level,
243 const float time_seconds)
248 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
size_t BLI_snprintf(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)