[FFmpeg-devel] [PATCH 03/11] Implement av_get_codec_tag_string() and use it in ffprobe.

Stefano Sabatini stefano.sabatini-lala
Mon May 24 23:06:33 CEST 2010


On date Sunday 2010-05-23 18:22:08 +0200, Stefano Sabatini encoded:
> On date Sunday 2010-05-23 17:01:21 +0200, Michael Niedermayer encoded:
> > On Sun, May 23, 2010 at 02:07:16PM +0200, Stefano Sabatini wrote:
> [...]
> > > diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> > > index 56d4dbd..0daf331 100644
> > > --- a/libavcodec/utils.c
> > > +++ b/libavcodec/utils.c
> > > @@ -798,6 +798,21 @@ static int get_bit_rate(AVCodecContext *ctx)
> > >      return bit_rate;
> > >  }
> > >  
> > > +int 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++) {
> > > +        const char *tmpl = isprint(codec_tag&0xFF) ? "%c" : "[%d]";
> > > +        len = snprintf(buf, buf_size, tmpl, codec_tag&0xFF);
> > > +        buf      += len;
> > > +        buf_size  = len >= buf_size ? 0 : buf_size - len;
> > > +        ret      += len;
> > > +        codec_tag>>=8;
> > > +    }
> > 
> > hmm, i see now av_strlcatf() would have been simpler, it wasnt my intent to
> > complicate this
> 
> Anyway I think that to return the total required size is useful, so I
> prefer this variant.

Ping.
-- 
FFmpeg = Frightening and Fierce Magic Picky Extreme Goblin



More information about the ffmpeg-devel mailing list