39 static const char *
const rates[] = {
71 printf(
"'%s' -> %d/%d %s\n",
72 rates[i], q.
num, q.
den, ret ?
"ERROR" :
"OK");
123 printf(
"%s -> R(%d) G(%d) B(%d) A(%d)\n",
124 color_names[i], rgba[0], rgba[1], rgba[2], rgba[3]);
126 printf(
"%s -> error\n", color_names[i]);
133 struct tm tm = { 0 };
134 struct fmt_timespec_entry {
135 const char *
fmt, *timespec;
136 } fmt_timespec_entries[] = {
137 {
"%Y-%m-%d",
"2012-12-21" },
138 {
"%Y - %m - %d",
"2012-12-21" },
139 {
"%Y-%m-%d %H:%M:%S",
"2012-12-21 20:12:21" },
140 {
" %Y - %m - %d %H : %M : %S",
" 2012 - 12 - 21 20 : 12 : 21" },
141 {
" %Y - %b - %d %H : %M : %S",
" 2012 - nOV - 21 20 : 12 : 21" },
142 {
" %Y - %B - %d %H : %M : %S",
" 2012 - nOVemBeR - 21 20 : 12 : 21" },
143 {
" %Y - %B%d %H : %M : %S",
" 2012 - may21 20 : 12 : 21" },
144 {
" %Y - %B%d %H : %M : %S",
" 2012 - mby21 20 : 12 : 21" },
145 {
" %Y - %B - %d %H : %M : %S",
" 2012 - JunE - 21 20 : 12 : 21" },
146 {
" %Y - %B - %d %H : %M : %S",
" 2012 - Jane - 21 20 : 12 : 21" },
147 {
" %Y - %B - %d %H : %M : %S",
" 2012 - January - 21 20 : 12 : 21" },
153 struct fmt_timespec_entry *e = &fmt_timespec_entries[i];
154 printf(
"fmt:'%s' spec:'%s' -> ", e->fmt, e->timespec);
157 printf(
"%04d-%02d-%2d %02d:%02d:%02d\n",
158 1900+tm.tm_year, tm.tm_mon+1, tm.tm_mday,
159 tm.tm_hour, tm.tm_min, tm.tm_sec);
172 static char tzstr[] =
"TZ=CET-1";
173 static const char *
const time_string[] = {
176 "2000-12-20 0:02:47.5z",
177 "2012 - 02-22 17:44:07",
178 "2000-12-20T010247.6",
179 "2000-12-12 1:35:46+05:30",
180 "2002-12-12 22:30:40-02",
182 static const char *
const duration_string[] = {
192 printf(
"(now is 2012-03-17 09:14:13.2 +0100, local time is UTC+1)\n");
194 printf(
"%-24s -> ", time_string[i]);
200 printf(
"%14"PRIi64
".%06d = %04d-%02d-%02dT%02d:%02d:%02dZ\n",
201 tv / 1000000, (
int)(tv % 1000000),
202 tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
203 tm->tm_hour, tm->tm_min, tm->tm_sec);
207 printf(
"%-24s -> ", duration_string[i]);
211 printf(
"%+21"PRIi64
"\n", tv);
225 printf(
"%s -> R(%d) G(%d) B(%d) A(%d)\n",
226 color, rgba[0], rgba[1], rgba[2], rgba[3]);
228 printf(
"Color ID: %d not found\n", i);
234 static const char args[] =
"?tag1=val1&tag2=val2&tag3=val3&tag41=value 41&tag42=random1";
235 static const char *tags[] = {
"tag1",
"tag2",
"tag3",
"tag4",
"tag41",
"41",
"random1"};
241 printf(
"%d. %s found: %s\n", i, tags[i], buff);
243 printf(
"%d. %s not found\n", i, tags[i]);
249 printf(
"Testing av_parse_video_rate()\n");
252 printf(
"\nTesting av_parse_color()\n");
255 printf(
"\nTesting av_small_strptime()\n");
258 printf(
"\nTesting av_parse_time()\n");
261 printf(
"\nTesting av_get_known_color_name()\n");
264 printf(
"\nTesting av_find_info_tag()\n");
static uint32_t av_get_random_seed_deterministic(void)
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
void av_log_set_level(int level)
Set the log level.
static void test_av_parse_video_rate(void)
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
char * av_small_strptime(const char *p, const char *fmt, struct tm *dt)
Simplified version of strptime.
static void test_av_parse_color(void)
int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
Attempt to find a specific tag in a URL.
int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, void *log_ctx)
Put the RGBA values that correspond to color_string in rgba_color.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
const char * av_get_known_color_name(int color_idx, const uint8_t **rgbp)
Get the name of a color from the internal table of hard-coded named colors.
const char AVS_Value args
static void test_av_small_strptime(void)
#define FF_ARRAY_ELEMS(a)
static void test_av_parse_time(void)
static const ColorEntry color_table[]
static const char * color_names[NB_RANGES]
Rational number (pair of numerator and denominator).
static void test_av_get_known_color_name(void)
static void test_av_find_info_tag(void)
common internal and external API header
Utilties for rational number calculation.
#define MKTAG(a, b, c, d)