Commit Graph

120 Commits

Author SHA1 Message Date
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. '_').
2012-01-10 18:19:31 +01:00
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.
2012-01-09 13:41:35 +01:00
Stefano Sabatini 48f37b1d21 ffprobe: implement generic reindent logic in the JSON writer
Clarify/generalize indent logic.
2012-01-09 13:36:10 +01:00
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.
2012-01-08 11:20:31 +01:00
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>
2012-01-08 11:19:27 +01:00
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.
2012-01-07 22:26:46 +01:00
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.
2012-01-07 11:08:00 +01:00
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.
2012-01-07 11:02:13 +01:00
Stefano Sabatini ceef1ee767 cmdutils: make show_usage() use av_log()
Avoid printing on stdout when show_usage is used in an error message.
2012-01-07 11:02:13 +01:00
Stefano Sabatini c5f4abf698 ffprobe: exit in case generic options are incompatible with strict XML output 2012-01-06 10:43:34 +01:00
Stefano Sabatini 49c207b820 ffprobe: fix NULL pointer dereference in writer_close()
Fix crash.
2012-01-06 10:43:34 +01:00
Stefano Sabatini d6da16dca5 ffprobe: add support to option -show_error 2012-01-04 01:06:28 +01:00
Stefano Sabatini 55ed19bf3b ffprobe: remove unused variable in show_format() 2012-01-04 01:06:11 +01:00
Stefano Sabatini 4c5c0609c1 ffprobe: reindent after the last commit 2012-01-04 01:06:03 +01:00
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.
2012-01-04 01:05:56 +01:00
Stefano Sabatini c972f91d5b ffprobe: prefer av_log to fprintf(stderr) 2012-01-04 01:05:51 +01:00
Stefano Sabatini 20ac5849f8 ffprobe: add XML writer 2011-12-27 12:58:24 +01:00
Stefano Sabatini f1a4182e8e ffprobe: add show_private_data option 2011-12-27 12:58:08 +01:00
Stefano Sabatini 93613338fe ff* tools: move descriptions from copyright header to @file doxy 2011-12-27 12:58:08 +01:00
Michael Niedermayer 452406bd5b ff*: Fix duplicatedly printed version info with -version
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-20 22:23:12 +01:00
Michael Niedermayer 8bc7fe4daf Merge remote-tracking branch 'qatar/master'
* qatar/master:
  doxygen: misc consistency, spelling and wording fixes
  vcr1: drop unnecessary emms_c() calls without MMX code
  Replace all uses of av_close_input_file() with avformat_close_input().
  lavf: add avformat_close_input().
  lavf: deprecate av_close_input_stream().
  lavf doxy: add some basic demuxing documentation.
  lavf doxy: add some general lavf information.
  lavf doxy: add misc utility functions to a group.
  lavf doxy: add av_guess_codec/format to the encoding group.
  lavf doxy: add core functions to a doxy group.
  Add basic libavdevice documentation.
  lavc: convert error_recognition to err_recognition.
  avconv: update -map option help text
  x86: Require 7 registers for the cabac asm
  x86: bswap: remove test for bswap instruction
  bswap: make generic implementation more compiler-friendly
  h264: remove useless cast
  proresdec: fix decode_slice() prototype

Conflicts:
	configure
	doc/APIchanges
	ffprobe.c
	libavcodec/avcodec.h
	libavcodec/celp_math.h
	libavcodec/h264.c
	libavfilter/src_movie.c
	libavformat/anm.c
	libavformat/avformat.h
	libavformat/version.h
	libavutil/avstring.h
	libavutil/bswap.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-13 00:39:48 +01:00
Clément Bœsch fbe6e29646 ffprobe: print codec timecode if available. 2011-11-28 14:06:02 +01:00
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.
2011-11-25 13:25:56 +01:00
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.
2011-11-18 10:09:26 +01:00
Clément Bœsch 69a501e6a1 ffprobe: small align cosmetic in json writer struct init. 2011-11-16 19:37:11 +01:00
Clément Bœsch 9813af259a ffprobe: make Writers constant. 2011-11-16 19:35:23 +01:00
Stefano Sabatini f0db05008d ffprobe: apply misc cosmetics to compact writer definition 2011-11-16 18:40:09 +01:00
Stefano Sabatini 1f0d937f77 ffprobe: add csv writer 2011-11-16 18:40:03 +01:00
Stefano Sabatini 1c43713e57 ffprobe: add compact writer 2011-11-16 00:32:08 +01:00
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.
2011-11-16 00:30:35 +01:00
Michael Niedermayer 985e768024 ffprobe: use av_noreturn
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-11 04:26:07 +01:00
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.
2011-11-07 14:53:36 +01:00
Stefano Sabatini 80abfbea9d ffprobe: introduce print_val() macro, ease readability 2011-11-07 14:53:29 +01:00
Stefano Sabatini d2d6bade5c ffprobe: implement and use print_time and print_ts macros
Help readability.
2011-11-07 14:53:22 +01:00
Michael Niedermayer 13b7781ec8 Merge remote-tracking branch 'qatar/master'
* qatar/master: (23 commits)
  x86inc: use sse versions of common macros instead of sse2 when applicable
  doc/APIchanges: add missing dates and hashes
  lavf: don't return from void av_update_cur_dts()
  Changelog: add more entries.
  Changelog: update ffmpeg/avconv incompatibility list.
  avconv: remove some redundant temporary variables.
  avconv: fix broken indentation
  avconv: move copy_initial_nonkeyframes to the options context.
  avconv: use file:stream instead of file.stream in log messages.
  doc/avconv: elaborate on basic functionality.
  doc/avconv: -sample_fmts, not -help sample_fmts prints the sample formats
  openssl: Only use CRYPTO_set_id_callback on OpenSSL < 1.0.0
  Call avformat_network_init/deinit in the programs
  Remove leftover includes of strings.h
  avutil: Don't allow using strcasecmp/strncasecmp
  Replace all usage of strcasecmp/strncasecmp
  avstring: Add locale independent implementations of strcasecmp/strncasecmp
  avstring: Add locale independent implementations of toupper/tolower
  cosmetics: insert some spaces in explicit enum value assignments
  move 8SVX audio codecs to the audio codec list part on the next bump
  ...

