[FFmpeg-devel] [PATCH] fftools/ffprobe: process show_frame/show_packets last

Aman Gupta ffmpeg at tmm1.net
Fri Jul 19 01:55:11 EEST 2019


From: Aman Gupta <aman at tmm1.net>

When using `ffprobe -show_format -show_streams -show_packets`,
it makes more sense to omit static data about the file format
and streams before the long list of packets instead of at the
end.

Signed-off-by: Aman Gupta <aman at tmm1.net>
---
 fftools/ffprobe.c | 38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 5aaddb0308..c9c10b143d 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -3003,6 +3003,26 @@ static int probe_file(WriterContext *wctx, const char *filename)
             ifile.fmt_ctx->streams[i]->discard = AVDISCARD_ALL;
     }
 
+    if (do_show_format) {
+        ret = show_format(wctx, &ifile);
+        CHECK_END;
+    }
+
+    if (do_show_streams) {
+        ret = show_streams(wctx, &ifile);
+        CHECK_END;
+    }
+
+    if (do_show_programs) {
+        ret = show_programs(wctx, &ifile);
+        CHECK_END;
+    }
+
+    if (do_show_chapters) {
+        ret = show_chapters(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)
@@ -3019,24 +3039,6 @@ static int probe_file(WriterContext *wctx, const char *filename)
         CHECK_END;
     }
 
-    if (do_show_programs) {
-        ret = show_programs(wctx, &ifile);
-        CHECK_END;
-    }
-
-    if (do_show_streams) {
-        ret = show_streams(wctx, &ifile);
-        CHECK_END;
-    }
-    if (do_show_chapters) {
-        ret = show_chapters(wctx, &ifile);
-        CHECK_END;
-    }
-    if (do_show_format) {
-        ret = show_format(wctx, &ifile);
-        CHECK_END;
-    }
-
 end:
     if (ifile.fmt_ctx)
         close_input_file(&ifile);
-- 
2.20.1



More information about the ffmpeg-devel mailing list