]> git.sesse.net Git - ffmpeg/blobdiff - ffprobe.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / ffprobe.c
index fc665a7a0270503f212f8505406bfc702aa3cbac..f70c24c084932e7eaba6ded596af2c61fdbb5143 100644 (file)
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -642,15 +642,15 @@ static const char *csv_escape_str(AVBPrint *dst, const char *src, const char sep
     int needs_quoting = !!src[strcspn(src, meta_chars)];
 
     if (needs_quoting)
-        av_bprint_chars(dst, '\"', 1);
+        av_bprint_chars(dst, '"', 1);
 
     for (; *src; src++) {
         if (*src == '"')
-            av_bprint_chars(dst, '\"', 1);
+            av_bprint_chars(dst, '"', 1);
         av_bprint_chars(dst, *src, 1);
     }
     if (needs_quoting)
-        av_bprint_chars(dst, '\"', 1);
+        av_bprint_chars(dst, '"', 1);
     return dst->str;
 }
 
@@ -1254,7 +1254,7 @@ static const char *xml_escape_str(AVBPrint *dst, const char *src, void *log_ctx)
         case '&' : av_bprintf(dst, "%s", "&");  break;
         case '<' : av_bprintf(dst, "%s", "&lt;");   break;
         case '>' : av_bprintf(dst, "%s", "&gt;");   break;
-        case '\"': av_bprintf(dst, "%s", "&quot;"); break;
+        case '"' : av_bprintf(dst, "%s", "&quot;"); break;
         case '\'': av_bprintf(dst, "%s", "&apos;"); break;
         default: av_bprint_chars(dst, *p, 1);
         }
@@ -1476,6 +1476,8 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
     print_duration_time("pkt_duration_time", frame->pkt_duration, &stream->time_base);
     if (frame->pkt_pos != -1) print_fmt    ("pkt_pos", "%"PRId64, frame->pkt_pos);
     else                      print_str_opt("pkt_pos", "N/A");
+    if (frame->pkt_size != -1) print_fmt    ("pkt_size", "%d", av_frame_get_pkt_size(frame));
+    else                       print_str_opt("pkt_size", "N/A");
 
     switch (stream->codec->codec_type) {
         AVRational sar;
@@ -2043,6 +2045,7 @@ static int opt_show_entries(void *optctx, const char *opt, const char *arg)
             av_log(NULL, AV_LOG_ERROR, "No match for section '%s'\n", section_name);
             ret = AVERROR(EINVAL);
         }
+        av_dict_free(&entries);
         av_free(section_name);
 
         if (ret <= 0)
@@ -2105,6 +2108,35 @@ static int opt_pretty(void *optctx, const char *opt, const char *arg)
     return 0;
 }
 
+static void print_section(SectionID id, int level)
+{
+    const SectionID *pid;
+    const struct section *section = &sections[id];
+    printf("%c%c%c",
+           section->flags & SECTION_FLAG_IS_WRAPPER           ? 'W' : '.',
+           section->flags & SECTION_FLAG_IS_ARRAY             ? 'A' : '.',
+           section->flags & SECTION_FLAG_HAS_VARIABLE_FIELDS  ? 'V' : '.');
+    printf("%*c  %s", level * 4, ' ', section->name);
+    if (section->unique_name)
+        printf("/%s", section->unique_name);
+    printf("\n");
+
+    for (pid = section->children_ids; *pid != -1; pid++)
+        print_section(*pid, level+1);
+}
+
+static int opt_sections(void *optctx, const char *opt, const char *arg)
+{
+    printf("Sections:\n"
+           "W.. = Section is a wrapper (contains other sections, no local entries)\n"
+           ".A. = Section contains an array of elements of the same type\n"
+           "..V = Section may contain a variable number of fields with variable keys\n"
+           "FLAGS NAME/UNIQUE_NAME\n"
+           "---\n");
+    print_section(SECTION_ID_ROOT, 0);
+    return 0;
+}
+
 static int opt_show_versions(const char *opt, const char *arg)
 {
     mark_section_show_entries(SECTION_ID_PROGRAM_VERSION, 1, NULL);
@@ -2142,6 +2174,7 @@ static const OptionDef real_options[] = {
       "set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml)", "format" },
     { "of", OPT_STRING | HAS_ARG, {(void*)&print_format}, "alias for -print_format", "format" },
     { "select_streams", OPT_STRING | HAS_ARG, {(void*)&stream_specifier}, "select the specified streams", "stream_specifier" },
+    { "sections", OPT_EXIT, {.func_arg = opt_sections}, "print sections structure and section information, and exit" },
     { "show_data",    OPT_BOOL, {(void*)&do_show_data}, "show packets data" },
     { "show_error",   0, {(void*)&opt_show_error},  "show probing error" },
     { "show_format",  0, {(void*)&opt_show_format}, "show format/container info" },