[FFmpeg-cvslog] avutil/tests/channel_layout: test the output of av_channel_layout_standard()

James Almer git at videolan.org
Fri Mar 25 17:27:19 EET 2022


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri Mar 25 10:01:23 2022 -0300| [167c5a6afc52342e6b7fb836a5a7db069a6a42e0] | committer: James Almer

avutil/tests/channel_layout: test the output of av_channel_layout_standard()

Should increase test coverage.

Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavutil/tests/channel_layout.c | 21 ++++++++++++++++++++-
 tests/ref/fate/channel_layout    | 31 +++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/libavutil/tests/channel_layout.c b/libavutil/tests/channel_layout.c
index 89abd8b171..79d3a1caed 100644
--- a/libavutil/tests/channel_layout.c
+++ b/libavutil/tests/channel_layout.c
@@ -66,13 +66,32 @@
 
 int main(void)
 {
+    const AVChannelLayout *playout;
     AVChannelLayout layout = { 0 };
     AVBPrint bp;
+    void *iter = NULL;
     int ret;
 
     av_bprint_init(&bp, 64, AV_BPRINT_SIZE_AUTOMATIC);
 
-    printf("Testing av_channel_name\n");
+    printf("Testing av_channel_layout_standard\n");
+    while (playout = av_channel_layout_standard(&iter)) {
+        av_channel_layout_describe_bprint(playout, &bp);
+        printf("%-14s ", bp.str);
+        av_bprint_clear(&bp);
+        for (int i = 0; i < 63; i++) {
+            int idx = av_channel_layout_index_from_channel(playout, i);
+            if (idx >= 0) {
+                if (idx)
+                    av_bprintf(&bp, "+");
+                av_channel_name_bprint(&bp, i);
+            }
+        }
+        printf("%s\n", bp.str);
+        av_bprint_clear(&bp);
+    }
+
+    printf("\nTesting av_channel_name\n");
     CHANNEL_NAME(AV_CHAN_FRONT_LEFT);
     printf("With AV_CHAN_FRONT_LEFT: %27s\n", bp.str);
     CHANNEL_NAME(AV_CHAN_FRONT_RIGHT);
diff --git a/tests/ref/fate/channel_layout b/tests/ref/fate/channel_layout
index 806509246f..8e452da5a9 100644
--- a/tests/ref/fate/channel_layout
+++ b/tests/ref/fate/channel_layout
@@ -1,3 +1,34 @@
+Testing av_channel_layout_standard
+mono           FC
+stereo         FL+FR
+2.1            FL+FR+LFE
+3.0            FL+FR+FC
+3.0(back)      FL+FR+BC
+4.0            FL+FR+FC+BC
+quad           FL+FR+BL+BR
+quad(side)     FL+FR+SL+SR
+3.1            FL+FR+FC+LFE
+5.0            FL+FR+FC+BL+BR
+5.0(side)      FL+FR+FC+SL+SR
+4.1            FL+FR+FC+LFE+BC
+5.1            FL+FR+FC+LFE+BL+BR
+5.1(side)      FL+FR+FC+LFE+SL+SR
+6.0            FL+FR+FC+BC+SL+SR
+6.0(front)     FL+FR+FLC+FRC+SL+SR
+hexagonal      FL+FR+FC+BL+BR+BC
+6.1            FL+FR+FC+LFE+BC+SL+SR
+6.1(back)      FL+FR+FC+LFE+BL+BR+BC
+6.1(front)     FL+FR+LFE+FLC+FRC+SL+SR
+7.0            FL+FR+FC+BL+BR+SL+SR
+7.0(front)     FL+FR+FC+FLC+FRC+SL+SR
+7.1            FL+FR+FC+LFE+BL+BR+SL+SR
+7.1(wide)      FL+FR+FC+LFE+BL+BR+FLC+FRC
+7.1(wide-side) FL+FR+FC+LFE+FLC+FRC+SL+SR
+octagonal      FL+FR+FC+BL+BR+BC+SL+SR
+hexadecagonal  FL+FR+FC+BL+BR+BC+SL+SR+TFL+TFC+TFR+TBL+TBC+TBR+WL+WR
+downmix        DL+DR
+22.2           FL+FR+FC+LFE+BL+BR+FLC+FRC+BC+SL+SR+TC+TFL+TFC+TFR+TBL+TBC+TBR+LFE2+TSL+TSR+BFC+BFL+BFR
+
 Testing av_channel_name
 With AV_CHAN_FRONT_LEFT:                          FL
 With AV_CHAN_FRONT_RIGHT:                         FR



More information about the ffmpeg-cvslog mailing list