MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / av_timecode_get_smpte

Function av_timecode_get_smpte

libavutil/timecode.c:70–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss, int ff)
71{
72 uint32_t tc = 0;
73
74 /* For SMPTE 12-M timecodes, frame count is a special case if > 30 FPS.
75 See SMPTE ST 12-1:2014 Sec 12.1 for more info. */
76 if (av_cmp_q(rate, (AVRational) {30, 1}) == 1) {
77 if (ff % 2 == 1) {
78 if (av_cmp_q(rate, (AVRational) {50, 1}) == 0)
79 tc |= (1 << 7);
80 else
81 tc |= (1 << 23);
82 }
83 ff /= 2;
84 }
85
86 hh = hh % 24;
87 mm = av_clip(mm, 0, 59);
88 ss = av_clip(ss, 0, 59);
89 ff = ff % 40;
90
91 tc |= drop << 30;
92 tc |= (ff / 10) << 28;
93 tc |= (ff % 10) << 24;
94 tc |= (ss / 10) << 20;
95 tc |= (ss % 10) << 16;
96 tc |= (mm / 10) << 12;
97 tc |= (mm % 10) << 8;
98 tc |= (hh / 10) << 4;
99 tc |= (hh % 10);
100
101 return tc;
102}
103
104char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum_arg)
105{

Callers 3

h264_export_frame_propsFunction · 0.85
set_side_dataFunction · 0.85

Calls 1

av_cmp_qFunction · 0.85

Tested by

no test coverage detected