[FFmpeg-cvslog] avutil/tests/channel_layout: add some av_channel_from_string and av_channel_layout_from_string tests

Marton Balint git at videolan.org
Sat Mar 16 22:07:10 EET 2024


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sat Mar  9 00:13:43 2024 +0100| [0b3b8a19187cfa5a1671f4dc02d24e5681e3a01b] | committer: Marton Balint

avutil/tests/channel_layout: add some av_channel_from_string and av_channel_layout_from_string tests

We lacked tests which supposed to fail, and there are some which should fail
but right now it does not. This will be fixed in a later commit.

Signed-off-by: Marton Balint <cus at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0b3b8a19187cfa5a1671f4dc02d24e5681e3a01b
---

 libavutil/tests/channel_layout.c | 26 ++++++++++++++++++++++++++
 tests/ref/fate/channel_layout    | 26 ++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)

diff --git a/libavutil/tests/channel_layout.c b/libavutil/tests/channel_layout.c
index d62b69a5db..14d36c71b5 100644
--- a/libavutil/tests/channel_layout.c
+++ b/libavutil/tests/channel_layout.c
@@ -255,6 +255,11 @@ int main(void)
     CHANNEL_FROM_STRING("USR63");
     CHANNEL_FROM_STRING("AMBI0");
     CHANNEL_FROM_STRING("AMBI1023");
+    CHANNEL_FROM_STRING("AMBI1024");
+    CHANNEL_FROM_STRING("Dummy");
+    CHANNEL_FROM_STRING("FL at Foo");
+    CHANNEL_FROM_STRING("Foo at FL");
+    CHANNEL_FROM_STRING("@FL");
 
     printf("\n==Native layouts==\n");
 
@@ -301,6 +306,9 @@ int main(void)
     CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "SL");
     CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "SR");
     CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "BC");
+    CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "@");
+    CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "@Foo");
+    CHANNEL_LAYOUT_CHANNEL_FROM_STRING(bp.str, "FL at Foo");
 
     printf("\nTesting av_channel_layout_index_from_string\n");
     CHANNEL_LAYOUT_INDEX_FROM_STRING(bp.str, "FL");
@@ -321,9 +329,27 @@ int main(void)
     printf("\nTesting av_channel_layout_from_string\n");
     CHANNEL_LAYOUT_FROM_STRING("FL+FR+FC+BL+BR+LFE");
     CHANNEL_LAYOUT_FROM_STRING("2 channels (FR+FL)");
+    CHANNEL_LAYOUT_FROM_STRING("2 channels (AMBI1023+FL)");
+    CHANNEL_LAYOUT_FROM_STRING("3 channels (FR+FL)");
+    CHANNEL_LAYOUT_FROM_STRING("-3 channels (FR+FL)");
+    CHANNEL_LAYOUT_FROM_STRING("0 channels ()");
+    CHANNEL_LAYOUT_FROM_STRING("2 channels (FL+FR");
     CHANNEL_LAYOUT_FROM_STRING("ambisonic 1+FR+FL");
     CHANNEL_LAYOUT_FROM_STRING("ambisonic 2+FC at Foo");
     CHANNEL_LAYOUT_FROM_STRING("FL at Foo+FR@Bar");
+    CHANNEL_LAYOUT_FROM_STRING("FL+stereo");
+    CHANNEL_LAYOUT_FROM_STRING("stereo+stereo");
+    CHANNEL_LAYOUT_FROM_STRING("stereo at Boo");
+    CHANNEL_LAYOUT_FROM_STRING("");
+    CHANNEL_LAYOUT_FROM_STRING("@");
+    CHANNEL_LAYOUT_FROM_STRING("@Dummy");
+    CHANNEL_LAYOUT_FROM_STRING("@FL");
+    CHANNEL_LAYOUT_FROM_STRING("Dummy");
+    CHANNEL_LAYOUT_FROM_STRING("Dummy at FL");
+    CHANNEL_LAYOUT_FROM_STRING("FR+Dummy");
+    CHANNEL_LAYOUT_FROM_STRING("FR+Dummy at FL");
+    CHANNEL_LAYOUT_FROM_STRING("FR+ at FL");
+    CHANNEL_LAYOUT_FROM_STRING("FL+@");
     CHANNEL_LAYOUT_FROM_STRING("FR+FL at Foo+USR63@Foo");
 
     ret = av_channel_layout_copy(&layout2, &layout);
diff --git a/tests/ref/fate/channel_layout b/tests/ref/fate/channel_layout
index b98ccdb0f0..ea7ec6fa3c 100644
--- a/tests/ref/fate/channel_layout
+++ b/tests/ref/fate/channel_layout
@@ -56,6 +56,11 @@ With "FR":                                         1
 With "USR63":                                     63
 With "AMBI0":                                   1024
 With "AMBI1023":                                2047
+With "AMBI1024":                                  -1
+With "Dummy":                                     -1
+With "FL at Foo":                                    -1
+With "Foo at FL":                                    -1
+With "@FL":                                       -1
 
 ==Native layouts==
 
@@ -101,6 +106,9 @@ On "5.1(side)" layout with "LFE":                  3
 On "5.1(side)" layout with "SL":                   9
 On "5.1(side)" layout with "SR":                  10
 On "5.1(side)" layout with "BC":                  -1
+On "5.1(side)" layout with "@":                   -1
+On "5.1(side)" layout with "@Foo":                -1
+On "5.1(side)" layout with "FL at Foo":              -1
 
 Testing av_channel_layout_index_from_string
 On "5.1(side)" layout with "FL":                  0
@@ -121,9 +129,27 @@ On "5.1(side)" layout with AV_CH_LAYOUT_4POINT1:  0xf
 Testing av_channel_layout_from_string
 With "FL+FR+FC+BL+BR+LFE":                6 channels (FL+FR+FC+BL+BR+LFE)
 With "2 channels (FR+FL)":                             2 channels (FR+FL)
+With "2 channels (AMBI1023+FL)":                                     fail
+With "3 channels (FR+FL)":                                           fail
+With "-3 channels (FR+FL)":                                          fail
+With "0 channels ()":                                                fail
+With "2 channels (FL+FR":                                            fail
 With "ambisonic 1+FR+FL":                  ambisonic 1+2 channels (FR+FL)
 With "ambisonic 2+FC at Foo":                ambisonic 2+1 channels (FC at Foo)
 With "FL at Foo+FR@Bar":                          2 channels (FL at Foo+FR@Bar)
+With "FL+stereo":                                                    fail
+With "stereo+stereo":                                                fail
+With "stereo at Boo":                                                   fail
+With "":                                                             fail
+With "@":                                                            fail
+With "@Dummy":                                                       fail
+With "@FL":                                               1 channels (FL)
+With "Dummy":                                                        fail
+With "Dummy at FL":                                                     fail
+With "FR+Dummy":                                                     fail
+With "FR+Dummy at FL":                                       1 channels (FR)
+With "FR+ at FL":                                      2 channels (FR+FL at FL)
+With "FL+@":                                                         fail
 With "FR+FL at Foo+USR63@Foo":              3 channels (FR+FL at Foo+USR63@Foo)
 
 Testing av_channel_layout_index_from_string



More information about the ffmpeg-cvslog mailing list