avfilter/formats: Add test for ff_parse_channel_layout()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-06-20 14:01:22 +02:00
parent bb9f4f94ac
commit 50ee17340b
1 changed files with 29 additions and 0 deletions

View File

@ -669,12 +669,41 @@ int main(void)
{
const int64_t *cl;
char buf[512];
int i;
const char *teststrings[] ={
"blah",
"1",
"2",
"-1",
"60",
"65",
"1c",
"2c",
"-1c",
"60c",
"65c",
"5.1",
"stereo",
"1+1+1+1",
"1c+1c+1c+1c",
"2c+1c",
"0x3",
};
for (cl = avfilter_all_channel_layouts; *cl != -1; cl++) {
av_get_channel_layout_string(buf, sizeof(buf), -1, *cl);
printf("%s\n", buf);
}
for ( i = 0; i<FF_ARRAY_ELEMS(teststrings); i++) {
int64_t layout = -1;
int count = -1;
int ret;
ret = ff_parse_channel_layout(&layout, &count, teststrings[i], NULL);
printf ("%d = ff_parse_channel_layout(%016"PRIX64", %2d, %s);\n", ret ? -1 : 0, layout, count, teststrings[i]);
}
return 0;
}