avutil/channel_layout: add missing check for AV_CHAN_NONE in av_channel_description

Prevents printing "user -1" on invalid channel ids.

Signed-off-by: James Almer <jamrial@gmail.com>
release/5.1
James Almer 3 years ago
parent b04f14136e
commit e4f6fce9e0
  1. 2
      libavutil/channel_layout.c

@ -119,6 +119,8 @@ void av_channel_description_bprint(AVBPrint *bp, enum AVChannel channel_id)
else if ((unsigned)channel_id < FF_ARRAY_ELEMS(channel_names) && else if ((unsigned)channel_id < FF_ARRAY_ELEMS(channel_names) &&
channel_names[channel_id].description) channel_names[channel_id].description)
av_bprintf(bp, "%s", channel_names[channel_id].description); av_bprintf(bp, "%s", channel_names[channel_id].description);
else if (channel_id == AV_CHAN_NONE)
av_bprintf(bp, "none");
else else
av_bprintf(bp, "user %d", channel_id); av_bprintf(bp, "user %d", channel_id);
} }

Loading…
Cancel
Save