[FFmpeg-cvslog] ffprobe: add csv writer
Stefano Sabatini
git at videolan.org
Wed Nov 16 18:41:53 CET 2011
ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Wed Nov 16 00:41:55 2011 +0100| [1f0d937f777a2d4d83200a4d26c7752735eee727] | committer: Stefano Sabatini
ffprobe: add csv writer
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1f0d937f777a2d4d83200a4d26c7752735eee727
---
Changelog | 2 +-
doc/ffprobe.texi | 6 ++++++
ffprobe.c | 24 +++++++++++++++++++++++-
3 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/Changelog b/Changelog
index f635e88..a3d713e 100644
--- a/Changelog
+++ b/Changelog
@@ -121,7 +121,7 @@ easier to use. The changes are:
- Discworld II BMV decoding support
- VBLE Decoder
- OS X Video Decoder Acceleration (VDA) support
-- compact output in ffprobe
+- compact and csv output in ffprobe
version 0.8:
diff --git a/doc/ffprobe.texi b/doc/ffprobe.texi
index 172e35d..89b270d 100644
--- a/doc/ffprobe.texi
+++ b/doc/ffprobe.texi
@@ -199,6 +199,12 @@ Perform no escaping.
@end table
+ at section csv
+CSV format.
+
+This writer is equivalent to
+ at code{compact=item_sep=,:nokey=1:escape=csv}.
+
@section json
JSON based format.
diff --git a/ffprobe.c b/ffprobe.c
index c15cf7b..8c44528 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -688,6 +688,26 @@ static Writer compact_writer = {
.flags = WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS
};
+/* CSV output */
+
+static av_cold int csv_init(WriterContext *wctx, const char *args, void *opaque)
+{
+ return compact_init(wctx, "item_sep=,:nokey=1:escape=csv", opaque);
+}
+
+static Writer csv_writer = {
+ .name = "csv",
+ .priv_size = sizeof(CompactContext),
+ .init = csv_init,
+ .uninit = compact_uninit,
+ .print_section_header = compact_print_section_header,
+ .print_section_footer = compact_print_section_footer,
+ .print_integer = compact_print_int,
+ .print_string = compact_print_str,
+ .show_tags = compact_show_tags,
+ .flags = WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS,
+};
+
/* JSON output */
typedef struct {
@@ -857,6 +877,7 @@ static void writer_register_all(void)
writer_register(&default_writer);
writer_register(&compact_writer);
+ writer_register(&csv_writer);
writer_register(&json_writer);
}
@@ -1203,7 +1224,8 @@ static const OptionDef options[] = {
"use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
{ "pretty", 0, {(void*)&opt_pretty},
"prettify the format of displayed values, make it more human readable" },
- { "print_format", OPT_STRING | HAS_ARG, {(void*)&print_format}, "set the output printing format (available formats are: default, compact, json)", "format" },
+ { "print_format", OPT_STRING | HAS_ARG, {(void*)&print_format},
+ "set the output printing format (available formats are: default, compact, csv, json)", "format" },
{ "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" },
{ "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" },
{ "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" },
More information about the ffmpeg-cvslog
mailing list