[FFmpeg-devel] [PATCH] ffprobe: add -show_version option
Clément Bœsch
ubitux at gmail.com
Sun Jan 8 13:34:54 CET 2012
On Sun, Jan 08, 2012 at 11:32:41AM +0100, Stefano Sabatini wrote:
> On date Saturday 2012-01-07 23:15:01 +0100, Clément Bœsch encoded:
> > On Sat, Jan 07, 2012 at 11:11:00PM +0100, Stefano Sabatini wrote:
> > > On date Saturday 2012-01-07 12:59:18 +0100, Clément Bœsch encoded:
> > > > On Sat, Jan 07, 2012 at 11:25:29AM +0100, Stefano Sabatini wrote:
> > > [...]
> > > > Another way of doing this would be to have -show_versions, and:
> [...]
> > > version: {
> > > program: {
> > > ...
> > > },
> > > ...
> > >
> > > >
> > > > "libavformat": {
> > > > "micro": ...
> > > > "minor": ...
> > > > "major": ...
> > > > },
> > > >
> > > > "libav...": {
> > > > ...
> > > > },
> > > > }
> > >
> > > Possibly a good idea, but requires more changes in ffprobe.c (mainly
> > > in the JSON writer).
> >
> > That was just a suggestion; if it's too much trouble to implement, I'm
> > fine with the current patch, push anytime you believe it's decent enough
> > :)
>
> Now it is:
>
> {
> "versions": {
> "program_version": {
> "version": "N-36604-g029c58b",
> "copyright": "Copyright (c) 2007-2012 the FFmpeg developers",
> "build_date": "Jan 8 2012",
> "build_time": "11:26:39",
> "compiler_type": "gcc",
> "compiler_version": "4.6.1",
> "configuration": ...
> },
> "library_versions": [
> {
> "name": "libavutil",
> "major": 51,
> "minor": 34,
> "micro": 100,
> "version": 3351140
> },
> {
> "name": "libavcodec",
> "major": 53,
> "minor": 54,
> "micro": 100,
> "version": 3487332
> },
> ...
> ]
> }
> }
>
> JSON implementation is a little hacky since I had to fool the writer
> to make it write a subsection, in compensation XML schema is pretty
> compact and sweet:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ffprobe>
> <versions>
> <program_version version="N-36604-g029c58b" copyright="Copyright (c) 2007-2012 the FFmpeg developers" build_date="Jan 8 2012" build_time="11:26:39" compiler_type="gcc" compiler_version="4.6.1" configuration="..."/>
> <library_version name="libavutil" major="51" minor="34" micro="100" version="3351140"/>
> <library_version name="libavcodec" major="53" minor="54" micro="100" version="3487332"/>
> <library_version name="libavformat" major="53" minor="29" micro="100" version="3480932"/>
> <library_version name="libavdevice" major="53" minor="4" micro="100" version="3474532"/>
> <library_version name="libavfilter" major="2" minor="57" micro="101" version="145765"/>
> <library_version name="libswscale" major="2" minor="1" micro="100" version="131428"/>
> <library_version name="libswresample" major="0" minor="5" micro="100" version="1380"/>
> <library_version name="libpostproc" major="51" minor="2" micro="100" version="3342948"/>
> </versions>
> </ffprobe>
>
Nice :)
> Based on the previously posted JSON patches.
> --
> FFmpeg = Foolish & Forgiving Merciful Picky Erroneous Guru
> From 029c58b9dc6a1ca89ba04b880ccd3f180f5951de Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefasab at gmail.com>
> Date: Sun, 1 Jan 2012 17:19:58 +0100
> Subject: [PATCH] ffprobe: add -show_versions option
>
> ---
> doc/ffprobe.texi | 5 +++
> doc/ffprobe.xsd | 26 ++++++++++++++
> ffprobe.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++-----
> 3 files changed, 119 insertions(+), 9 deletions(-)
>
> diff --git a/doc/ffprobe.texi b/doc/ffprobe.texi
> index a49c3f8..657b667 100644
> --- a/doc/ffprobe.texi
> +++ b/doc/ffprobe.texi
> @@ -133,6 +133,11 @@ particular shown element.
> This option is enabled by default, but you may need to disable it
> for specific uses, for example when creating XSD-compliant XML output.
>
> + at item -show_version
> +Show information related to program and libraries versions.
> +
> +Version information is printed within a section with name "VERSION".
> +
Sorry I made you rename into -show_versionS (and thus s/VERSION/VERSIONS/
too I guess).
[...]
> @@ -834,6 +854,14 @@ static void json_print_section_header(WriterContext *wctx, const char *section)
>
> if (wctx->nb_section)
> printf(",\n");
> +
> + if (json->versions_chapter && !strcmp(section, "library_version") &&
> + json->first_library_version) {
> + JSON_INDENT(); printf("\"library_versions\": [\n");
We are already in the versions section, I guess "libraries" would be fine
here. Same comment for the "program_version" with "programs" BTW. The
"versions" namespace should help avoiding the redundancy.
Rest LGTM.
--
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/20120108/ca15b1bf/attachment.asc>
More information about the ffmpeg-devel
mailing list