[FFmpeg-devel] [PATCH] ffprobe: generalize nesting model for the compact writer

Stefano Sabatini stefasab at gmail.com
Sat Sep 29 10:13:27 CEST 2012


On date Friday 2012-09-28 23:47:00 +0200, Clément Bœsch encoded:
> On Fri, Sep 28, 2012 at 07:34:21PM +0200, Stefano Sabatini wrote:
> > On date Wednesday 2012-09-26 15:57:50 +0200, Stefano Sabatini encoded:
> > > Regular section fields nested in a regular section are now prefixed by
> > > the nested section name.
> > > 
> > > This is required by the pending change related to disposition.
> > > 
> > > "tags" section is no more treated like a special case, and thus the
> > > prefix name for the tags section is changed from "tag:" to "tags:".
> > > 
> > > This changes the writer output.
> > 
> > Updated.
> > -- 
> > FFmpeg = Frightening Fierce Magical Political Ephemeral Game
> 
> > From 4a6fc68f5c02eab96e0bf6cd14f51ff2d95a3f11 Mon Sep 17 00:00:00 2001
> > From: Stefano Sabatini <stefasab at gmail.com>
> > Date: Wed, 26 Sep 2012 15:39:12 +0200
> > Subject: [PATCH] ffprobe: generalize nesting model for the compact writer
> > 
> > Regular section fields nested in a regular section are now prefixed by
> > the nested section name.
> > 
> > This is required by the pending change related to disposition.
> > ---
> >  ffprobe.c |   42 +++++++++++++++++++++++++++++++-----------
> >  1 files changed, 31 insertions(+), 11 deletions(-)
> > 
> > diff --git a/ffprobe.c b/ffprobe.c
> > index 77ddcba..acde8eb 100644
> > --- a/ffprobe.c
> > +++ b/ffprobe.c
> > @@ -661,6 +661,8 @@ typedef struct CompactContext {
> >      int print_section;
> >      char *escape_mode_str;
> >      const char * (*escape_str)(AVBPrint *dst, const char *src, const char sep, void *log_ctx);
> > +    int nested_section[SECTION_MAX_NB_LEVELS];
> > +    AVBPrint prefix[SECTION_MAX_NB_LEVELS];
> >  } CompactContext;
> >  
> 
> >  #undef OFFSET
> > @@ -683,6 +685,7 @@ DEFINE_WRITER_CLASS(compact);
> >  static av_cold int compact_init(WriterContext *wctx)
> >  {
> >      CompactContext *compact = wctx->priv;
> > +    int i;
> >  
> >      if (strlen(compact->item_sep_str) != 1) {
> >          av_log(wctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n",
> > @@ -699,44 +702,60 @@ static av_cold int compact_init(WriterContext *wctx)
> >          return AVERROR(EINVAL);
> >      }
> >  
> > +    for (i = 0; i < SECTION_MAX_NB_LEVELS; i++)
> > +        av_bprint_init(&compact->prefix[i], 1, AV_BPRINT_SIZE_UNLIMITED);
> >      return 0;
> >  }
> >  
> > +static void compact_uninit(WriterContext *wctx)
> > +{
> > +    CompactContext *compact = wctx->priv;
> > +    int i;
> > +
> > +    for (i = 0; i < SECTION_MAX_NB_LEVELS; i++)
> > +        av_bprint_finalize(&compact->prefix[i], NULL);
> > +}
> > +
> 
> Note: I hope this will get factorized with the other writers at some point

Possible.

[...] 
> Just like the change to the default writer, LGTM

Will push it soon, thanks.
-- 
FFmpeg = Fascinating and Faithful Miracolous Puristic Evil Generator


More information about the ffmpeg-devel mailing list