[FFmpeg-devel] [PATCH]Print bits per component in avcodec_string if smaller than expected

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Dec 4 17:41:27 CET 2012


Hi!

If a decoder specifies a value for bits_per_raw_sample that is smaller than 
the pix_fmt would indicate, print the smaller value.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 48ef679..9cc783c 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2139,6 +2139,10 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
             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_get_bits_per_pixel(av_pix_fmt_desc_get(enc->pix_fmt)))
+                snprintf(buf + strlen(buf), buf_size - strlen(buf),
+                         " (%d bpc)", enc->bits_per_raw_sample);
         }
         if (enc->width) {
             snprintf(buf + strlen(buf), buf_size - strlen(buf),


More information about the ffmpeg-devel mailing list