[FFmpeg-devel] [PATCH 2/2] lavc: show profile in avcodec_string()

Anssi Hannula anssi.hannula
Fri Jan 7 16:15:11 CET 2011


---
 libavcodec/utils.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index ce74735..8379116 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -861,6 +861,7 @@ size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_ta
 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
 {
     const char *codec_name;
+    const char *profile;
     AVCodec *p;
     char buf1[32];
     int bitrate;
@@ -887,11 +888,16 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
         codec_name = buf1;
     }
 
+    profile = av_get_profile_name(enc->codec_id, enc->profile);
+
     switch(enc->codec_type) {
     case AVMEDIA_TYPE_VIDEO:
         snprintf(buf, buf_size,
                  "Video: %s%s",
                  codec_name, enc->mb_decision ? " (hq)" : "");
+        if (profile)
+            snprintf(buf + strlen(buf), buf_size - strlen(buf),
+                     " (%s)", profile);
         if (enc->pix_fmt != PIX_FMT_NONE) {
             snprintf(buf + strlen(buf), buf_size - strlen(buf),
                      ", %s",
@@ -927,6 +933,9 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
         snprintf(buf, buf_size,
                  "Audio: %s",
                  codec_name);
+        if (profile)
+            snprintf(buf + strlen(buf), buf_size - strlen(buf),
+                     " (%s)", profile);
         if (enc->sample_rate) {
             snprintf(buf + strlen(buf), buf_size - strlen(buf),
                      ", %d Hz", enc->sample_rate);
-- 
1.7.3




More information about the ffmpeg-devel mailing list