summaryrefslogtreecommitdiff
path: root/fftools/opt_common.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2022-03-25 08:42:45 -0300
committerJames Almer <jamrial@gmail.com>2022-03-25 08:42:45 -0300
commitb04f14136e54f2db167d341d9bda0e30d11320fd (patch)
tree6d32f87e54923ed29121c9d2fae455607c27de46 /fftools/opt_common.c
parent6e04ace7fe470f1351d8acd1af464d3688b4c115 (diff)
downloadffmpeg-b04f14136e54f2db167d341d9bda0e30d11320fd.tar.gz
fftools/opt_cmdutils: fix printing known channel layouts
Look for the generic "USR" labels instead of "?" to skip channels with no known names, and actually print the decomposition of standard channel layouts. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'fftools/opt_common.c')
-rw-r--r--fftools/opt_common.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index 5ba6a0d0f1..c303db4d09 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -997,7 +997,7 @@ int show_layouts(void *optctx, const char *opt, const char *arg)
"NAME DESCRIPTION\n");
for (i = 0; i < 63; i++) {
av_channel_name(buf, sizeof(buf), i);
- if (!strcmp(buf, "?"))
+ if (strstr(buf, "USR"))
continue;
av_channel_description(buf2, sizeof(buf2), i);
printf("%-14s %s\n", buf, buf2);
@@ -1006,11 +1006,14 @@ int show_layouts(void *optctx, const char *opt, const char *arg)
"NAME DECOMPOSITION\n");
while (ch_layout = av_channel_layout_standard(&iter)) {
av_channel_layout_describe(ch_layout, buf, sizeof(buf));
- av_channel_name(buf2, sizeof(buf2), i);
printf("%-14s ", buf);
- for (i = 0; i < 63; i++)
- if (av_channel_layout_index_from_channel(ch_layout, i) >= 0)
- printf("%s%s", i ? "+" : "", buf2);
+ for (i = 0; i < 63; i++) {
+ int idx = av_channel_layout_index_from_channel(ch_layout, i);
+ if (idx >= 0) {
+ av_channel_name(buf2, sizeof(buf2), i);
+ printf("%s%s", idx ? "+" : "", buf2);
+ }
+ }
printf("\n");
}
return 0;