[FFmpeg-cvslog] avutil/channel_layout: add missing check for AV_CHAN_NONE in av_channel_description

James Almer git at videolan.org
Fri Mar 25 14:25:01 EET 2022


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri Mar 25 09:22:55 2022 -0300| [e4f6fce9e0285778833179ae2c3b898231460e48] | committer: James Almer

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 at gmail.com>

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

 libavutil/channel_layout.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c
index 2d4ccae1bf..c28b8928da 100644
--- a/libavutil/channel_layout.c
+++ b/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) &&
              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
         av_bprintf(bp, "user %d", channel_id);
 }



More information about the ffmpeg-cvslog mailing list