diff mbox series

[FFmpeg-devel] avfilter/vf_showinfo: add wallclock option

Message ID PA4PR03MB71674D245B7D22C038F26035FD659@PA4PR03MB7167.eurprd03.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel] avfilter/vf_showinfo: add wallclock option | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed

Commit Message

Michael Riedl Aug. 10, 2022, 2:59 p.m. UTC
Signed-off-by: Michael Riedl <michael.riedl@nativewaves.com>
---
 libavfilter/vf_showinfo.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 2c8514fc80..1953f777c7 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -43,6 +43,7 @@ 
 #include "libavutil/video_enc_params.h"
 #include "libavutil/detection_bbox.h"
 #include "libavutil/uuid.h"
+#include "libavutil/time.h"
 
 #include "avfilter.h"
 #include "internal.h"
@@ -51,6 +52,7 @@ 
 typedef struct ShowInfoContext {
     const AVClass *class;
     int calculate_checksums;
+    int print_wallclock;
 } ShowInfoContext;
 
 #define OFFSET(x) offsetof(ShowInfoContext, x)
@@ -58,6 +60,7 @@  typedef struct ShowInfoContext {
 
 static const AVOption showinfo_options[] = {
     { "checksum", "calculate checksums", OFFSET(calculate_checksums), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, VF },
+    { "wallclock", "print wallclock", OFFSET(print_wallclock), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, VF },
     { NULL }
 };
 
@@ -740,6 +743,14 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
                    sqrt((sum2[plane] - sum[plane]*(double)sum[plane]/pixelcount[plane])/pixelcount[plane]));
         av_log(ctx, AV_LOG_INFO, "\b]");
     }
+
+    if (s->print_wallclock) {
+        av_log(ctx, AV_LOG_INFO,
+               " wallclock:%"PRId64" ",
+               av_gettime()
+        );
+    }
+
     av_log(ctx, AV_LOG_INFO, "\n");
 
     for (i = 0; i < frame->nb_side_data; i++) {