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

Michael Niedermayer michaelni
Wed May 26 02:00:56 CEST 2010


On Wed, May 26, 2010 at 01:11:23AM +0200, Stefano Sabatini wrote:
> On date Monday 2010-05-24 23:16:22 +0200, Michael Niedermayer encoded:
> > On Sun, May 23, 2010 at 06:22:08PM +0200, Stefano Sabatini wrote:
> > > 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.
> > 
> > av_strlcatf() also returns the size
> 
> OK, indeed with it is much simpler.
> 
> Regards.
> -- 
> FFmpeg = Fierce Forgiving Maxi Pure Educated Game

>  ffprobe.c            |   14 +++-----------
>  libavcodec/avcodec.h |    9 +++++++++
>  libavcodec/utils.c   |   12 ++++++++++++
>  3 files changed, 24 insertions(+), 11 deletions(-)
> b971c1e4c71e56c507e3bdd62ff29729ed554bac  0001-Implement-av_get_codec_tag_string-and-use-it-in-ffpr.patch
> >From 4c315a6c890e65dc0c59157c19fc7d5cb6331a0f Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> Date: Sat, 22 May 2010 16:27:31 +0200
> Subject: [PATCH 1/6] Implement av_get_codec_tag_string() and use it in ffprobe.
> 
> ---
>  ffprobe.c            |   14 +++-----------
>  libavcodec/avcodec.h |    9 +++++++++
>  libavcodec/utils.c   |   12 ++++++++++++
>  3 files changed, 24 insertions(+), 11 deletions(-)

should be ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100526/f8ff196d/attachment.pgp>



More information about the ffmpeg-devel mailing list