[FFmpeg-devel] [PATCH] ffprobe: add -show_headers_first option
Stefano Sabatini
stefasab at gmail.com
Sun Sep 4 19:24:23 EEST 2016
This is meant to be used for generating output suitable for the
ffprobe_default demuxer.
---
ffprobe.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/ffprobe.c b/ffprobe.c
index 657867d..42a8d8e 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -98,6 +98,7 @@ static int use_value_prefix = 0;
static int use_byte_value_binary_prefix = 0;
static int use_value_sexagesimal_format = 0;
static int show_private_data = 1;
+static int show_headers_first = 0;
static char *print_format;
static char *stream_specifier;
@@ -2683,6 +2684,26 @@ static int probe_file(WriterContext *wctx, const char *filename)
}
}
+ if (show_headers_first && do_show_format) {
+ ret = show_format(wctx, &ifile);
+ CHECK_END;
+ }
+
+ if (show_headers_first && do_show_chapters) {
+ ret = show_chapters(wctx, &ifile);
+ CHECK_END;
+ }
+
+ if (show_headers_first && do_show_streams) {
+ ret = show_streams(wctx, &ifile);
+ CHECK_END;
+ }
+
+ if (show_headers_first && do_show_programs) {
+ ret = show_programs(wctx, &ifile);
+ CHECK_END;
+ }
+
if (do_read_frames || do_read_packets) {
if (do_show_frames && do_show_packets &&
wctx->writer->flags & WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER)
@@ -2699,20 +2720,20 @@ static int probe_file(WriterContext *wctx, const char *filename)
CHECK_END;
}
- if (do_show_programs) {
+ if (!show_headers_first && do_show_programs) {
ret = show_programs(wctx, &ifile);
CHECK_END;
}
- if (do_show_streams) {
+ if (!show_headers_first && do_show_streams) {
ret = show_streams(wctx, &ifile);
CHECK_END;
}
- if (do_show_chapters) {
+ if (!show_headers_first && do_show_chapters) {
ret = show_chapters(wctx, &ifile);
CHECK_END;
}
- if (do_show_format) {
+ if (!show_headers_first && do_show_format) {
ret = show_format(wctx, &ifile);
CHECK_END;
}
@@ -3213,6 +3234,7 @@ static const OptionDef real_options[] = {
{ "read_intervals", HAS_ARG, {.func_arg = opt_read_intervals}, "set read intervals", "read_intervals" },
{ "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {.func_arg = opt_default}, "generic catch all option", "" },
{ "i", HAS_ARG, {.func_arg = opt_input_file_i}, "read specified file", "input_file"},
+ { "show_headers_first", OPT_BOOL, {&show_headers_first}, "show headers before the packets/frames" },
{ NULL, },
};
--
1.9.1
More information about the ffmpeg-devel
mailing list