... | ... |
@@ -45,6 +45,10 @@ ffprobe output is designed to be easily parsable by a textual filter, |
45 | 45 |
and consists of one or more sections of a form defined by the selected |
46 | 46 |
writer, which is specified by the @option{print_format} option. |
47 | 47 |
|
48 |
+Sections may contain other nested sections, and are identified by a |
|
49 |
+name (which may be shared by other sections), and an unique |
|
50 |
+name. See the output of @option{sections}. |
|
51 |
+ |
|
48 | 52 |
Metadata tags stored in the container or in the streams are recognized |
49 | 53 |
and printed in the corresponding "FORMAT" or "STREAM" section. |
50 | 54 |
|
... | ... |
@@ -94,6 +98,10 @@ For example for printing the output in JSON format, specify: |
94 | 94 |
For more details on the available output printing formats, see the |
95 | 95 |
Writers section below. |
96 | 96 |
|
97 |
+@item -sections |
|
98 |
+Print sections structure and section information, and exit. The output |
|
99 |
+is not meant to be parsed by a machine. |
|
100 |
+ |
|
97 | 101 |
@item -select_streams @var{stream_specifier} |
98 | 102 |
Select only the streams specified by @var{stream_specifier}. This |
99 | 103 |
option affects only the options related to streams |
... | ... |
@@ -2105,6 +2105,35 @@ static int opt_pretty(void *optctx, const char *opt, const char *arg) |
2105 | 2105 |
return 0; |
2106 | 2106 |
} |
2107 | 2107 |
|
2108 |
+static void print_section(SectionID id, int level) |
|
2109 |
+{ |
|
2110 |
+ const SectionID *pid; |
|
2111 |
+ const struct section *section = §ions[id]; |
|
2112 |
+ printf("%c%c%c", |
|
2113 |
+ section->flags & SECTION_FLAG_IS_WRAPPER ? 'W' : '.', |
|
2114 |
+ section->flags & SECTION_FLAG_IS_ARRAY ? 'A' : '.', |
|
2115 |
+ section->flags & SECTION_FLAG_HAS_VARIABLE_FIELDS ? 'V' : '.'); |
|
2116 |
+ printf("%*c %s", level * 4, ' ', section->name); |
|
2117 |
+ if (section->unique_name) |
|
2118 |
+ printf("/%s", section->unique_name); |
|
2119 |
+ printf("\n"); |
|
2120 |
+ |
|
2121 |
+ for (pid = section->children_ids; *pid != -1; pid++) |
|
2122 |
+ print_section(*pid, level+1); |
|
2123 |
+} |
|
2124 |
+ |
|
2125 |
+static int opt_sections(void *optctx, const char *opt, const char *arg) |
|
2126 |
+{ |
|
2127 |
+ printf("Sections:\n" |
|
2128 |
+ "W.. = Section is a wrapper (contains other sections, no local entries)\n" |
|
2129 |
+ ".A. = Section contains an array of elements of the same type\n" |
|
2130 |
+ "..V = Section may contain a variable number of fields with variable keys\n" |
|
2131 |
+ "FLAGS NAME/UNIQUE_NAME\n" |
|
2132 |
+ "---\n"); |
|
2133 |
+ print_section(SECTION_ID_ROOT, 0); |
|
2134 |
+ return 0; |
|
2135 |
+} |
|
2136 |
+ |
|
2108 | 2137 |
static int opt_show_versions(const char *opt, const char *arg) |
2109 | 2138 |
{ |
2110 | 2139 |
mark_section_show_entries(SECTION_ID_PROGRAM_VERSION, 1, NULL); |
... | ... |
@@ -2142,6 +2171,7 @@ static const OptionDef real_options[] = { |
2142 | 2142 |
"set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml)", "format" }, |
2143 | 2143 |
{ "of", OPT_STRING | HAS_ARG, {(void*)&print_format}, "alias for -print_format", "format" }, |
2144 | 2144 |
{ "select_streams", OPT_STRING | HAS_ARG, {(void*)&stream_specifier}, "select the specified streams", "stream_specifier" }, |
2145 |
+ { "sections", OPT_EXIT, {.func_arg = opt_sections}, "print sections structure and section information, and exit" }, |
|
2145 | 2146 |
{ "show_data", OPT_BOOL, {(void*)&do_show_data}, "show packets data" }, |
2146 | 2147 |
{ "show_error", 0, {(void*)&opt_show_error}, "show probing error" }, |
2147 | 2148 |
{ "show_format", 0, {(void*)&opt_show_format}, "show format/container info" }, |