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

Should increase test coverage.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2022-03-25 10:01:23 -03:00
parent f9ed91abc9
commit 167c5a6afc
2 changed files with 51 additions and 1 deletions

View File

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