aboutsummaryrefslogtreecommitdiffstats
path: root/ffprobe.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-07 22:42:41 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-07 22:51:34 +0200
commit653d117c29123d353ce3bdd7de71e830a26733c1 (patch)
tree996ad2bd13c774dc3265cbf0d8ae406372d57307 /ffprobe.c
parentcb982739fa2b43afb7f1262c07804cad41f778de (diff)
parentfdc918632f5c16cf377a2170cd2f101933fb15ff (diff)
downloadffmpeg-653d117c29123d353ce3bdd7de71e830a26733c1.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: libschroedinger: Switch to function names more in line with Libav style. Move code shared between libdirac and libschroedinger to libschroedinger. lavfi: uninline avfilter_copy_buffer_ref_props(). lavf: add missing '*' in a doxy. h264: Remove a commented-out function pointer typedef. txd: Remove write-only variable in txd_decode_frame(). mmvideo.c: Remove unused variable in mm_decode_pal(). build: cosmetics: Add missing end-of-line backslashes to item lists. build: cosmetics: Split HEADERS/OBJS/PROGS lists into one entry per line. libschroedinger: Move a function to avoid a forward declaration. pthread: warn on high thread counts vf_yadif: fix missing error handling for avfilter_poll_frame() avprobe: allow showing only one container/stream property. lavfi: support audio in avfilter_copy_frame_props(). lavfi: avfilter_merge_formats: handle case where inputs are same lavc: add sample rate and channel layout to AVFrame. zerocodec: check if the previous frame is missing doc: clarify check for NULL pointer style Conflicts: doc/APIchanges doc/developer.texi ffprobe.c libavcodec/Makefile libavcodec/avcodec.h libavcodec/libdirac_libschro.c libavcodec/libdirac_libschro.h libavcodec/mmvideo.c libavcodec/txd.c libavcodec/version.h libavcodec/zerocodec.c libavfilter/Makefile libavfilter/avfilter.c libavfilter/version.h libavformat/Makefile libavutil/Makefile Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffprobe.c')
-rw-r--r--ffprobe.c51
1 files changed, 41 insertions, 10 deletions
diff --git a/ffprobe.c b/ffprobe.c
index 43aa1c5f4c..3c23aa8715 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -50,6 +50,7 @@ static int do_read_packets = 0;
static int do_show_error = 0;
static int do_show_format = 0;
static int do_show_frames = 0;
+static AVDictionary *fmt_entries_to_show = NULL;
static int do_show_packets = 0;
static int do_show_streams = 0;
static int do_show_program_version = 0;
@@ -81,6 +82,7 @@ static uint64_t *nb_streams_frames;
void av_noreturn exit_program(int ret)
{
+ av_dict_free(&fmt_entries_to_show);
exit(ret);
}
@@ -279,8 +281,10 @@ static inline void writer_print_section_footer(WriterContext *wctx,
static inline void writer_print_integer(WriterContext *wctx,
const char *key, long long int val)
{
- wctx->writer->print_integer(wctx, key, val);
- wctx->nb_item++;
+ if (!fmt_entries_to_show || (key && av_dict_get(fmt_entries_to_show, key, NULL, 0))) {
+ wctx->writer->print_integer(wctx, key, val);
+ wctx->nb_item++;
+ }
}
static inline void writer_print_string(WriterContext *wctx,
@@ -288,8 +292,10 @@ static inline void writer_print_string(WriterContext *wctx,
{
if (opt && !(wctx->writer->flags & WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS))
return;
- wctx->writer->print_string(wctx, key, val);
- wctx->nb_item++;
+ if (!fmt_entries_to_show || (key && av_dict_get(fmt_entries_to_show, key, NULL, 0))) {
+ wctx->writer->print_string(wctx, key, val);
+ wctx->nb_item++;
+ }
}
static void writer_print_time(WriterContext *wctx, const char *key,
@@ -297,12 +303,14 @@ static void writer_print_time(WriterContext *wctx, const char *key,
{
char buf[128];
- if (ts == AV_NOPTS_VALUE) {
- writer_print_string(wctx, key, "N/A", 1);
- } else {
- double d = ts * av_q2d(*time_base);
- value_string(buf, sizeof(buf), (struct unit_value){.val.d=d, .unit=unit_second_str});
- writer_print_string(wctx, key, buf, 0);
+ if (!fmt_entries_to_show || (key && av_dict_get(fmt_entries_to_show, key, NULL, 0))) {
+ if (ts == AV_NOPTS_VALUE) {
+ writer_print_string(wctx, key, "N/A", 1);
+ } else {
+ double d = ts * av_q2d(*time_base);
+ value_string(buf, sizeof(buf), (struct unit_value){.val.d=d, .unit=unit_second_str});
+ writer_print_string(wctx, key, buf, 0);
+ }
}
}
@@ -1428,6 +1436,20 @@ static void show_streams(WriterContext *w, AVFormatContext *fmt_ctx)
show_stream(w, fmt_ctx, i);
}
+static void print_format_entry(const char *tag,
+ const char *val)
+{
+ if (!fmt_entries_to_show) {
+ if (tag) {
+ printf("%s=%s\n", tag, val);
+ } else {
+ printf("%s\n", val);
+ }
+ } else if (tag && av_dict_get(fmt_entries_to_show, tag, NULL, 0)) {
+ printf("%s=%s\n", tag, val);
+ }
+}
+
static void show_format(WriterContext *w, AVFormatContext *fmt_ctx)
{
char val_str[128];
@@ -1621,6 +1643,13 @@ static int opt_format(const char *opt, const char *arg)
return 0;
}
+static int opt_show_format_entry(const char *opt, const char *arg)
+{
+ do_show_format = 1;
+ av_dict_set(&fmt_entries_to_show, arg, "", 0);
+ return 0;
+}
+
static void opt_input_file(void *optctx, const char *arg)
{
if (input_filename) {
@@ -1678,6 +1707,8 @@ static const OptionDef options[] = {
{ "show_error", OPT_BOOL, {(void*)&do_show_error} , "show probing error" },
{ "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" },
{ "show_frames", OPT_BOOL, {(void*)&do_show_frames} , "show frames info" },
+ { "show_format_entry", HAS_ARG, {(void*)opt_show_format_entry},
+ "show a particular entry from the format/container info", "entry" },
{ "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" },
{ "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" },
{ "count_frames", OPT_BOOL, {(void*)&do_count_frames}, "count the number of frames per stream" },