Mercurial > libavcodec.hg
diff utils.c @ 11809:867d82f512df libavcodec
Implement av_get_codec_tag_string() and use it in ffprobe.
author | stefano |
---|---|
date | Wed, 02 Jun 2010 10:54:45 +0000 |
parents | 22b17f922f2b |
children | 2ae71694d6ae |
line wrap: on
line diff
--- a/utils.c Tue Jun 01 20:59:06 2010 +0000 +++ b/utils.c Wed Jun 02 10:54:45 2010 +0000 @@ -802,6 +802,21 @@ return bit_rate; } +size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag) +{ + int i, len, ret = 0; + + for (i = 0; i < 4; i++) { + len = snprintf(buf, buf_size, + isprint(codec_tag&0xFF) ? "%c" : "[%d]", codec_tag&0xFF); + buf += len; + buf_size = buf_size > len ? buf_size - len : 0; + ret += len; + codec_tag>>=8; + } + return ret; +} + void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) { const char *codec_name;