[FFmpeg-devel] [PATCH] ffprobe: add flat output format.

Clément Bœsch ubitux at gmail.com
Sat May 26 21:11:32 CEST 2012


On Sat, May 26, 2012 at 08:52:21PM +0200, Stefano Sabatini wrote:
[...]
> > +static void flat_print_str(WriterContext *wctx, const char *key, const char *value)
> > +{
> > +    FlatContext *flat = wctx->priv;
> > +
> > +    flat_print_section(flat);
> > +    printf("%s=%s\n", key, value);
> 
> I think we should add support to escaping here (which we could use for
> the default writer as well). init-like escaping should be fine. Leave
> it for another patch if you don't care.
> 

I added the escaping at first (this is why there is the OFFSET leftover I
forgot to remove), but then I thought it wasn't worth that complexity: a
parser would just seek to the first '=' and grab anything until the end of
the line. But now I'm wondering if we indeed don't need to escape at least
'\n'. Noted for the next version.

> > +}
> > +
> > +static void flat_print_int(WriterContext *wctx, const char *key, long long int value)
> > +{
> > +    FlatContext *flat = wctx->priv;
> > +
> > +    flat_print_section(flat);
> > +    printf("%s=%lld\n", key, value);
> > +}
> > +
> > +static void flat_show_tags(WriterContext *wctx, AVDictionary *dict)
> > +{
> > +    int id = 0;
> > +    FlatContext *flat = wctx->priv;
> > +    AVDictionaryEntry *tag = NULL;
> > +
> > +    while ((tag = av_dict_get(dict, "", tag, AV_DICT_IGNORE_SUFFIX))) {
> > +        flat_print_section(flat);
> > +        printf("tag.%d=%s\n", id++, tag->value);
> 
> Same here, may need escaping.
> 

Yep.

> Also what about something like:
> stream.STREAM_ID.tag.KEY=foobar
> 
> KEY seems more useful than a number (also: we may add a format option
> for that).
> 

Mmh, of course.

Also, I'm waiting a bit before this; I'd like to know what Libav is going
to do: it's likely they will write something similar since this was a
feature request from Måns. And to be more specific, the part I'm unsure
about is that they use section titles such as "streams.stream.<id>" in
their INI output, and I'm using stream.<id> (in this flat writer) since
there is nothing else than streams in the section. Same for the packets
etc.

While I'm discussing this, I'd like to know what we are going to do for
ffprobe: recently Libav just broke the default output by changing it to an
INI output. After complains, they decided to restore the old output under
the "old" name (-of old). Still, this is breaking user scripts, and there
is no reliable way to know if the probe tool will output the old or the
new format. So I'd like to keep the default output, and add an "ini" one.

Also, should we add a -of as an alias to -print_format?

-- 
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/10f8101c/attachment.asc>


More information about the ffmpeg-devel mailing list