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

Stefano Sabatini stefasab at gmail.com
Sat Sep 29 10:07:35 CEST 2012


On date Friday 2012-09-28 23:43:50 +0200, Clément Bœsch encoded:
> On Fri, Sep 28, 2012 at 07:33:45PM +0200, Stefano Sabatini wrote:
> > On date Wednesday 2012-09-26 13:11:19 +0200, Stefano Sabatini encoded:
> > > 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, this time avoiding syntax breaks.
> > -- 
> > FFmpeg = Fucking & Forgiving Meaningless Powerful Ermetic God
> 
> > From 57e19b0661ef825e4c1eeb37e954340843b61449 Mon Sep 17 00:00:00 2001
> > From: Stefano Sabatini <stefasab at gmail.com>
> > Date: Fri, 28 Sep 2012 17:07:40 +0200
> > Subject: [PATCH] ffprobe: drop SECTION_ENTRY macro
> > 
> > The use of the macro somewhat makes to add new optional fields harder.
> > ---
> >  ffprobe.c |   35 ++++++++++++++++-------------------
> >  1 files changed, 16 insertions(+), 19 deletions(-)
> > 
> > diff --git a/ffprobe.c b/ffprobe.c
> > index d466d5a..38f8323 100644
> > --- a/ffprobe.c
> > +++ b/ffprobe.c
> > @@ -101,26 +101,23 @@ typedef enum {
> >      SECTION_ID_STREAM_TAGS
> >  } SectionID;
> >  
> > -#define SECTION_ENTRY(id, name, flags) \
> > -    [SECTION_ID_##id] = { SECTION_ID_##id, name, flags }
> > -
> >  static const struct section sections[] = {
> > -    SECTION_ENTRY(ERROR,              "error", 0),
> > -    SECTION_ENTRY(FORMAT,             "format", 0),
> > -    SECTION_ENTRY(FORMAT_TAGS,        "tags", 0),
> > -    SECTION_ENTRY(FRAME,              "frame", 0),
> > -    SECTION_ENTRY(FRAMES,             "frames", SECTION_FLAG_IS_ARRAY),
> > -    SECTION_ENTRY(FRAME_TAGS,         "tags", 0),
> > -    SECTION_ENTRY(LIBRARY_VERSION,    "library_version", 0),
> > -    SECTION_ENTRY(LIBRARY_VERSIONS,   "library_versions", SECTION_FLAG_IS_ARRAY),
> > -    SECTION_ENTRY(PACKET,             "packet", 0),
> > -    SECTION_ENTRY(PACKETS,            "packets", SECTION_FLAG_IS_ARRAY),
> > -    SECTION_ENTRY(PACKETS_AND_FRAMES, "packets_and_frames", SECTION_FLAG_IS_ARRAY),
> > -    SECTION_ENTRY(PROGRAM_VERSION,    "program_version", 0),
> > -    SECTION_ENTRY(ROOT,               "root", SECTION_FLAG_IS_WRAPPER),
> > -    SECTION_ENTRY(STREAM,             "stream", 0),
> > -    SECTION_ENTRY(STREAMS,            "streams", SECTION_FLAG_IS_ARRAY),
> > -    SECTION_ENTRY(STREAM_TAGS,        "tags", 0),
> > +    [SECTION_ID_ERROR] = { SECTION_ID_ERROR, "error", 0 },
> > +    [SECTION_ID_FORMAT] = { SECTION_ID_FORMAT, "format", 0 },
> > +    [SECTION_ID_FORMAT_TAGS] = { SECTION_ID_FORMAT_TAGS, "tags", 0 },
> > +    [SECTION_ID_FRAME] = { SECTION_ID_FRAME, "frame", 0 },
> > +    [SECTION_ID_FRAMES] = { SECTION_ID_FRAMES, "frames", SECTION_FLAG_IS_ARRAY },
> > +    [SECTION_ID_FRAME_TAGS] = { SECTION_ID_FRAME_TAGS, "tags", 0 },
> > +    [SECTION_ID_LIBRARY_VERSION] = { SECTION_ID_LIBRARY_VERSION, "library_version", 0 },
> > +    [SECTION_ID_LIBRARY_VERSIONS] = { SECTION_ID_LIBRARY_VERSIONS, "library_versions", SECTION_FLAG_IS_ARRAY },
> > +    [SECTION_ID_PACKET] = { SECTION_ID_PACKET, "packet", 0 },
> > +    [SECTION_ID_PACKETS] = { SECTION_ID_PACKETS, "packets", SECTION_FLAG_IS_ARRAY },
> > +    [SECTION_ID_PACKETS_AND_FRAMES] = { SECTION_ID_PACKETS_AND_FRAMES, "packets_and_frames", SECTION_FLAG_IS_ARRAY },
> > +    [SECTION_ID_PROGRAM_VERSION] = { SECTION_ID_PROGRAM_VERSION, "program_version", 0 },
> > +    [SECTION_ID_ROOT] = { SECTION_ID_ROOT, "root", SECTION_FLAG_IS_WRAPPER },
> > +    [SECTION_ID_STREAM] = { SECTION_ID_STREAM, "stream", 0 },
> > +    [SECTION_ID_STREAMS] = { SECTION_ID_STREAMS, "streams", SECTION_FLAG_IS_ARRAY },
> > +    [SECTION_ID_STREAM_TAGS] = { SECTION_ID_STREAM_TAGS, "tags", 0 },
> 
> OK, why not. Can't you drop the "0" now?

Yes.
 
> nit: too bad to loose some alignment but whatever.

Aligned.

> 
> [...]
> > From e36d1c06f1ae9f0b1d09d0f7662b4a37ae199332 Mon Sep 17 00:00:00 2001
> > From: Stefano Sabatini <stefasab at gmail.com>
> > Date: Wed, 26 Sep 2012 12:56:32 +0200
> > Subject: [PATCH] ffprobe: generalize nesting model for the default 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 |   55 ++++++++++++++++++++++++++++++++++++++++---------------
> >  1 files changed, 40 insertions(+), 15 deletions(-)
[...]
> LGTM

Will push it soon, thanks.
-- 
FFmpeg = Fancy Faithful Mysterious Perennial Extroverse Governor


More information about the ffmpeg-devel mailing list