[FFmpeg-devel] [PATCH] ffprobe: add -show_version option
Clément Bœsch
ubitux at gmail.com
Sat Jan 7 12:59:18 CET 2012
On Sat, Jan 07, 2012 at 11:25:29AM +0100, Stefano Sabatini wrote:
> On date Friday 2012-01-06 19:55:24 +0100, Stefano Sabatini encoded:
> > ---
> > doc/ffprobe.xsd | 44 ++++++++++++++++++++++++++++++++++++++++++
> > ffprobe.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
> > 2 files changed, 99 insertions(+), 2 deletions(-)
>
> Updated.
> --
> FFmpeg = Free & Funny Marvellous Plastic Epic God
> From 5a1b740f8a4c51c0dae34e473512fa69a22b8ca5 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_version option
>
> ---
> doc/ffprobe.texi | 5 ++++
> doc/ffprobe.xsd | 44 +++++++++++++++++++++++++++++++++++++++++++
> ffprobe.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 3 files changed, 102 insertions(+), 2 deletions(-)
>
Good idea :)
> diff --git a/doc/ffprobe.texi b/doc/ffprobe.texi
> index 2a9b73f..c915f47 100644
> --- a/doc/ffprobe.texi
> +++ b/doc/ffprobe.texi
> @@ -126,6 +126,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".
> +
> @item -i @var{input_file}
> Read @var{input_file}.
>
> diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
> index 93da1d4..348961c 100644
> --- a/doc/ffprobe.xsd
> +++ b/doc/ffprobe.xsd
> @@ -12,6 +12,7 @@
> <xsd:element name="streams" type="ffprobe:streamsType" minOccurs="0" maxOccurs="1" />
> <xsd:element name="format" type="ffprobe:formatType" minOccurs="0" maxOccurs="1" />
> <xsd:element name="error" type="ffprobe:errorType" minOccurs="0" maxOccurs="1" />
> + <xsd:element name="version" type="ffprobe:versionType" minOccurs="0" maxOccurs="1" />
> </xsd:sequence>
> </xsd:complexType>
>
> @@ -99,4 +100,47 @@
> <xsd:attribute name="code" type="xsd:int" use="required"/>
> <xsd:attribute name="string" type="xsd:string" use="required"/>
> </xsd:complexType>
> +
> + <xsd:complexType name="versionType">
> + <xsd:attribute name="version" type="xsd:string" use="required"/>
> + <xsd:attribute name="copyright" type="xsd:string" use="required"/>
> + <xsd:attribute name="build_date" type="xsd:string" use="required"/>
> + <xsd:attribute name="build_time" type="xsd:string" use="required"/>
> + <xsd:attribute name="compiler_type" type="xsd:string" use="required"/>
> + <xsd:attribute name="compiler_version" type="xsd:string" use="required"/>
> + <xsd:attribute name="configuration" type="xsd:string" use="required"/>
> + <xsd:attribute name="libavutil_major" type="xsd:int"/>
> + <xsd:attribute name="libavutil_minor" type="xsd:int"/>
> + <xsd:attribute name="libavutil_micro" type="xsd:int"/>
> + <xsd:attribute name="libavutil_version" type="xsd:int"/>
> + <xsd:attribute name="libavcodec_major" type="xsd:int"/>
> + <xsd:attribute name="libavcodec_minor" type="xsd:int"/>
> + <xsd:attribute name="libavcodec_micro" type="xsd:int"/>
> + <xsd:attribute name="libavcodec_version" type="xsd:int"/>
> + <xsd:attribute name="libavformat_major" type="xsd:int"/>
> + <xsd:attribute name="libavformat_minor" type="xsd:int"/>
> + <xsd:attribute name="libavformat_micro" type="xsd:int"/>
> + <xsd:attribute name="libavformat_version" type="xsd:int"/>
> + <xsd:attribute name="libavdevice_major" type="xsd:int"/>
> + <xsd:attribute name="libavdevice_minor" type="xsd:int"/>
> + <xsd:attribute name="libavdevice_micro" type="xsd:int"/>
> + <xsd:attribute name="libavdevice_version" type="xsd:int"/>
> + <xsd:attribute name="libavfilter_major" type="xsd:int"/>
> + <xsd:attribute name="libavfilter_minor" type="xsd:int"/>
> + <xsd:attribute name="libavfilter_micro" type="xsd:int"/>
> + <xsd:attribute name="libavfilter_version" type="xsd:int"/>
> + <xsd:attribute name="libswscale_major" type="xsd:int"/>
> + <xsd:attribute name="libswscale_minor" type="xsd:int"/>
> + <xsd:attribute name="libswscale_micro" type="xsd:int"/>
> + <xsd:attribute name="libswscale_version" type="xsd:int"/>
> + <xsd:attribute name="libswresample_major" type="xsd:int"/>
> + <xsd:attribute name="libswresample_minor" type="xsd:int"/>
> + <xsd:attribute name="libswresample_micro" type="xsd:int"/>
> + <xsd:attribute name="libswresample_version" type="xsd:int"/>
> + <xsd:attribute name="libpostproc_major" type="xsd:int"/>
> + <xsd:attribute name="libpostproc_minor" type="xsd:int"/>
> + <xsd:attribute name="libpostproc_micro" type="xsd:int"/>
> + <xsd:attribute name="libpostproc_version" type="xsd:int"/>
> + </xsd:complexType>
> +
> </xsd:schema>
> diff --git a/ffprobe.c b/ffprobe.c
> index 4a03dba..8f7c0c9 100644
> --- a/ffprobe.c
> +++ b/ffprobe.c
> @@ -24,6 +24,7 @@
> */
>
> #include "config.h"
> +#include "version.h"
>
> #include "libavformat/avformat.h"
> #include "libavcodec/avcodec.h"
> @@ -32,6 +33,9 @@
> #include "libavutil/pixdesc.h"
> #include "libavutil/dict.h"
> #include "libavdevice/avdevice.h"
> +#include "libswscale/swscale.h"
> +#include "libswresample/swresample.h"
> +#include "libpostproc/postprocess.h"
> #include "cmdutils.h"
>
> const char program_name[] = "ffprobe";
> @@ -41,6 +45,7 @@ static int do_show_error = 0;
> static int do_show_format = 0;
> static int do_show_packets = 0;
> static int do_show_streams = 0;
> +static int do_show_version = 0;
>
> static int show_value_unit = 0;
> static int use_value_prefix = 0;
> @@ -1415,6 +1420,46 @@ static void show_usage(void)
> av_log(NULL, AV_LOG_INFO, "\n");
> }
>
> +#define SHOW_LIB_VERSION(libname, LIBNAME) \
> + { \
> + unsigned int version = libname##_version(); \
> + if (CONFIG_##LIBNAME) { \
> + print_int("lib" #libname "_major", LIB##LIBNAME##_VERSION_MAJOR); \
> + print_int("lib" #libname "_minor", LIB##LIBNAME##_VERSION_MINOR); \
> + print_int("lib" #libname "_micro", LIB##LIBNAME##_VERSION_MICRO); \
> + print_int("lib" #libname "_version", version); \
> + } \
> + }
> +
unsigned int version could be moved to the if (CONFIG...) scope.
Also a do { ... } while (0) wouldn't hurt I think.
Another way of doing this would be to have -show_versions, and:
"versions": {
"project": "N-36558-g4862781",
"copyright": "Copyright (c) 2007-2012 the FFmpeg developers",
"build_date": "Jan 7 2012",
"build_time": "12:51:38",
"libavformat": {
"micro": ...
"minor": ...
"major": ...
},
"libav...": {
...
},
}
--
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/20120107/403a1e1b/attachment.asc>
More information about the ffmpeg-devel
mailing list