diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2017-05-01 15:30:35 -0400 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-15 09:42:47 -0300 |
commit | 886847afa029cca3e10ceae2b2f5da0cf7a36d5c (patch) | |
tree | 44a7d82ecdc2a1196388442c4955700866cbc9c6 /libavutil/tests | |
parent | 2f8ccca2fa94ce256ff77baa18f462c1abd8d2cc (diff) | |
download | ffmpeg-886847afa029cca3e10ceae2b2f5da0cf7a36d5c.tar.gz |
channel_layout: add support for Ambisonic
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavutil/tests')
-rw-r--r-- | libavutil/tests/channel_layout.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/libavutil/tests/channel_layout.c b/libavutil/tests/channel_layout.c index 83d549a42c..4830c4c730 100644 --- a/libavutil/tests/channel_layout.c +++ b/libavutil/tests/channel_layout.c @@ -79,6 +79,10 @@ int main(void) printf("With AV_CHAN_FRONT_RIGHT: %26s\n", bp.str); CHANNEL_NAME(63); printf("With 63: %43s\n", bp.str); + CHANNEL_NAME(AV_CHAN_AMBISONIC_BASE); + printf("With AV_CHAN_AMBISONIC_BASE: %23s\n", bp.str); + CHANNEL_NAME(AV_CHAN_AMBISONIC_END); + printf("With AV_CHAN_AMBISONIC_END: %24s\n", bp.str); printf("Testing av_channel_description\n"); CHANNEL_DESCRIPTION(AV_CHAN_FRONT_LEFT); @@ -87,11 +91,17 @@ int main(void) printf("With AV_CHAN_FRONT_RIGHT: %26s\n", bp.str); CHANNEL_DESCRIPTION(63); printf("With 63: %43s\n", bp.str); + CHANNEL_DESCRIPTION(AV_CHAN_AMBISONIC_BASE); + printf("With AV_CHAN_AMBISONIC_BASE: %23s\n", bp.str); + CHANNEL_DESCRIPTION(AV_CHAN_AMBISONIC_END); + printf("With AV_CHAN_AMBISONIC_END: %24s\n", bp.str); printf("\nTesting av_channel_from_string\n"); printf("With \"FL\": %41d\n", av_channel_from_string("FL")); printf("With \"FR\": %41d\n", av_channel_from_string("FR")); printf("With \"USR63\": %38d\n", av_channel_from_string("USR63")); + printf("With \"AMBI0\": %38d\n", av_channel_from_string("AMBI0")); + printf("With \"AMBI1023\": %35d\n", av_channel_from_string("AMBI1023")); printf("\n==Native layouts==\n"); @@ -194,6 +204,8 @@ int main(void) printf("With \"FL+FR+FC+BL+BR+LFE\": %34s\n", bp.str); CHANNEL_LAYOUT_FROM_STRING("2 channels (FR+FL)"); printf("With \"2 channels (FR+FL)\": %34s\n", bp.str); + CHANNEL_LAYOUT_FROM_STRING("ambisonic 1+FR+FL"); + printf("With \"ambisonic 1+FR+FL\": %35s\n", bp.str); CHANNEL_LAYOUT_FROM_STRING("FL@Foo+FR@Bar"); printf("With \"FL@Foo+FR@Bar\": %39s\n", bp.str); CHANNEL_LAYOUT_FROM_STRING("FR+FL@Foo+USR63@Foo"); @@ -259,6 +271,34 @@ int main(void) CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(3); printf("On \"FR+FL@Foo+USR63@Foo\" layout with 3: %21d\n", ret); + printf("\n==Ambisonic layouts==\n"); + + printf("\nTesting av_channel_layout_from_string\n"); + CHANNEL_LAYOUT_FROM_STRING("ambisonic 1"); + printf("With \"ambisonic 1\": %41s\n", bp.str); + CHANNEL_LAYOUT_FROM_STRING("ambisonic 2+stereo"); + printf("With \"ambisonic 2+stereo\": %34s\n", bp.str); + + printf("\nTesting av_channel_layout_index_from_channel\n"); + CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(AV_CHAN_AMBISONIC_BASE); + printf("On \"ambisonic 2+stereo\" layout with AV_CHAN_AMBISONIC_BASE: %d\n", ret); + CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(AV_CHAN_FRONT_LEFT); + printf("On \"ambisonic 2+stereo\" layout with AV_CHAN_FRONT_LEFT: %5d\n", ret); + CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(AV_CHAN_FRONT_RIGHT); + printf("On \"ambisonic 2+stereo\" layout with AV_CHAN_FRONT_RIGHT: %4d\n", ret); + CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(AV_CHAN_BACK_CENTER); + printf("On \"ambisonic 2+stereo\" layout with AV_CHAN_BACK_CENTER: %4d\n", ret); + + printf("\nTesting av_channel_layout_channel_from_index\n"); + CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(0); + printf("On \"ambisonic 2+stereo\" layout with 0: %22d\n", ret); + CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(9); + printf("On \"ambisonic 2+stereo\" layout with 9: %22d\n", ret); + CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(10); + printf("On \"ambisonic 2+stereo\" layout with 10: %21d\n", ret); + CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(11); + printf("On \"ambisonic 2+stereo\" layout with 11: %21d\n", ret); + av_channel_layout_uninit(&layout); av_bprint_finalize(&bp, NULL); |