]> git.sesse.net Git - ffmpeg/blobdiff - ffprobe.c
ffprobe: add show_private_data option
[ffmpeg] / ffprobe.c
index 52f07e72ff3ecf7cfd54cd693757994ef63dd57d..e377c3c767c70aa161d10d7efc3b70ecb29cc176 100644 (file)
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1,5 +1,4 @@
 /*
- * ffprobe : Simple Media Prober based on the FFmpeg libraries
  * Copyright (c) 2007-2010 Stefano Sabatini
  *
  * This file is part of FFmpeg.
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+/**
+ * @file
+ * simple media prober based on the FFmpeg libraries
+ */
+
 #include "config.h"
 
 #include "libavformat/avformat.h"
@@ -41,6 +45,7 @@ static int show_value_unit              = 0;
 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 char *print_format;
 
@@ -892,7 +897,7 @@ static void writer_register_all(void)
 #define print_time(k, v, tb)    writer_print_time(w, k, v, tb)
 #define print_ts(k, v)          writer_print_ts(w, k, v)
 #define print_val(k, v, u)      writer_print_string(w, k, \
-    value_string(val_str, sizeof(val_str), (struct unit_value){.val.i = v, .unit=u}), 1)
+    value_string(val_str, sizeof(val_str), (struct unit_value){.val.i = v, .unit=u}), 0)
 #define print_section_header(s) writer_print_section_header(w, s)
 #define print_section_footer(s) writer_print_section_footer(w, s)
 #define show_tags(metadata)     writer_show_tags(w, metadata)
@@ -993,6 +998,17 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
             if (s) print_str    ("pix_fmt", s);
             else   print_str_opt("pix_fmt", "unknown");
             print_int("level",   dec_ctx->level);
+            if (dec_ctx->timecode_frame_start >= 0) {
+                uint32_t tc = dec_ctx->timecode_frame_start;
+                print_fmt("timecode", "%02d:%02d:%02d%c%02d",
+                          tc>>19 & 0x1f,              // hours
+                          tc>>13 & 0x3f,              // minutes
+                          tc>>6  & 0x3f,              // seconds
+                          tc     & 1<<24 ? ';' : ':', // drop
+                          tc     & 0x3f);             // frames
+            } else {
+                print_str_opt("timecode", "N/A");
+            }
             break;
 
         case AVMEDIA_TYPE_AUDIO:
@@ -1007,7 +1023,7 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
     } else {
         print_str_opt("codec_type", "unknown");
     }
-    if (dec_ctx->codec && dec_ctx->codec->priv_class) {
+    if (dec_ctx->codec && dec_ctx->codec->priv_class && show_private_data) {
         const AVOption *opt = NULL;
         while (opt = av_opt_next(dec_ctx->priv_data,opt)) {
             uint8_t *str;
@@ -1149,7 +1165,7 @@ static int probe_file(const char *filename)
     PRINT_CHAPTER(format);
     writer_print_footer(wctx);
 
-    av_close_input_file(fmt_ctx);
+    avformat_close_input(&fmt_ctx);
     writer_close(&wctx);
 
 end:
@@ -1224,6 +1240,8 @@ static const OptionDef options[] = {
     { "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" },
+    { "show_private_data", OPT_BOOL, {(void*)&show_private_data}, "show private data" },
+    { "private",           OPT_BOOL, {(void*)&show_private_data}, "same as show_private_data" },
     { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
     { "i", HAS_ARG, {(void *)opt_input_file}, "read specified file", "input_file"},
     { NULL, },
@@ -1241,7 +1259,7 @@ int main(int argc, char **argv)
     avdevice_register_all();
 #endif
 
-    show_banner();
+    show_banner(argc, argv, options);
     parse_options(NULL, argc, argv, options, opt_input_file);
 
     if (!input_filename) {