[FFmpeg-devel] [PATCH]Print number of reference frames if debug level >= verbose

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Mar 13 02:11:54 CET 2015


Hi!

On Wednesday 11 March 2015 04:03:27 am Michael Niedermayer wrote:
> On Tue, Mar 10, 2015 at 03:27:20PM +0100, Carl Eugen Hoyos wrote:
> > +    if (av_log_get_level() >= AV_LOG_VERBOSE && enc->refs)
> > +        snprintf(buf + strlen(buf), buf_size - strlen(buf),
> > ", %d reference frame(s)", enc->refs);
>
> this should only be printed for video and the "s" should only be
> printed for refs > 1

New patch attached.

Thank you, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 5b28496..d739047 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -3024,6 +3024,12 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
 
     if (profile)
         snprintf(buf + strlen(buf), buf_size - strlen(buf), " (%s)", profile);
+    if (   enc->codec_type == AVMEDIA_TYPE_VIDEO
+        && av_log_get_level() >= AV_LOG_VERBOSE
+        && enc->refs)
+        snprintf(buf + strlen(buf), buf_size - strlen(buf),
+                 ", %d reference frame%s",
+                 enc->refs, enc->refs > 1 ? "s" : "");
 
     if (enc->codec_tag) {
         char tag_buf[32];


More information about the ffmpeg-devel mailing list