History

avfilter/f_graphmonitor: show also current timeline status of filter

Paul B Mahol committed 3 years ago

Commit b528e091 parent fcabfcb2 files · +26 −5Browse files

Unified · Split

2 files
  1. doc/filters.texi +5 −0
  2. libavfilter/f_graphmonitor.c +21 −5
doc/filters.texi+5−0
@@ -14651,6 +14651,8 @@ Show only filters with queued frames. · 14650 unmodified lines
1465114651 Show only filters with non-zero stats.
1465214652 @item noeof
1465314653 Show only filters with non-eof stat.
14654+@item nodisabled
14655+Show only filters that are enabled in timeline.
1465414656 @end table
1465514657
1465614658 @item flags, f
@@ -14705,6 +14707,9 @@ Display number of samples given out from filter. · 48 unmodified lines
1470514707
1470614708 @item sample_count_delta
1470714709 Display delta number of samples between above two values.
14710+
14711+@item disabled
14712+Show the timeline filter status.
1470814713 @end table
1470914714
1471014715 @item rate, r
libavfilter/f_graphmonitor.c+21−5
@@ -54,6 +54,7 @@ typedef struct GraphMonitorContext { · 53 unmodified lines
5454 uint8_t red[4];
5555 uint8_t green[4];
5656 uint8_t blue[4];
57+ uint8_t gray[4];
5758 uint8_t bg[4];
5859
5960 CacheItem *cache;
@@ -66,7 +67,8 @@ enum { · 6 unmodified lines
6667 MODE_COMPACT = 1,
6768 MODE_NOZERO = 2,
6869 MODE_NOEOF = 4,
69− MODE_MAX = 7
70+ MODE_NODISABLED = 8,
71+ MODE_MAX = 15
7072 };
7173
7274 enum {
@@ -86,6 +88,7 @@ enum { · 13 unmodified lines
8688 FLAG_TIME_DELTA = 1 << 13,
8789 FLAG_FC_DELTA = 1 << 14,
8890 FLAG_SC_DELTA = 1 << 15,
91+ FLAG_DISABLED = 1 << 16,
8992 };
9093
9194 #define OFFSET(x) offsetof(GraphMonitorContext, x)
@@ -103,6 +106,7 @@ static const AVOption graphmonitor_options[] = { · 11 unmodified lines
103106 { "compact", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_COMPACT},0, 0, VFR, "mode" },
104107 { "nozero", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_NOZERO}, 0, 0, VFR, "mode" },
105108 { "noeof", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_NOEOF}, 0, 0, VFR, "mode" },
109+ { "nodisabled",NULL,0,AV_OPT_TYPE_CONST, {.i64=MODE_NODISABLED},0,0,VFR,"mode" },
106110 { "flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=FLAG_QUEUE}, 0, INT_MAX, VFR, "flags" },
107111 { "f", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=FLAG_QUEUE}, 0, INT_MAX, VFR, "flags" },
108112 { "queue", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_QUEUE}, 0, 0, VFR, "flags" },
@@ -121,6 +125,7 @@ static const AVOption graphmonitor_options[] = { · 12 unmodified lines
121125 { "sample_count_in", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_SCOUT}, 0, 0, VFR, "flags" },
122126 { "sample_count_out", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_SCIN}, 0, 0, VFR, "flags" },
123127 { "sample_count_delta",NULL,0, AV_OPT_TYPE_CONST, {.i64=FLAG_SC_DELTA},0, 0, VFR, "flags" },
128+ { "disabled", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_DISABLED},0, 0, VFR, "flags" },
124129 { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, VF },
125130 { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, VF },
126131 { NULL }
@@ -233,7 +238,9 @@ static int filter_have_queued(AVFilterContext *filter) · 106 unmodified lines
233238 return 0;
234239 }
235240
236−static int draw_items(AVFilterContext *ctx, AVFrame *out,
241+static int draw_items(AVFilterContext *ctx,
242+ AVFilterContext *filter,
243+ AVFrame *out,
237244 int xpos, int ypos,
238245 AVFilterLink *l,
239246 size_t frames)
@@ -335,11 +342,16 @@ static int draw_items(AVFilterContext *ctx, AVFrame *out, · 95 unmodified lines
335342 drawtext(out, xpos, ypos, buffer, s->white);
336343 xpos += strlen(buffer) * 8;
337344 }
338− if (s->flags & FLAG_EOF && ff_outlink_get_status(l)) {
345+ if ((s->flags & FLAG_EOF) && ff_outlink_get_status(l)) {
339346 snprintf(buffer, sizeof(buffer)-1, " | eof");
340347 drawtext(out, xpos, ypos, buffer, s->blue);
341348 xpos += strlen(buffer) * 8;
342349 }
350+ if ((s->flags & FLAG_DISABLED) && filter->is_disabled) {
351+ snprintf(buffer, sizeof(buffer)-1, " | off");
352+ drawtext(out, xpos, ypos, buffer, s->gray);
353+ xpos += strlen(buffer) * 8;
354+ }
343355
344356 s->cache[s->cache_index].previous_pts_us = l->current_pts_us;
345357
@@ -380,6 +392,9 @@ static int create_frame(AVFilterContext *ctx, int64_t pts) · 34 unmodified lines
380392 if ((s->mode & MODE_NOEOF) && filter_have_eof(filter))
381393 continue;
382394
395+ if ((s->mode & MODE_NODISABLED) && filter->is_disabled)
396+ continue;
397+
383398 xpos = 0;
384399 drawtext(out, xpos, ypos, filter->name, s->white);
385400 xpos += strlen(filter->name) * 8 + 10;
@@ -401,7 +416,7 @@ static int create_frame(AVFilterContext *ctx, int64_t pts) · 15 unmodified lines
401416 xpos += strlen(buffer) * 8;
402417 drawtext(out, xpos, ypos, l->src->name, s->white);
403418 xpos += strlen(l->src->name) * 8 + 10;
404− ret = draw_items(ctx, out, xpos, ypos, l, frames);
419+ ret = draw_items(ctx, filter, out, xpos, ypos, l, frames);
405420 if (ret < 0)
406421 goto error;
407422 ypos += 10;
@@ -424,7 +439,7 @@ static int create_frame(AVFilterContext *ctx, int64_t pts) · 16 unmodified lines
424439 xpos += strlen(buffer) * 8;
425440 drawtext(out, xpos, ypos, l->dst->name, s->white);
426441 xpos += strlen(l->dst->name) * 8 + 10;
427− ret = draw_items(ctx, out, xpos, ypos, l, frames);
442+ ret = draw_items(ctx, filter, out, xpos, ypos, l, frames);
428443 if (ret < 0)
429444 goto error;
430445 ypos += 10;
@@ -489,6 +504,7 @@ static int config_output(AVFilterLink *outlink) · 58 unmodified lines
489504 s->red[0] = 255;
490505 s->green[1] = 255;
491506 s->blue[2] = 255;
507+ s->gray[0] = s->gray[1] = s->gray[2] = 128;
492508 s->pts = AV_NOPTS_VALUE;
493509 s->next_pts = AV_NOPTS_VALUE;
494510 outlink->w = s->w;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t