avfilter/f_graphmonitor: also show link EOF status in blue

This commit is contained in:
Paul B Mahol 2020-08-31 18:06:54 +02:00
parent 57915df230
commit e417f84003
2 changed files with 12 additions and 0 deletions

View 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

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