avutil/channel_layout: print channels using av_channel_name_bprint in av_channel_layout_describe_bprint

This reduces code duplication an allows printing AMBI%d channel names for
custom layouts for non-standard or partial ambisonic layouts.

Signed-off-by: Marton Balint <cus@passwd.hu>
release/5.1
Marton Balint 3 years ago
parent bf5099b12b
commit bd40375dd2
  1. 6
      libavutil/channel_layout.c

@ -737,14 +737,10 @@ int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout,
av_bprintf(bp, "%d channels (", channel_layout->nb_channels);
for (i = 0; i < channel_layout->nb_channels; i++) {
enum AVChannel ch = av_channel_layout_channel_from_index(channel_layout, i);
const char *channel = get_channel_name(ch);
if (i)
av_bprintf(bp, "+");
if (channel)
av_bprintf(bp, "%s", channel);
else
av_bprintf(bp, "USR%d", ch);
av_channel_name_bprint(bp, ch);
if (channel_layout->order == AV_CHANNEL_ORDER_CUSTOM &&
channel_layout->u.map[i].name[0])
av_bprintf(bp, "@%s", channel_layout->u.map[i].name);

Loading…
Cancel
Save