[FFmpeg-devel] [PATCH] ffprobe: reduce the number of AVBPrint resets.

Clément Bœsch ubitux at gmail.com
Sat May 26 22:57:36 CEST 2012


On Sat, May 26, 2012 at 10:08:24PM +0200, Stefano Sabatini wrote:
> On date Saturday 2012-05-26 01:28:45 +0200, Clément Bœsch encoded:
> > ---
> >  ffprobe.c |   26 ++++++++++----------------
> >  1 file changed, 10 insertions(+), 16 deletions(-)
> > 
> > diff --git a/ffprobe.c b/ffprobe.c
> > index d53ec11..cbcc708 100644
> > --- a/ffprobe.c
> > +++ b/ffprobe.c
> > @@ -662,19 +662,16 @@ static void compact_show_tags(WriterContext *wctx, AVDictionary *dict)
> >      AVDictionaryEntry *tag = NULL;
> >      AVBPrint buf;
> >  
> > +    av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
> >      while ((tag = av_dict_get(dict, "", tag, AV_DICT_IGNORE_SUFFIX))) {
> >          if (wctx->nb_item) printf("%c", compact->item_sep);
> > -
> > -        if (!compact->nokey) {
> > -            av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
> 
> > +        av_bprint_clear(&buf);
> > +        if (!compact->nokey)
> >              printf("tag:%s=", compact->escape_str(&buf, tag->key, compact->item_sep, wctx));
> > -            av_bprint_finalize(&buf, NULL);
> > -        }
> 
> av_bprint_clear(&buf) could be put under the if block:
> if (nokey) {clear&print; }
> clear&print;
> 
> [...]
> 
> Looks good otherwise, thanks.

Already changed locally, pushed.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120526/6551dd75/attachment.asc>


More information about the ffmpeg-devel mailing list