aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-20 14:01:22 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-06-20 14:26:34 +0200
commit50ee17340b9fc2aca04fb41169ef90a290248141 (patch)
tree817e85ac0dc685f7a1efaa71dede785f30987dee
parentbb9f4f94ace54ba0f06a1d89c558697f11d6c69d (diff)
downloadffmpeg-50ee17340b9fc2aca04fb41169ef90a290248141.tar.gz
avfilter/formats: Add test for ff_parse_channel_layout()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavfilter/formats.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 4f9773bd15..2451bf70c9 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -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;
}