Conflicts:
	avprobe.c
	doc/APIchanges
	ffplay.c
	ffserver.c
	libavcodec/avcodec.h
	libavdevice/bktr.c
	libavdevice/v4l.c
	libavdevice/v4l2.c
	libavformat/matroskaenc.c
	libavformat/wtv.c
	libavutil/avstring.c
	libavutil/avstring.h
	libavutil/avutil.h
	libswscale/x86/swscale_template.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-07 03:01:43 +01:00
Clément Bœsch 434db5719e ffprobe: use avio_size() instead of deprecated file_size attribute. 2011-11-05 15:07:19 +01:00
Clément Bœsch 1e4027747a ffprobe: fix const compiler warning. 2011-11-05 15:07:19 +01:00
Michael Niedermayer 16f793571d ffprobe: Print format specific variables of codecs.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-04 17:25:28 +01:00
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.
2011-10-18 19:11:05 +02:00
Stefano Sabatini f4eeb000bf ffprobe: fix weird align 2011-10-18 18:58:32 +02:00
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.
2011-10-18 18:21:03 +02:00
Stefano Sabatini 88bdf7471f ffprobe: move up ESCAPE_CHECK_SIZE and ESCAPE_REALLOC_BUF macros
So they can be used by other escaping routines.
2011-10-18 18:21:03 +02:00
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.
2011-10-18 18:21:03 +02:00
Stefano Sabatini 1d0afec8fc ffprobe: add AVClass to writers
It is useful for logging messages from a writer context.
2011-10-15 00:54:22 +02:00
Michael Niedermayer f884ef00de Merge remote-tracking branch 'qatar/master'
* qatar/master: (31 commits)
  tiffenc: initialize forgotten avctx.
  avplay: free the active audio packet at exit.
  avplay: free rdft data used for spectrogram analysis.
  log.h: make AVClass a named struct
  fix ac3 encoder documentation
  vc1: more prettyprinting cosmetics
  vc1: prettyprint some tables
  vc1: K&R formatting cosmetics
  AVOptions: bump minor and add APIchanges entry.
  cmdutils/avtools: simplify show_help() by using av_opt_child_class_next()
  AVOptions: rename FF_OPT_TYPE_* => AV_OPT_TYPE_*
  Remove all uses of deprecated AVOptions API.
  AVOptions: add av_opt_next, deprecate av_next_option.
  AVOptions: add functions for evaluating option strings.
  AVOptions: split get_number().
  AVOptions: add av_opt_get*, deprecate av_get*.
  AVOptions: add av_opt_set*().
  AVOptions: add new API for enumerating children.
  rv34: move inverse transform functions to DSP context
  flvenc: Write the right metadata entry count
  ...

Conflicts:
	avconv.c
	cmdutils.c
	doc/APIchanges
	ffplay.c
	ffprobe.c
	libavcodec/ac3dec.c
	libavcodec/h264.c
	libavcodec/libvpxenc.c
	libavcodec/libx264.c
	libavcodec/mpeg12enc.c
	libavcodec/options.c
	libavdevice/libdc1394.c
	libavdevice/v4l2.c
	libavfilter/vf_drawtext.c
	libavformat/flvdec.c
	libavformat/mpegtsenc.c
	libavformat/options.c
	libavutil/avutil.h
	libavutil/opt.c
	libswscale/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-13 06:00:03 +02:00
Stefano Sabatini 4edcdf5c44 ffprobe: show sample_fmt in the stream section 2011-10-12 14:55:28 +02:00
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.
2011-10-11 00:24:27 +02:00
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.
2011-10-09 16:03:13 +02:00
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.
2011-10-09 16:02:52 +02:00
Clément Bœsch f9d8a3423f ffprobe: fix trailing '=' in stream id. 2011-09-28 17:57:22 +02:00