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

Submitted by Aman Gupta on July 18, 2019, 10:55 p.m.

Details

Message ID 20190718225511.71099-1-ffmpeg@tmm1.net
State New
Headers show

Commit Message

Aman Gupta July 18, 2019, 10:55 p.m.
From: Aman Gupta <aman@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@tmm1.net>
---
 fftools/ffprobe.c | 38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

Comments

Paul B Mahol July 19, 2019, 7:28 a.m.
On 7/19/19, Aman Gupta <ffmpeg@tmm1.net> wrote:
> From: Aman Gupta <aman@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@tmm1.net>
> ---
>  fftools/ffprobe.c | 38 ++++++++++++++++++++------------------
>  1 file changed, 20 insertions(+), 18 deletions(-)
>

Sure this does not need FATE update?


> 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
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Nicolas George July 19, 2019, 7:49 a.m.
Aman Gupta (12019-07-18):
> From: Aman Gupta <aman@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@tmm1.net>
> ---
>  fftools/ffprobe.c | 38 ++++++++++++++++++++------------------
>  1 file changed, 20 insertions(+), 18 deletions(-)

Been there, tried that: it will miss all streams that appear late, like
subtitles in MPEG-PS.

It needs to be an option.

Regards,
Michael Niedermayer July 20, 2019, 8:12 a.m.
On Thu, Jul 18, 2019 at 03:55:11PM -0700, Aman Gupta wrote:
> From: Aman Gupta <aman@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@tmm1.net>
> ---
>  fftools/ffprobe.c | 38 ++++++++++++++++++++------------------
>  1 file changed, 20 insertions(+), 18 deletions(-)

breaks fate-ffprobe_compact

[...]

Patch hide | download patch | download mbox

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);