... | ... |
@@ -133,6 +133,23 @@ particular shown element. |
133 | 133 |
This option is enabled by default, but you may need to disable it |
134 | 134 |
for specific uses, for example when creating XSD-compliant XML output. |
135 | 135 |
|
136 |
+@item -show_program_version |
|
137 |
+Show information related to program version. |
|
138 |
+ |
|
139 |
+Version information is printed within a section with name |
|
140 |
+"PROGRAM_VERSION". |
|
141 |
+ |
|
142 |
+@item -show_library_versions |
|
143 |
+Show information related to library versions. |
|
144 |
+ |
|
145 |
+Version information for each library is printed within a section with |
|
146 |
+name "LIBRARY_VERSION". |
|
147 |
+ |
|
148 |
+@item -show_versions |
|
149 |
+Show information related to program and library versions. This is the |
|
150 |
+equivalent of setting both @option{-show_program_version} and |
|
151 |
+@option{-show_library_versions} options. |
|
152 |
+ |
|
136 | 153 |
@item -i @var{input_file} |
137 | 154 |
Read @var{input_file}. |
138 | 155 |
|
... | ... |
@@ -13,6 +13,8 @@ |
13 | 13 |
<xsd:element name="streams" type="ffprobe:streamsType" minOccurs="0" maxOccurs="1" /> |
14 | 14 |
<xsd:element name="format" type="ffprobe:formatType" minOccurs="0" maxOccurs="1" /> |
15 | 15 |
<xsd:element name="error" type="ffprobe:errorType" minOccurs="0" maxOccurs="1" /> |
16 |
+ <xsd:element name="program_version" type="ffprobe:programVersionType" minOccurs="0" maxOccurs="1" /> |
|
17 |
+ <xsd:element name="library_versions" type="ffprobe:libraryVersionsType" minOccurs="0" maxOccurs="1" /> |
|
16 | 18 |
</xsd:sequence> |
17 | 19 |
</xsd:complexType> |
18 | 20 |
|
... | ... |
@@ -131,4 +133,28 @@ |
131 | 131 |
<xsd:attribute name="code" type="xsd:int" use="required"/> |
132 | 132 |
<xsd:attribute name="string" type="xsd:string" use="required"/> |
133 | 133 |
</xsd:complexType> |
134 |
+ |
|
135 |
+ <xsd:complexType name="programVersionType"> |
|
136 |
+ <xsd:attribute name="version" type="xsd:string" use="required"/> |
|
137 |
+ <xsd:attribute name="copyright" type="xsd:string" use="required"/> |
|
138 |
+ <xsd:attribute name="build_date" type="xsd:string" use="required"/> |
|
139 |
+ <xsd:attribute name="build_time" type="xsd:string" use="required"/> |
|
140 |
+ <xsd:attribute name="compiler_type" type="xsd:string" use="required"/> |
|
141 |
+ <xsd:attribute name="compiler_version" type="xsd:string" use="required"/> |
|
142 |
+ <xsd:attribute name="configuration" type="xsd:string" use="required"/> |
|
143 |
+ </xsd:complexType> |
|
144 |
+ |
|
145 |
+ <xsd:complexType name="libraryVersionType"> |
|
146 |
+ <xsd:attribute name="name" type="xsd:string" use="required"/> |
|
147 |
+ <xsd:attribute name="major" type="xsd:int" use="required"/> |
|
148 |
+ <xsd:attribute name="minor" type="xsd:int" use="required"/> |
|
149 |
+ <xsd:attribute name="micro" type="xsd:int" use="required"/> |
|
150 |
+ <xsd:attribute name="version" type="xsd:int" use="required"/> |
|
151 |
+ </xsd:complexType> |
|
152 |
+ |
|
153 |
+ <xsd:complexType name="libraryVersionsType"> |
|
154 |
+ <xsd:sequence> |
|
155 |
+ <xsd:element name="library_version" type="ffprobe:libraryVersionType" minOccurs="0" maxOccurs="unbounded"/> |
|
156 |
+ </xsd:sequence> |
|
157 |
+ </xsd:complexType> |
|
134 | 158 |
</xsd:schema> |
... | ... |
@@ -24,6 +24,7 @@ |
24 | 24 |
*/ |
25 | 25 |
|
26 | 26 |
#include "config.h" |
27 |
+#include "version.h" |
|
27 | 28 |
|
28 | 29 |
#include "libavformat/avformat.h" |
29 | 30 |
#include "libavcodec/avcodec.h" |
... | ... |
@@ -32,6 +33,9 @@ |
32 | 32 |
#include "libavutil/pixdesc.h" |
33 | 33 |
#include "libavutil/dict.h" |
34 | 34 |
#include "libavdevice/avdevice.h" |
35 |
+#include "libswscale/swscale.h" |
|
36 |
+#include "libswresample/swresample.h" |
|
37 |
+#include "libpostproc/postprocess.h" |
|
35 | 38 |
#include "cmdutils.h" |
36 | 39 |
|
37 | 40 |
const char program_name[] = "ffprobe"; |
... | ... |
@@ -42,6 +46,8 @@ static int do_show_format = 0; |
42 | 42 |
static int do_show_frames = 0; |
43 | 43 |
static int do_show_packets = 0; |
44 | 44 |
static int do_show_streams = 0; |
45 |
+static int do_show_program_version = 0; |
|
46 |
+static int do_show_library_versions = 0; |
|
45 | 47 |
|
46 | 48 |
static int show_value_unit = 0; |
47 | 49 |
static int use_value_prefix = 0; |
... | ... |
@@ -805,7 +811,7 @@ static void json_print_chapter_header(WriterContext *wctx, const char *chapter) |
805 | 805 |
printf("\n"); |
806 | 806 |
json->multiple_entries = !strcmp(chapter, "packets") || !strcmp(chapter, "frames" ) || |
807 | 807 |
!strcmp(chapter, "packets_and_frames") || |
808 |
- !strcmp(chapter, "streams"); |
|
808 |
+ !strcmp(chapter, "streams") || !strcmp(chapter, "library_versions"); |
|
809 | 809 |
if (json->multiple_entries) { |
810 | 810 |
JSON_INDENT(); |
811 | 811 |
printf("\"%s\": [\n", json_escape_str(&json->buf, &json->buf_size, chapter, wctx)); |
... | ... |
@@ -1073,7 +1079,7 @@ static void xml_print_chapter_header(WriterContext *wctx, const char *chapter) |
1073 | 1073 |
printf("\n"); |
1074 | 1074 |
xml->multiple_entries = !strcmp(chapter, "packets") || !strcmp(chapter, "frames") || |
1075 | 1075 |
!strcmp(chapter, "packets_and_frames") || |
1076 |
- !strcmp(chapter, "streams"); |
|
1076 |
+ !strcmp(chapter, "streams") || !strcmp(chapter, "library_versions"); |
|
1077 | 1077 |
|
1078 | 1078 |
if (xml->multiple_entries) { |
1079 | 1079 |
XML_INDENT(); printf("<%s>\n", chapter); |
... | ... |
@@ -1551,6 +1557,54 @@ static void show_usage(void) |
1551 | 1551 |
av_log(NULL, AV_LOG_INFO, "\n"); |
1552 | 1552 |
} |
1553 | 1553 |
|
1554 |
+static void ffprobe_show_program_version(WriterContext *w) |
|
1555 |
+{ |
|
1556 |
+ struct print_buf pbuf = {.s = NULL}; |
|
1557 |
+ |
|
1558 |
+ writer_print_chapter_header(w, "program_version"); |
|
1559 |
+ print_section_header("program_version"); |
|
1560 |
+ print_str("version", FFMPEG_VERSION); |
|
1561 |
+ print_fmt("copyright", "Copyright (c) %d-%d the FFmpeg developers", |
|
1562 |
+ program_birth_year, this_year); |
|
1563 |
+ print_str("build_date", __DATE__); |
|
1564 |
+ print_str("build_time", __TIME__); |
|
1565 |
+ print_str("compiler_type", CC_TYPE); |
|
1566 |
+ print_str("compiler_version", CC_VERSION); |
|
1567 |
+ print_str("configuration", FFMPEG_CONFIGURATION); |
|
1568 |
+ print_section_footer("program_version"); |
|
1569 |
+ writer_print_chapter_footer(w, "program_version"); |
|
1570 |
+ |
|
1571 |
+ av_free(pbuf.s); |
|
1572 |
+} |
|
1573 |
+ |
|
1574 |
+#define SHOW_LIB_VERSION(libname, LIBNAME) \ |
|
1575 |
+ do { \ |
|
1576 |
+ if (CONFIG_##LIBNAME) { \ |
|
1577 |
+ unsigned int version = libname##_version(); \ |
|
1578 |
+ print_section_header("library_version"); \ |
|
1579 |
+ print_str("name", "lib" #libname); \ |
|
1580 |
+ print_int("major", LIB##LIBNAME##_VERSION_MAJOR); \ |
|
1581 |
+ print_int("minor", LIB##LIBNAME##_VERSION_MINOR); \ |
|
1582 |
+ print_int("micro", LIB##LIBNAME##_VERSION_MICRO); \ |
|
1583 |
+ print_int("version", version); \ |
|
1584 |
+ print_section_footer("library_version"); \ |
|
1585 |
+ } \ |
|
1586 |
+ } while (0) |
|
1587 |
+ |
|
1588 |
+static void ffprobe_show_library_versions(WriterContext *w) |
|
1589 |
+{ |
|
1590 |
+ writer_print_chapter_header(w, "library_versions"); |
|
1591 |
+ SHOW_LIB_VERSION(avutil, AVUTIL); |
|
1592 |
+ SHOW_LIB_VERSION(avcodec, AVCODEC); |
|
1593 |
+ SHOW_LIB_VERSION(avformat, AVFORMAT); |
|
1594 |
+ SHOW_LIB_VERSION(avdevice, AVDEVICE); |
|
1595 |
+ SHOW_LIB_VERSION(avfilter, AVFILTER); |
|
1596 |
+ SHOW_LIB_VERSION(swscale, SWSCALE); |
|
1597 |
+ SHOW_LIB_VERSION(swresample, SWRESAMPLE); |
|
1598 |
+ SHOW_LIB_VERSION(postproc, POSTPROC); |
|
1599 |
+ writer_print_chapter_footer(w, "library_versions"); |
|
1600 |
+} |
|
1601 |
+ |
|
1554 | 1602 |
static int opt_format(const char *opt, const char *arg) |
1555 | 1603 |
{ |
1556 | 1604 |
iformat = av_find_input_format(arg); |
... | ... |
@@ -1594,6 +1648,13 @@ static int opt_pretty(const char *opt, const char *arg) |
1594 | 1594 |
return 0; |
1595 | 1595 |
} |
1596 | 1596 |
|
1597 |
+static int opt_show_versions(const char *opt, const char *arg) |
|
1598 |
+{ |
|
1599 |
+ do_show_program_version = 1; |
|
1600 |
+ do_show_library_versions = 1; |
|
1601 |
+ return 0; |
|
1602 |
+} |
|
1603 |
+ |
|
1597 | 1604 |
static const OptionDef options[] = { |
1598 | 1605 |
#include "cmdutils_common_opts.h" |
1599 | 1606 |
{ "f", HAS_ARG, {(void*)opt_format}, "force format", "format" }, |
... | ... |
@@ -1612,6 +1673,9 @@ static const OptionDef options[] = { |
1612 | 1612 |
{ "show_frames", OPT_BOOL, {(void*)&do_show_frames} , "show frames info" }, |
1613 | 1613 |
{ "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" }, |
1614 | 1614 |
{ "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" }, |
1615 |
+ { "show_program_version", OPT_BOOL, {(void*)&do_show_program_version}, "show ffprobe version" }, |
|
1616 |
+ { "show_library_versions", OPT_BOOL, {(void*)&do_show_library_versions}, "show library versions" }, |
|
1617 |
+ { "show_versions", 0, {(void*)&opt_show_versions}, "show program and library versions" }, |
|
1615 | 1618 |
{ "show_private_data", OPT_BOOL, {(void*)&show_private_data}, "show private data" }, |
1616 | 1619 |
{ "private", OPT_BOOL, {(void*)&show_private_data}, "same as show_private_data" }, |
1617 | 1620 |
{ "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" }, |
... | ... |
@@ -1655,12 +1719,19 @@ int main(int argc, char **argv) |
1655 | 1655 |
if ((ret = writer_open(&wctx, w, w_args, NULL)) >= 0) { |
1656 | 1656 |
writer_print_header(wctx); |
1657 | 1657 |
|
1658 |
- if (!input_filename) { |
|
1658 |
+ if (do_show_program_version) |
|
1659 |
+ ffprobe_show_program_version(wctx); |
|
1660 |
+ if (do_show_library_versions) |
|
1661 |
+ ffprobe_show_library_versions(wctx); |
|
1662 |
+ |
|
1663 |
+ if (!input_filename && |
|
1664 |
+ ((do_show_format || do_show_streams || do_show_packets || do_show_error) || |
|
1665 |
+ (!do_show_program_version && !do_show_library_versions))) { |
|
1659 | 1666 |
show_usage(); |
1660 | 1667 |
av_log(NULL, AV_LOG_ERROR, "You have to specify one input file.\n"); |
1661 | 1668 |
av_log(NULL, AV_LOG_ERROR, "Use -h to get full help or, even better, run 'man %s'.\n", program_name); |
1662 | 1669 |
ret = AVERROR(EINVAL); |
1663 |
- } else { |
|
1670 |
+ } else if (input_filename) { |
|
1664 | 1671 |
ret = probe_file(wctx, input_filename); |
1665 | 1672 |
if (ret < 0 && do_show_error) |
1666 | 1673 |
show_error(wctx, ret); |