[FFmpeg-devel] [PATCH 04/11] Make avcodec_string() use av_get_codec_tag_string().

Stefano Sabatini stefano.sabatini-lala
Sat May 22 17:58:12 CEST 2010


---
 libavcodec/utils.c |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 8d8826a..ac8a85e 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -818,7 +818,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
 {
     const char *codec_name;
     AVCodec *p;
-    char buf1[32];
+    char buf1[32], buf2[32];
     int bitrate;
     AVRational display_aspect_ratio;
 
@@ -837,17 +837,9 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
         codec_name = enc->codec_name;
     } else {
         /* output avi tags */
-        if(   isprint(enc->codec_tag&0xFF) && isprint((enc->codec_tag>>8)&0xFF)
-           && isprint((enc->codec_tag>>16)&0xFF) && isprint((enc->codec_tag>>24)&0xFF)){
-            snprintf(buf1, sizeof(buf1), "%c%c%c%c / 0x%04X",
-                     enc->codec_tag & 0xff,
-                     (enc->codec_tag >> 8) & 0xff,
-                     (enc->codec_tag >> 16) & 0xff,
-                     (enc->codec_tag >> 24) & 0xff,
-                      enc->codec_tag);
-        } else {
-            snprintf(buf1, sizeof(buf1), "0x%04x", enc->codec_tag);
-        }
+        snprintf(buf1, sizeof(buf1), "%s / 0x%04X",
+                 av_get_codec_tag_string(buf2, sizeof(buf2), enc->codec_tag),
+                 enc->codec_tag);
         codec_name = buf1;
     }
 
-- 
1.7.1




More information about the ffmpeg-devel mailing list