From e417f84003d1dc62983024e902c9ebf306fdffe3 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Mon, 31 Aug 2020 18:06:54 +0200 Subject: [PATCH] avfilter/f_graphmonitor: also show link EOF status in blue --- doc/filters.texi | 3 +++ libavfilter/f_graphmonitor.c | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/doc/filters.texi b/doc/filters.texi index 5074538e9a..fb8757ff8f 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -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 diff --git a/libavfilter/f_graphmonitor.c b/libavfilter/f_graphmonitor.c index a9c4ba42f5..535e52b48b 100644 --- a/libavfilter/f_graphmonitor.c +++ b/libavfilter/f_graphmonitor.c @@ -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;