]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/f_graphmonitor: also show link EOF status in blue
authorPaul B Mahol <onemda@gmail.com>
Mon, 31 Aug 2020 16:06:54 +0000 (18:06 +0200)
committerPaul B Mahol <onemda@gmail.com>
Mon, 31 Aug 2020 17:59:35 +0000 (19:59 +0200)
doc/filters.texi
libavfilter/f_graphmonitor.c

index 5074538e9a45d9c03bc92b991829041aca7174cb..fb8757ff8f9054366c0b2b2a574903a273c262db 100644 (file)
@@ -11936,6 +11936,9 @@ Display video size or number of audio channels in case of audio used by filter l
 
 @item rate
 Display video frame rate or sample rate in case of audio used by filter link.
+
+@item eof
+Display link output status.
 @end table
 
 @item rate, r
index a9c4ba42f5c1d5f9c7b6fcdcf984a3bff5eee4a6..535e52b48b1cf78934870c86b7ab22f9440f922a 100644 (file)
@@ -47,6 +47,7 @@ typedef struct GraphMonitorContext {
     uint8_t yellow[4];
     uint8_t red[4];
     uint8_t green[4];
+    uint8_t blue[4];
     uint8_t bg[4];
 } GraphMonitorContext;
 
@@ -60,6 +61,7 @@ enum {
     MODE_FMT   = 1 << 6,
     MODE_SIZE  = 1 << 7,
     MODE_RATE  = 1 << 8,
+    MODE_EOF   = 1 << 9,
 };
 
 #define OFFSET(x) offsetof(GraphMonitorContext, x)
@@ -85,6 +87,7 @@ static const AVOption graphmonitor_options[] = {
         { "format",           NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_FMT},     0, 0, VF, "flags" },
         { "size",             NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_SIZE},    0, 0, VF, "flags" },
         { "rate",             NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_RATE},    0, 0, VF, "flags" },
+        { "eof",              NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_EOF},     0, 0, VF, "flags" },
     { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, VF },
     { "r",    "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, VF },
     { NULL }
@@ -236,6 +239,11 @@ static void draw_items(AVFilterContext *ctx, AVFrame *out,
         drawtext(out, xpos, ypos, buffer, s->white);
         xpos += strlen(buffer) * 8;
     }
+    if (s->flags & MODE_EOF && ff_outlink_get_status(l)) {
+        snprintf(buffer, sizeof(buffer)-1, " | eof");
+        drawtext(out, xpos, ypos, buffer, s->blue);
+        xpos += strlen(buffer) * 8;
+    }
 }
 
 static int create_frame(AVFilterContext *ctx, int64_t pts)
@@ -352,6 +360,7 @@ static int config_output(AVFilterLink *outlink)
     s->yellow[0] = s->yellow[1] = 255;
     s->red[0] = 255;
     s->green[1] = 255;
+    s->blue[2] = 255;
     s->pts = AV_NOPTS_VALUE;
     s->next_pts = AV_NOPTS_VALUE;
     outlink->w = s->w;