Stefano Sabatini
7328c2fc21
ffprobe: replace av_destruct_packet() with av_free_packet()
...
av_destruct_packet() always frees the packet data even when the demuxer
is going to re-use it, thus causing crashes when decoding audio
frames (as implemented in a pending patch).
av_free_packet() is used instead, as it allows each demuxer to set the
right packet data releasing mechanism through the pkt->destruct callback.
13 years ago
Stefano Sabatini
0cc8864687
ffprobe: use av_toupper() in upcase_string()
13 years ago
Stefano Sabatini
93d49cba7f
ffprobe: add compact option to JSON writer
13 years ago
Stefano Sabatini
5226be0dd5
ffprobe: add -show_program_version and -show_library_versions options
13 years ago
Stefano Sabatini
d3e435164b
ffprobe: make upcase_string() ignore non-ASCII characters
...
This is required as some section names may contain non-ASCII characters
(e.g. '_').
13 years ago
Stefano Sabatini
3b1355bb93
ffprobe: change formatting logic in the JSON writer
...
Print a "\n" at the end of each section, also print the section name in
the section print function, print the chapter name only in case the
chapter contains multiple entries.
Increase textual output readability - different sections can be
distinguished more easily.
13 years ago
Stefano Sabatini
48f37b1d21
ffprobe: implement generic reindent logic in the JSON writer
...
Clarify/generalize indent logic.
13 years ago
Stefano Sabatini
5ccdb907c1
ffprobe: use more meaningful names for writer chapter/section header/footer function
...
The passed argument is supposed to be the chapter/section name, rather
than the header/footer. Less confusing.
13 years ago
Stefano Sabatini
ec624d7c5c
ffprobe: use "%*" printf syntax in XML_INDENT() in place of a loop
...
Possibly faster/cleaner.
Suggested-By: Clément Bœsch <ubitux@gmail.com>
13 years ago
Stefano Sabatini
9997d41672
ffprobe: add support to video frame information printing
...
Add -show_frames option to ffprobe.
Partially based on the work of Thomas Kuehnel <kuehnelth@googlemail.com>
for SOCIS 2011.
The wicked idea of creating a special "packets_and_frames" container for
structured formats (JSON and XML) comes from Clément.
13 years ago
Stefano Sabatini
9ecccd6e5a
ffprobe: move header and trailer print from probe_file() to main()
...
Simplify printing from the main() context, in case probe_file() is not
called, as required by the pending -show_version option.
13 years ago
Stefano Sabatini
fa7d1c39fd
ffprobe: move writer context registration and initialization in main()
...
Simplify pending changes, as the writer context will be used in the
main() routine.
13 years ago
Stefano Sabatini
ceef1ee767
cmdutils: make show_usage() use av_log()
...
Avoid printing on stdout when show_usage is used in an error message.
13 years ago
Stefano Sabatini
c5f4abf698
ffprobe: exit in case generic options are incompatible with strict XML output
13 years ago
Stefano Sabatini
49c207b820
ffprobe: fix NULL pointer dereference in writer_close()
...
Fix crash.
13 years ago
Stefano Sabatini
d6da16dca5
ffprobe: add support to option -show_error
13 years ago
Stefano Sabatini
55ed19bf3b
ffprobe: remove unused variable in show_format()
13 years ago
Stefano Sabatini
4c5c0609c1
ffprobe: reindent after the last commit
13 years ago
Stefano Sabatini
90347dabc8
ffprobe: change order of operations in probe_file()
...
This is required by a pending patch, also fixes a memleak due to the
writer context not being closed in case of open_input_file() failure.
13 years ago
Stefano Sabatini
c972f91d5b
ffprobe: prefer av_log to fprintf(stderr)
13 years ago
Stefano Sabatini
20ac5849f8
ffprobe: add XML writer
13 years ago
Stefano Sabatini
f1a4182e8e
ffprobe: add show_private_data option
13 years ago
Stefano Sabatini
93613338fe
ff* tools: move descriptions from copyright header to @file doxy
13 years ago
Michael Niedermayer
452406bd5b
ff*: Fix duplicatedly printed version info with -version
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Clément Bœsch
fbe6e29646
ffprobe: print codec timecode if available.
13 years ago
Stefano Sabatini
65f24858ed
ffprobe: always print int values with print_val()
...
In particular, make the json writer write size values, fix regression
introduced with the addition of the print_val() macro.
13 years ago
Stefano Sabatini
a7e5679054
ffprobe: make writer_print_integer support long long int values
...
This makes possible to use writer_print_integer for printing int64_t
values.
13 years ago
Clément Bœsch
69a501e6a1
ffprobe: small align cosmetic in json writer struct init.
13 years ago
Clément Bœsch
9813af259a
ffprobe: make Writers constant.
13 years ago
Stefano Sabatini
f0db05008d
ffprobe: apply misc cosmetics to compact writer definition
13 years ago
Stefano Sabatini
1f0d937f77
ffprobe: add csv writer
13 years ago
Stefano Sabatini
1c43713e57
ffprobe: add compact writer
13 years ago
Stefano Sabatini
0491a2a07a
ffprobe: force display of missing fields, depending on writer.flags
...
Add flags field to Writer, and define the
WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS flag which forces the display of
optional fields, for example non-available or invalid fields.
Also set the flag in the default writer.
This change is required as for some writers it is preferable to show all
fields (for example for avoiding a variable number of fields in CSV
output), while for other formats (e.g. JSON, XML) it is better to leave
invalid/unavailable fields unspecified and thus simplify the parsing
stage on the deserializer side.
13 years ago
Michael Niedermayer
985e768024
ffprobe: use av_noreturn
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Stefano Sabatini
13665c8767
ffprobe: refactor value_string() to accept an unit_value struct
...
The new design allows to specialize the format for continuos time values
and discrete values. In particular, allows to print integer values like
"12" rather than "12.000".
Prettify, simplify parsing for integer values.
13 years ago
Stefano Sabatini
80abfbea9d
ffprobe: introduce print_val() macro, ease readability
13 years ago
Stefano Sabatini
d2d6bade5c
ffprobe: implement and use print_time and print_ts macros
...
Help readability.
13 years ago
Clément Bœsch
434db5719e
ffprobe: use avio_size() instead of deprecated file_size attribute.
13 years ago
Clément Bœsch
1e4027747a
ffprobe: fix const compiler warning.
13 years ago
Michael Niedermayer
16f793571d
ffprobe: Print format specific variables of codecs.
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Clément Bœsch
2f468826ee
ffprobe: prefer av_freep() over av_free() for global print_format option.
...
It could be re-used for instance in case ffprobe would support multiple
input files.
13 years ago
Stefano Sabatini
f4eeb000bf
ffprobe: fix weird align
13 years ago
Stefano Sabatini
b874e2d0a0
ffprobe: prefer av_strtok() over av_get_token() for parsing print_format string
...
Simplify, and avoid the need for multiple escaping levels.
13 years ago
Stefano Sabatini
88bdf7471f
ffprobe: move up ESCAPE_CHECK_SIZE and ESCAPE_REALLOC_BUF macros
...
So they can be used by other escaping routines.
13 years ago
Stefano Sabatini
2f3b028c71
ffprobe: redesign json_escape_str(), to make use of a global buffer
...
The new code avoids to call av_malloc/av_free when escaping is needed
(possibly faster), avoids an integer overflow in case of a huge
string, and provides feedback when a string cannot be escaped.
When a string cannot be escaped, a special string is printed instead.
13 years ago
Stefano Sabatini
1d0afec8fc
ffprobe: add AVClass to writers
...
It is useful for logging messages from a writer context.
13 years ago
Stefano Sabatini
4edcdf5c44
ffprobe: show sample_fmt in the stream section
13 years ago
Stefano Sabatini
fbb8468f20
ffprobe: prefer lowercase section names over uppercase ones
...
This is consistent with chapter names. The default writer section names
are converted to uppercase for keeping backward compatibility.
13 years ago
Stefano Sabatini
cb50ada4f8
ffprobe: parse arguments for -print_format writer
...
This allows -print_format to accept string of the form WRITER=OPTIONS,
as required by the pending compact writer patch.
13 years ago
Stefano Sabatini
eff7684b50
ffprobe: extend writers API, and move the writers up in the file
...
The new provided API is more flexible and is decoupled from the
application level code, so it is easier to maintain.
13 years ago