Showing the changes to libavfilter/f_graphmonitor.c (1 of 2 files). Show all
Unified · Split
| @@ -54,6 +54,7 @@ typedef struct GraphMonitorContext { · 53 unmodified lines | ||
| 54 | 54 | uint8_t red[4]; |
| 55 | 55 | uint8_t green[4]; |
| 56 | 56 | uint8_t blue[4]; |
| 57 | + uint8_t gray[4]; | |
| 57 | 58 | uint8_t bg[4]; |
| 58 | 59 | |
| 59 | 60 | CacheItem *cache; |
| @@ -66,7 +67,8 @@ enum { · 6 unmodified lines | ||
| 66 | 67 | MODE_COMPACT = 1, |
| 67 | 68 | MODE_NOZERO = 2, |
| 68 | 69 | MODE_NOEOF = 4, |
| 69 | − MODE_MAX = 7 | |
| 70 | + MODE_NODISABLED = 8, | |
| 71 | + MODE_MAX = 15 | |
| 70 | 72 | }; |
| 71 | 73 | |
| 72 | 74 | enum { |
| @@ -86,6 +88,7 @@ enum { · 13 unmodified lines | ||
| 86 | 88 | FLAG_TIME_DELTA = 1 << 13, |
| 87 | 89 | FLAG_FC_DELTA = 1 << 14, |
| 88 | 90 | FLAG_SC_DELTA = 1 << 15, |
| 91 | + FLAG_DISABLED = 1 << 16, | |
| 89 | 92 | }; |
| 90 | 93 | |
| 91 | 94 | #define OFFSET(x) offsetof(GraphMonitorContext, x) |
| @@ -103,6 +106,7 @@ static const AVOption graphmonitor_options[] = { · 11 unmodified lines | ||
| 103 | 106 | { "compact", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_COMPACT},0, 0, VFR, "mode" }, |
| 104 | 107 | { "nozero", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_NOZERO}, 0, 0, VFR, "mode" }, |
| 105 | 108 | { "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" }, | |
| 106 | 110 | { "flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=FLAG_QUEUE}, 0, INT_MAX, VFR, "flags" }, |
| 107 | 111 | { "f", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=FLAG_QUEUE}, 0, INT_MAX, VFR, "flags" }, |
| 108 | 112 | { "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 | ||
| 121 | 125 | { "sample_count_in", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_SCOUT}, 0, 0, VFR, "flags" }, |
| 122 | 126 | { "sample_count_out", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_SCIN}, 0, 0, VFR, "flags" }, |
| 123 | 127 | { "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" }, | |
| 124 | 129 | { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, VF }, |
| 125 | 130 | { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, VF }, |
| 126 | 131 | { NULL } |
| @@ -233,7 +238,9 @@ static int filter_have_queued(AVFilterContext *filter) · 106 unmodified lines | ||
| 233 | 238 | return 0; |
| 234 | 239 | } |
| 235 | 240 | |
| 236 | −static int draw_items(AVFilterContext *ctx, AVFrame *out, | |
| 241 | +static int draw_items(AVFilterContext *ctx, | |
| 242 | + AVFilterContext *filter, | |
| 243 | + AVFrame *out, | |
| 237 | 244 | int xpos, int ypos, |
| 238 | 245 | AVFilterLink *l, |
| 239 | 246 | size_t frames) |
| @@ -335,11 +342,16 @@ static int draw_items(AVFilterContext *ctx, AVFrame *out, · 95 unmodified lines | ||
| 335 | 342 | drawtext(out, xpos, ypos, buffer, s->white); |
| 336 | 343 | xpos += strlen(buffer) * 8; |
| 337 | 344 | } |
| 338 | − if (s->flags & FLAG_EOF && ff_outlink_get_status(l)) { | |
| 345 | + if ((s->flags & FLAG_EOF) && ff_outlink_get_status(l)) { | |
| 339 | 346 | snprintf(buffer, sizeof(buffer)-1, " | eof"); |
| 340 | 347 | drawtext(out, xpos, ypos, buffer, s->blue); |
| 341 | 348 | xpos += strlen(buffer) * 8; |
| 342 | 349 | } |
| 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 | + } | |
| 343 | 355 | |
| 344 | 356 | s->cache[s->cache_index].previous_pts_us = l->current_pts_us; |
| 345 | 357 | |
| @@ -380,6 +392,9 @@ static int create_frame(AVFilterContext *ctx, int64_t pts) · 34 unmodified lines | ||
| 380 | 392 | if ((s->mode & MODE_NOEOF) && filter_have_eof(filter)) |
| 381 | 393 | continue; |
| 382 | 394 | |
| 395 | + if ((s->mode & MODE_NODISABLED) && filter->is_disabled) | |
| 396 | + continue; | |
| 397 | + | |
| 383 | 398 | xpos = 0; |
| 384 | 399 | drawtext(out, xpos, ypos, filter->name, s->white); |
| 385 | 400 | xpos += strlen(filter->name) * 8 + 10; |
| @@ -401,7 +416,7 @@ static int create_frame(AVFilterContext *ctx, int64_t pts) · 15 unmodified lines | ||
| 401 | 416 | xpos += strlen(buffer) * 8; |
| 402 | 417 | drawtext(out, xpos, ypos, l->src->name, s->white); |
| 403 | 418 | 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); | |
| 405 | 420 | if (ret < 0) |
| 406 | 421 | goto error; |
| 407 | 422 | ypos += 10; |
| @@ -424,7 +439,7 @@ static int create_frame(AVFilterContext *ctx, int64_t pts) · 16 unmodified lines | ||
| 424 | 439 | xpos += strlen(buffer) * 8; |
| 425 | 440 | drawtext(out, xpos, ypos, l->dst->name, s->white); |
| 426 | 441 | 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); | |
| 428 | 443 | if (ret < 0) |
| 429 | 444 | goto error; |
| 430 | 445 | ypos += 10; |
| @@ -489,6 +504,7 @@ static int config_output(AVFilterLink *outlink) · 58 unmodified lines | ||
| 489 | 504 | s->red[0] = 255; |
| 490 | 505 | s->green[1] = 255; |
| 491 | 506 | s->blue[2] = 255; |
| 507 | + s->gray[0] = s->gray[1] = s->gray[2] = 128; | |
| 492 | 508 | s->pts = AV_NOPTS_VALUE; |
| 493 | 509 | s->next_pts = AV_NOPTS_VALUE; |
| 494 | 510 | outlink->w = s->w; |