Go to the documentation of this file.
39 {24, 1}, {25, 1}, {30, 1}, {48, 1}, {50, 1}, {60, 1},
40 {100, 1}, {120, 1}, {150, 1},
41 {30000, 1001}, {15, 1}, {12, 1},
45 printf(
"check_frame_rate %d/%d: %d\n",
69 printf(
"init %d/%d flags:%d start:%d: ",
70 cases[
i].rate.num, cases[
i].rate.den, cases[
i].flags, cases[
i].start);
74 printf(
"ok fps=%d start=%d rate=%d/%d\n",
87 printf(
"from_components 25/1 00:00:00:00: %d start=%d\n",
ret, tc.
start);
91 printf(
"from_components 25/1 01:00:00:00: %d start=%d\n",
ret, tc.
start);
95 printf(
"from_components 30/1 01:02:03:04: %d start=%d\n",
ret, tc.
start);
100 printf(
"from_components 30000/1001 drop 01:00:00;00: %d start=%d\n",
110 "00:01:02:03",
NULL);
111 printf(
"from_string 30/1 00:01:02:03: %d drop=%d start=%d\n",
115 "00:01:00;02",
NULL);
116 printf(
"from_string 30000/1001 00:01:00;02: %d drop=%d\n",
120 "01:00:00.00",
NULL);
121 printf(
"from_string 30000/1001 01:00:00.00: %d drop=%d\n",
126 printf(
"from_string 25/1 notvalid: %s\n",
ret < 0 ?
"error" :
"ok");
143 printf(
"make_string 25/1 24hwrap %d: %s\n",
148 printf(
"make_string 30000/1001 drop 0: %s\n",
153 printf(
"make_string 25/1 negative start -100 frame 0: %s\n",
164 printf(
"smpte_tc 30/1 01:02:03:04: %s\n",
169 25 * 3600 + 25 * 60 + 25 + 5);
170 printf(
"smpte_from_framenum 25/1 91530: %s\n",
180 printf(
"smpte_tc2 50/1 00:00:00:00: %s\n",
185 printf(
"smpte_tc2 60/1 01:00:00:00: %s\n",
194 uint32_t tc25 = (1
u << 19) | (2
u << 13) | (3
u << 6) | 4
u;
195 printf(
"mpeg_tc 01:02:03:04: %s\n",
198 uint32_t tc25_drop = tc25 | (1
u << 24);
199 printf(
"mpeg_tc drop 01:02:03:04: %s\n",
205 static const struct {
217 printf(
"adjust_ntsc %d %d: %d\n",
218 cases[
i].framenum, cases[
i].fps,
231 printf(
"smpte_roundtrip 30/1 12:34:56:07: %s / %s\n",
237 printf(
"smpte_roundtrip 30/1 00:00:00:00: %s / %s\n",
243 printf(
"smpte_roundtrip 30000/1001 drop bit30=%d: %s / %s\n",
244 !!(smpte & (1
u << 30)),
251 printf(
"smpte_roundtrip 50/1 field bit7=%d: %s / %s\n",
252 !!(smpte & (1
u << 7)),
258 printf(
"smpte_roundtrip 60000/1001 field bit23=%d: %s / %s\n",
259 !!(smpte & (1
u << 23)),
#define AV_TIMECODE_STR_SIZE
static void test_make_string(void)
int av_timecode_check_frame_rate(AVRational rate)
Check if the timecode feature is available for the given frame rate.
__device__ int printf(const char *,...)
char * av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_df)
Get the timecode string from the SMPTE timecode format.
static void test_get_smpte_roundtrip(void)
#define u(width, name, range_min, range_max)
uint32_t flags
flags such as drop frame, +24 hours support, ...
uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss, int ff)
Convert sei info to SMPTE 12M binary representation.
int start
timecode frame start (first base frame number)
#define FF_ARRAY_ELEMS(a)
int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx)
Init a timecode struct with the passed parameters.
int av_timecode_adjust_ntsc_framenum2(int framenum, int fps)
Adjust frame number for NTSC drop frame time code.
static void test_adjust_ntsc(void)
static void test_make_smpte_tc_string(void)
Rational number (pair of numerator and denominator).
static void test_init_from_components(void)
unsigned fps
frame per second; must be consistent with the rate field
AVRational rate
frame rate in rational form
int av_timecode_init_from_components(AVTimecode *tc, AVRational rate, int flags, int hh, int mm, int ss, int ff, void *log_ctx)
Init a timecode struct from the passed timecode components.
#define i(width, name, range_min, range_max)
static void test_init(void)
@ AV_TIMECODE_FLAG_24HOURSMAX
timecode wraps after 24 hours
uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum)
Convert frame number to SMPTE 12M binary representation.
char * av_timecode_make_smpte_tc_string2(char *buf, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field)
Get the timecode string from the SMPTE timecode format.
static void test_make_smpte_tc_string2(void)
@ AV_TIMECODE_FLAG_ALLOWNEGATIVE
negative time values are allowed
static void test_make_mpeg_tc_string(void)
static void test_init_from_string(void)
@ AV_TIMECODE_FLAG_DROPFRAME
timecode is drop frame
char * av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit)
Get the timecode string from the 25-bit timecode format (MPEG GOP format).
static void test_check_frame_rate(void)
Unit tests for libavutil/timecode.c: av_timecode_init, av_timecode_init_from_components,...
int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx)
Parse timecode representation (hh:mm:ss[:;.
char * av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum_arg)
Load timecode string in buf.