You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avutil/timecode: cosmetics on av_timecode_get_smpte
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
@@ -71,31 +71,28 @@ uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum)
|
|||||||
uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss, int ff)
|
uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss, int ff)
|
||||||
{
|
{
|
||||||
uint32_t tc = 0;
|
uint32_t tc = 0;
|
||||||
uint32_t frames;
|
|
||||||
|
|
||||||
/* For SMPTE 12-M timecodes, frame count is a special case if > 30 FPS.
|
/* For SMPTE 12-M timecodes, frame count is a special case if > 30 FPS.
|
||||||
See SMPTE ST 12-1:2014 Sec 12.1 for more info. */
|
See SMPTE ST 12-1:2014 Sec 12.1 for more info. */
|
||||||
if (av_cmp_q(rate, (AVRational) {30, 1}) == 1) {
|
if (av_cmp_q(rate, (AVRational) {30, 1}) == 1) {
|
||||||
frames = ff / 2;
|
|
||||||
if (ff % 2 == 1) {
|
if (ff % 2 == 1) {
|
||||||
if (av_cmp_q(rate, (AVRational) {50, 1}) == 0)
|
if (av_cmp_q(rate, (AVRational) {50, 1}) == 0)
|
||||||
tc |= (1 << 7);
|
tc |= (1 << 7);
|
||||||
else
|
else
|
||||||
tc |= (1 << 23);
|
tc |= (1 << 23);
|
||||||
}
|
}
|
||||||
} else {
|
ff /= 2;
|
||||||
frames = ff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tc |= drop << 30;
|
tc |= drop << 30;
|
||||||
tc |= (frames / 10) << 28;
|
tc |= (ff / 10) << 28;
|
||||||
tc |= (frames % 10) << 24;
|
tc |= (ff % 10) << 24;
|
||||||
tc |= (ss / 10) << 20;
|
tc |= (ss / 10) << 20;
|
||||||
tc |= (ss % 10) << 16;
|
tc |= (ss % 10) << 16;
|
||||||
tc |= (mm / 10) << 12;
|
tc |= (mm / 10) << 12;
|
||||||
tc |= (mm % 10) << 8;
|
tc |= (mm % 10) << 8;
|
||||||
tc |= (hh / 10) << 4;
|
tc |= (hh / 10) << 4;
|
||||||
tc |= (hh % 10);
|
tc |= (hh % 10);
|
||||||
|
|
||||||
return tc;
|
return tc;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user