channel_layout: add support for Ambisonic

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Vittorio Giovara
2017-05-01 15:30:35 -04:00
committed by James Almer
parent 2f8ccca2fa
commit 886847afa0
4 changed files with 294 additions and 5 deletions

View File

@@ -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);