Unified · Split
| @@ -65,6 +65,7 @@ enum { · 64 unmodified lines | ||
| 65 | 65 | MODE_FULL, |
| 66 | 66 | MODE_COMPACT, |
| 67 | 67 | MODE_NOZERO, |
| 68 | + MODE_NOZEROEOF, | |
| 68 | 69 | NB_MODES |
| 69 | 70 | }; |
| 70 | 71 | |
| @@ -100,6 +101,7 @@ static const AVOption graphmonitor_options[] = { · 29 unmodified lines | ||
| 100 | 101 | { "full", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_FULL}, 0, 0, VF, "mode" }, |
| 101 | 102 | { "compact", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_COMPACT},0, 0, VF, "mode" }, |
| 102 | 103 | { "nozero", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_NOZERO}, 0, 0, VF, "mode" }, |
| 104 | + { "nozeroeof", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_NOZEROEOF}, 0, 0, VF, "mode" }, | |
| 103 | 105 | { "flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=FLAG_QUEUE}, 0, INT_MAX, VF, "flags" }, |
| 104 | 106 | { "f", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=FLAG_QUEUE}, 0, INT_MAX, VF, "flags" }, |
| 105 | 107 | { "queue", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_QUEUE}, 0, 0, VF, "flags" }, |
| @@ -190,6 +192,25 @@ static void drawtext(AVFrame *pic, int x, int y, const char *txt, uint8_t *color · 84 unmodified lines | ||
| 190 | 192 | } |
| 191 | 193 | } |
| 192 | 194 | |
| 195 | +static int filter_have_eof(AVFilterContext *filter) | |
| 196 | +{ | |
| 197 | + for (int j = 0; j < filter->nb_inputs; j++) { | |
| 198 | + AVFilterLink *l = filter->inputs[j]; | |
| 199 | + | |
| 200 | + if (!ff_outlink_get_status(l)) | |
| 201 | + return 0; | |
| 202 | + } | |
| 203 | + | |
| 204 | + for (int j = 0; j < filter->nb_outputs; j++) { | |
| 205 | + AVFilterLink *l = filter->outputs[j]; | |
| 206 | + | |
| 207 | + if (!ff_outlink_get_status(l)) | |
| 208 | + return 0; | |
| 209 | + } | |
| 210 | + | |
| 211 | + return 1; | |
| 212 | +} | |
| 213 | + | |
| 193 | 214 | static int filter_have_queued(AVFilterContext *filter) |
| 194 | 215 | { |
| 195 | 216 | for (int j = 0; j < filter->nb_inputs; j++) { |
| @@ -255,7 +276,7 @@ static int draw_items(AVFilterContext *ctx, AVFrame *out, · 59 unmodified lines | ||
| 255 | 276 | drawtext(out, xpos, ypos, buffer, s->white); |
| 256 | 277 | xpos += strlen(buffer) * 8; |
| 257 | 278 | } |
| 258 | − if ((s->flags & FLAG_QUEUE) && (s->mode != MODE_NOZERO || frames)) { | |
| 279 | + if ((s->flags & FLAG_QUEUE) && (s->mode < MODE_NOZERO || frames)) { | |
| 259 | 280 | snprintf(buffer, sizeof(buffer)-1, " | queue: "); |
| 260 | 281 | drawtext(out, xpos, ypos, buffer, s->white); |
| 261 | 282 | xpos += strlen(buffer) * 8; |
| @@ -263,52 +284,52 @@ static int draw_items(AVFilterContext *ctx, AVFrame *out, · 1 unmodified line | ||
| 263 | 284 | drawtext(out, xpos, ypos, buffer, frames > 0 ? frames >= 10 ? frames >= 50 ? s->red : s->yellow : s->green : s->white); |
| 264 | 285 | xpos += strlen(buffer) * 8; |
| 265 | 286 | } |
| 266 | − if ((s->flags & FLAG_FCIN) && (s->mode != MODE_NOZERO || l->frame_count_in)) { | |
| 287 | + if ((s->flags & FLAG_FCIN) && (s->mode < MODE_NOZERO || l->frame_count_in)) { | |
| 267 | 288 | snprintf(buffer, sizeof(buffer)-1, " | in: %"PRId64, l->frame_count_in); |
| 268 | 289 | drawtext(out, xpos, ypos, buffer, s->white); |
| 269 | 290 | xpos += strlen(buffer) * 8; |
| 270 | 291 | } |
| 271 | − if ((s->flags & FLAG_FCOUT) && (s->mode != MODE_NOZERO || l->frame_count_out)) { | |
| 292 | + if ((s->flags & FLAG_FCOUT) && (s->mode < MODE_NOZERO || l->frame_count_out)) { | |
| 272 | 293 | snprintf(buffer, sizeof(buffer)-1, " | out: %"PRId64, l->frame_count_out); |
| 273 | 294 | drawtext(out, xpos, ypos, buffer, s->white); |
| 274 | 295 | xpos += strlen(buffer) * 8; |
| 275 | 296 | } |
| 276 | − if ((s->flags & FLAG_FC_DELTA) && (s->mode != MODE_NOZERO || (l->frame_count_in - l->frame_count_out))) { | |
| 297 | + if ((s->flags & FLAG_FC_DELTA) && (s->mode < MODE_NOZERO || (l->frame_count_in - l->frame_count_out))) { | |
| 277 | 298 | snprintf(buffer, sizeof(buffer)-1, " | delta: %"PRId64, l->frame_count_in - l->frame_count_out); |
| 278 | 299 | drawtext(out, xpos, ypos, buffer, s->white); |
| 279 | 300 | xpos += strlen(buffer) * 8; |
| 280 | 301 | } |
| 281 | − if ((s->flags & FLAG_SCIN) && (s->mode != MODE_NOZERO || l->sample_count_in)) { | |
| 302 | + if ((s->flags & FLAG_SCIN) && (s->mode < MODE_NOZERO || l->sample_count_in)) { | |
| 282 | 303 | snprintf(buffer, sizeof(buffer)-1, " | sin: %"PRId64, l->sample_count_in); |
| 283 | 304 | drawtext(out, xpos, ypos, buffer, s->white); |
| 284 | 305 | xpos += strlen(buffer) * 8; |
| 285 | 306 | } |
| 286 | − if ((s->flags & FLAG_SCOUT) && (s->mode != MODE_NOZERO || l->sample_count_out)) { | |
| 307 | + if ((s->flags & FLAG_SCOUT) && (s->mode < MODE_NOZERO || l->sample_count_out)) { | |
| 287 | 308 | snprintf(buffer, sizeof(buffer)-1, " | sout: %"PRId64, l->sample_count_out); |
| 288 | 309 | drawtext(out, xpos, ypos, buffer, s->white); |
| 289 | 310 | xpos += strlen(buffer) * 8; |
| 290 | 311 | } |
| 291 | − if ((s->flags & FLAG_SC_DELTA) && (s->mode != MODE_NOZERO || (l->sample_count_in - l->sample_count_out))) { | |
| 312 | + if ((s->flags & FLAG_SC_DELTA) && (s->mode < MODE_NOZERO || (l->sample_count_in - l->sample_count_out))) { | |
| 292 | 313 | snprintf(buffer, sizeof(buffer)-1, " | sdelta: %"PRId64, l->sample_count_in - l->sample_count_out); |
| 293 | 314 | drawtext(out, xpos, ypos, buffer, s->white); |
| 294 | 315 | xpos += strlen(buffer) * 8; |
| 295 | 316 | } |
| 296 | − if ((s->flags & FLAG_PTS) && (s->mode != MODE_NOZERO || current_pts_us)) { | |
| 317 | + if ((s->flags & FLAG_PTS) && (s->mode < MODE_NOZERO || current_pts_us)) { | |
| 297 | 318 | snprintf(buffer, sizeof(buffer)-1, " | pts: %s", av_ts2str(current_pts_us)); |
| 298 | 319 | drawtext(out, xpos, ypos, buffer, s->white); |
| 299 | 320 | xpos += strlen(buffer) * 8; |
| 300 | 321 | } |
| 301 | − if ((s->flags & FLAG_PTS_DELTA) && (s->mode != MODE_NOZERO || (current_pts_us - previous_pts_us))) { | |
| 322 | + if ((s->flags & FLAG_PTS_DELTA) && (s->mode < MODE_NOZERO || (current_pts_us - previous_pts_us))) { | |
| 302 | 323 | snprintf(buffer, sizeof(buffer)-1, " | pts_delta: %s", av_ts2str(current_pts_us - previous_pts_us)); |
| 303 | 324 | drawtext(out, xpos, ypos, buffer, s->white); |
| 304 | 325 | xpos += strlen(buffer) * 8; |
| 305 | 326 | } |
| 306 | − if ((s->flags & FLAG_TIME) && (s->mode != MODE_NOZERO || current_pts_us)) { | |
| 327 | + if ((s->flags & FLAG_TIME) && (s->mode < MODE_NOZERO || current_pts_us)) { | |
| 307 | 328 | snprintf(buffer, sizeof(buffer)-1, " | time: %s", av_ts2timestr(current_pts_us, &AV_TIME_BASE_Q)); |
| 308 | 329 | drawtext(out, xpos, ypos, buffer, s->white); |
| 309 | 330 | xpos += strlen(buffer) * 8; |
| 310 | 331 | } |
| 311 | − if ((s->flags & FLAG_TIME_DELTA) && (s->mode != MODE_NOZERO || (current_pts_us - previous_pts_us))) { | |
| 332 | + if ((s->flags & FLAG_TIME_DELTA) && (s->mode < MODE_NOZERO || (current_pts_us - previous_pts_us))) { | |
| 312 | 333 | snprintf(buffer, sizeof(buffer)-1, " | time_delta: %s", av_ts2timestr(current_pts_us - previous_pts_us, &AV_TIME_BASE_Q)); |
| 313 | 334 | drawtext(out, xpos, ypos, buffer, s->white); |
| 314 | 335 | xpos += strlen(buffer) * 8; |
| @@ -355,6 +376,9 @@ static int create_frame(AVFilterContext *ctx, int64_t pts) · 40 unmodified lines | ||
| 355 | 376 | if (s->mode == MODE_COMPACT && !filter_have_queued(filter)) |
| 356 | 377 | continue; |
| 357 | 378 | |
| 379 | + if (s->mode == MODE_NOZEROEOF && filter_have_eof(filter)) | |
| 380 | + continue; | |
| 381 | + | |
| 358 | 382 | xpos = 0; |
| 359 | 383 | drawtext(out, xpos, ypos, filter->name, s->white); |
| 360 | 384 | xpos += strlen(filter->name) * 8 + 10; |
| @@ -367,6 +391,9 @@ static int create_frame(AVFilterContext *ctx, int64_t pts) · 6 unmodified lines | ||
| 367 | 391 | if (s->mode == MODE_COMPACT && !frames) |
| 368 | 392 | continue; |
| 369 | 393 | |
| 394 | + if (s->mode == MODE_NOZEROEOF && ff_outlink_get_status(l)) | |
| 395 | + continue; | |
| 396 | + | |
| 370 | 397 | xpos = 10; |
| 371 | 398 | snprintf(buffer, sizeof(buffer)-1, "in%d: ", j); |
| 372 | 399 | drawtext(out, xpos, ypos, buffer, s->white); |
| @@ -387,6 +414,9 @@ static int create_frame(AVFilterContext *ctx, int64_t pts) · 14 unmodified lines | ||
| 387 | 414 | if (s->mode == MODE_COMPACT && !frames) |
| 388 | 415 | continue; |
| 389 | 416 | |
| 417 | + if (s->mode == MODE_NOZEROEOF && ff_outlink_get_status(l)) | |
| 418 | + continue; | |
| 419 | + | |
| 390 | 420 | xpos = 10; |
| 391 | 421 | snprintf(buffer, sizeof(buffer)-1, "out%d: ", j); |
| 392 | 422 | drawtext(out, xpos, ypos, buffer, s->white); |