[FFmpeg-cvslog] avcodec/utils: avcodec_string: make the colorspace printing code more extendible.

Michael Niedermayer git at videolan.org
Sat Aug 31 21:13:46 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Aug 27 22:02:45 2013 +0200| [336982a0ce1594eaac0679c553a313466f2ea6ab] | committer: Michael Niedermayer

avcodec/utils: avcodec_string: make the colorspace printing code more extendible.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/utils.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 4dbd834..842740c 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2591,13 +2591,17 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
     switch (enc->codec_type) {
     case AVMEDIA_TYPE_VIDEO:
         if (enc->pix_fmt != AV_PIX_FMT_NONE) {
+            char detail[256] = "(";
             snprintf(buf + strlen(buf), buf_size - strlen(buf),
                      ", %s",
                      av_get_pix_fmt_name(enc->pix_fmt));
             if (enc->bits_per_raw_sample &&
                 enc->bits_per_raw_sample <= av_pix_fmt_desc_get(enc->pix_fmt)->comp[0].depth_minus1)
-                snprintf(buf + strlen(buf), buf_size - strlen(buf),
-                         " (%d bpc)", enc->bits_per_raw_sample);
+                av_strlcatf(detail, sizeof(detail), "%d bpc, ", enc->bits_per_raw_sample);
+            if (strlen(detail) > 1) {
+                detail[strlen(detail) - 2] = 0;
+                av_strlcatf(buf, buf_size, "%s)", detail);
+            }
         }
         if (enc->width) {
             snprintf(buf + strlen(buf), buf_size - strlen(buf),



More information about the ffmpeg-cvslog mailing list