diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-06-02 14:54:45 +0400 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-06-02 14:54:45 +0400 |
commit | 7e566bbe6ce367e880bf09e293a9e72e52c0988e (patch) | |
tree | 3988b406e82bcf143d409bd5b3aa551dbcd1bdc3 /libavcodec/utils.c | |
parent | 3b963552bc8bd740c8c782778b5b1a427f268cd0 (diff) |
Implement av_get_codec_tag_string() and use it in ffprobe.
Originally committed as revision 23421 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 60f52ac366..739e874ef8 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -802,6 +802,21 @@ static int get_bit_rate(AVCodecContext *ctx) 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; |