mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-03-11 06:58:18 +00:00
parseutils-test: Move some variable declarations to avoid block braces
This commit is contained in:
parent
52385410b7
commit
a84713e70d
@ -659,94 +659,90 @@ int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
printf("Testing av_parse_video_rate()\n");
|
int i;
|
||||||
{
|
uint8_t rgba[4];
|
||||||
int i;
|
static const char *const rates[] = {
|
||||||
static const char *const rates[] = {
|
"-inf",
|
||||||
"-inf",
|
"inf",
|
||||||
"inf",
|
"nan",
|
||||||
"nan",
|
"123/0",
|
||||||
"123/0",
|
"-123 / 0",
|
||||||
"-123 / 0",
|
"",
|
||||||
"",
|
"/",
|
||||||
"/",
|
" 123 / 321",
|
||||||
" 123 / 321",
|
"foo/foo",
|
||||||
"foo/foo",
|
"foo/1",
|
||||||
"foo/1",
|
"1/foo",
|
||||||
"1/foo",
|
"0/0",
|
||||||
"0/0",
|
"/0",
|
||||||
"/0",
|
"1/",
|
||||||
"1/",
|
"1",
|
||||||
"1",
|
"0",
|
||||||
"0",
|
"-123/123",
|
||||||
"-123/123",
|
"-foo",
|
||||||
"-foo",
|
"123.23",
|
||||||
"123.23",
|
".23",
|
||||||
".23",
|
"-.23",
|
||||||
"-.23",
|
"-0.234",
|
||||||
"-0.234",
|
"-0.0000001",
|
||||||
"-0.0000001",
|
" 21332.2324 ",
|
||||||
" 21332.2324 ",
|
" -21332.2324 ",
|
||||||
" -21332.2324 ",
|
};
|
||||||
};
|
static const char *const color_names[] = {
|
||||||
|
"foo",
|
||||||
|
"red",
|
||||||
|
"Red ",
|
||||||
|
"RED",
|
||||||
|
"Violet",
|
||||||
|
"Yellow",
|
||||||
|
"Red",
|
||||||
|
"0x000000",
|
||||||
|
"0x0000000",
|
||||||
|
"0xff000000",
|
||||||
|
"0x3e34ff",
|
||||||
|
"0x3e34ffaa",
|
||||||
|
"0xffXXee",
|
||||||
|
"0xfoobar",
|
||||||
|
"0xffffeeeeeeee",
|
||||||
|
"#ff0000",
|
||||||
|
"#ffXX00",
|
||||||
|
"ff0000",
|
||||||
|
"ffXX00",
|
||||||
|
"red@foo",
|
||||||
|
"random@10",
|
||||||
|
"0xff0000@1.0",
|
||||||
|
"red@",
|
||||||
|
"red@0xfff",
|
||||||
|
"red@0xf",
|
||||||
|
"red@2",
|
||||||
|
"red@0.1",
|
||||||
|
"red@-1",
|
||||||
|
"red@0.5",
|
||||||
|
"red@1.0",
|
||||||
|
"red@256",
|
||||||
|
"red@10foo",
|
||||||
|
"red@-1.0",
|
||||||
|
"red@-0.0",
|
||||||
|
};
|
||||||
|
|
||||||
for (i = 0; i < FF_ARRAY_ELEMS(rates); i++) {
|
printf("Testing av_parse_video_rate()\n");
|
||||||
int ret;
|
|
||||||
AVRational q = { 0, 0 };
|
for (i = 0; i < FF_ARRAY_ELEMS(rates); i++) {
|
||||||
ret = av_parse_video_rate(&q, rates[i]);
|
int ret;
|
||||||
printf("'%s' -> %d/%d %s\n",
|
AVRational q = { 0, 0 };
|
||||||
rates[i], q.num, q.den, ret ? "ERROR" : "OK");
|
ret = av_parse_video_rate(&q, rates[i]);
|
||||||
}
|
printf("'%s' -> %d/%d %s\n",
|
||||||
|
rates[i], q.num, q.den, ret ? "ERROR" : "OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\nTesting av_parse_color()\n");
|
printf("\nTesting av_parse_color()\n");
|
||||||
{
|
|
||||||
int i;
|
|
||||||
uint8_t rgba[4];
|
|
||||||
static const char *const color_names[] = {
|
|
||||||
"foo",
|
|
||||||
"red",
|
|
||||||
"Red ",
|
|
||||||
"RED",
|
|
||||||
"Violet",
|
|
||||||
"Yellow",
|
|
||||||
"Red",
|
|
||||||
"0x000000",
|
|
||||||
"0x0000000",
|
|
||||||
"0xff000000",
|
|
||||||
"0x3e34ff",
|
|
||||||
"0x3e34ffaa",
|
|
||||||
"0xffXXee",
|
|
||||||
"0xfoobar",
|
|
||||||
"0xffffeeeeeeee",
|
|
||||||
"#ff0000",
|
|
||||||
"#ffXX00",
|
|
||||||
"ff0000",
|
|
||||||
"ffXX00",
|
|
||||||
"red@foo",
|
|
||||||
"random@10",
|
|
||||||
"0xff0000@1.0",
|
|
||||||
"red@",
|
|
||||||
"red@0xfff",
|
|
||||||
"red@0xf",
|
|
||||||
"red@2",
|
|
||||||
"red@0.1",
|
|
||||||
"red@-1",
|
|
||||||
"red@0.5",
|
|
||||||
"red@1.0",
|
|
||||||
"red@256",
|
|
||||||
"red@10foo",
|
|
||||||
"red@-1.0",
|
|
||||||
"red@-0.0",
|
|
||||||
};
|
|
||||||
|
|
||||||
av_log_set_level(AV_LOG_DEBUG);
|
av_log_set_level(AV_LOG_DEBUG);
|
||||||
|
|
||||||
for (i = 0; i < FF_ARRAY_ELEMS(color_names); i++) {
|
for (i = 0; i < FF_ARRAY_ELEMS(color_names); i++) {
|
||||||
if (av_parse_color(rgba, color_names[i], -1, NULL) >= 0)
|
if (av_parse_color(rgba, color_names[i], -1, NULL) >= 0)
|
||||||
printf("%s -> R(%d) G(%d) B(%d) A(%d)\n",
|
printf("%s -> R(%d) G(%d) B(%d) A(%d)\n",
|
||||||
color_names[i], rgba[0], rgba[1], rgba[2], rgba[3]);
|
color_names[i], rgba[0], rgba[1], rgba[2], rgba[3]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user