[FFmpeg-devel] [PATCH] ffprobe: add compact and compactnk writers

Stefano Sabatini stefasab at gmail.com
Sat Oct 8 15:46:58 CEST 2011


On date Sunday 2011-10-02 12:57:21 +0200, Stefano Sabatini encoded:
> On date Wednesday 2011-09-28 01:19:06 +0200, Alexander Strasser encoded:
[...]
> +static void compact_print_str(WriterContext *wctx, const char *key, const char *value)
> +{
> +    CompactContext *compact = wctx->priv;
> +
> +    if (wctx->nb_item) printf("%c", compact->item_sep);
> +    if (!compact->nokey)
> +        printf("%s=", key);
> +    print_escaped_str(value, compact->item_sep);
> +}
> +
> +static void compact_print_int(WriterContext *wctx, const char *key, int value)
> +{
> +    CompactContext *compact = wctx->priv;
> +
> +    if (wctx->nb_item) printf("%c", compact->item_sep);
> +    if (!compact->nokey)
> +        printf("%s=", key);
> +    printf("%d", value);
> +}
> +
> +static Writer compact_writer = {
> +    .name          = "compact",
> +    .priv_size     = sizeof(CompactContext),
> +
> +    .init                  = compact_init,
> +    .uninit                = compact_uninit,
> +    .print_section_header  = compact_print_section_header,
> +    .print_section_footer  = compact_print_section_footer,
> +    .print_integer         = compact_print_int,
> +    .print_string          = compact_print_str,
> +    .show_tags             = default_show_tags,

I had to implement a specific show_tags. Right now it prints:

compact
FORMAT|...|TAG:title=ffprobe testfile|TAG:encoder=Lavf53.14.0|TAG:encoder=Lavf53.14.0

compact=nk=1
FORMAT|...|...|ffprobe test file|Lavf53.14.0

The TAG: should be considered part of the tag key, so this looks
preferable to:
FORMAT|...|...|TAG:ffprobe test file|TAG:Lavf53.14.0

I'll push the patch in a few days if I read no comments.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-ffprobe-add-compact-writer.patch
Type: text/x-diff
Size: 6390 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111008/9b73668d/attachment.bin>


More information about the ffmpeg-devel mailing list