mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avutil/timecode: use timecode fps for number of frame digits
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
parent
8dd5bb7280
commit
0d666200d3
@ -104,7 +104,7 @@ char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum)
|
||||
{
|
||||
int fps = tc->fps;
|
||||
int drop = tc->flags & AV_TIMECODE_FLAG_DROPFRAME;
|
||||
int hh, mm, ss, ff, neg = 0;
|
||||
int hh, mm, ss, ff, ff_len, neg = 0;
|
||||
|
||||
framenum += tc->start;
|
||||
if (drop)
|
||||
@ -119,9 +119,10 @@ char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum)
|
||||
hh = framenum / (fps*3600LL);
|
||||
if (tc->flags & AV_TIMECODE_FLAG_24HOURSMAX)
|
||||
hh = hh % 24;
|
||||
snprintf(buf, AV_TIMECODE_STR_SIZE, "%s%02d:%02d:%02d%c%02d",
|
||||
ff_len = fps > 10000 ? 5 : fps > 1000 ? 4 : fps > 100 ? 3 : fps > 10 ? 2 : 1;
|
||||
snprintf(buf, AV_TIMECODE_STR_SIZE, "%s%02d:%02d:%02d%c%0*d",
|
||||
neg ? "-" : "",
|
||||
hh, mm, ss, drop ? ';' : ':', ff);
|
||||
hh, mm, ss, drop ? ';' : ':', ff_len, ff);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user