Unified · Split
| @@ -65,6 +65,7 @@ enum { · 64 unmodified lines | |||
| 65 | MODE_FULL, | 65 | MODE_FULL, |
| 66 | MODE_COMPACT, | 66 | MODE_COMPACT, |
| 67 | MODE_NOZERO, | 67 | MODE_NOZERO, |
| 68 | MODE_NOZEROEOF, | ||
| 68 | NB_MODES | 69 | NB_MODES |
| 69 | }; | 70 | }; |
| 70 | 71 | ||
| @@ -100,6 +101,7 @@ static const AVOption graphmonitor_options[] = { · 29 unmodified lines | |||
| 100 | { "full", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_FULL}, 0, 0, VF, "mode" }, | 101 | { "full", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_FULL}, 0, 0, VF, "mode" }, |
| 101 | { "compact", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_COMPACT},0, 0, VF, "mode" }, | 102 | { "compact", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_COMPACT},0, 0, VF, "mode" }, |
| 102 | { "nozero", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_NOZERO}, 0, 0, VF, "mode" }, | 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 | { "flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=FLAG_QUEUE}, 0, INT_MAX, VF, "flags" }, | 105 | { "flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=FLAG_QUEUE}, 0, INT_MAX, VF, "flags" }, |
| 104 | { "f", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=FLAG_QUEUE}, 0, INT_MAX, VF, "flags" }, | 106 | { "f", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=FLAG_QUEUE}, 0, INT_MAX, VF, "flags" }, |
| 105 | { "queue", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_QUEUE}, 0, 0, VF, "flags" }, | 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 | static int filter_have_queued(AVFilterContext *filter) | 214 | static int filter_have_queued(AVFilterContext *filter) |
| 194 | { | 215 | { |
| 195 | for (int j = 0; j < filter->nb_inputs; j++) { | 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 | drawtext(out, xpos, ypos, buffer, s->white); | 276 | drawtext(out, xpos, ypos, buffer, s->white); |
| 256 | xpos += strlen(buffer) * 8; | 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 | snprintf(buffer, sizeof(buffer)-1, " | queue: "); | 280 | snprintf(buffer, sizeof(buffer)-1, " | queue: "); |
| 260 | drawtext(out, xpos, ypos, buffer, s->white); | 281 | drawtext(out, xpos, ypos, buffer, s->white); |
| 261 | xpos += strlen(buffer) * 8; | 282 | xpos += strlen(buffer) * 8; |
| @@ -263,52 +284,52 @@ static int draw_items(AVFilterContext *ctx, AVFrame *out, · 1 unmodified line | |||
| 263 | drawtext(out, xpos, ypos, buffer, frames > 0 ? frames >= 10 ? frames >= 50 ? s->red : s->yellow : s->green : s->white); | 284 | drawtext(out, xpos, ypos, buffer, frames > 0 ? frames >= 10 ? frames >= 50 ? s->red : s->yellow : s->green : s->white); |
| 264 | xpos += strlen(buffer) * 8; | 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 | snprintf(buffer, sizeof(buffer)-1, " | in: %"PRId64, l->frame_count_in); | 288 | snprintf(buffer, sizeof(buffer)-1, " | in: %"PRId64, l->frame_count_in); |
| 268 | drawtext(out, xpos, ypos, buffer, s->white); | 289 | drawtext(out, xpos, ypos, buffer, s->white); |
| 269 | xpos += strlen(buffer) * 8; | 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 | snprintf(buffer, sizeof(buffer)-1, " | out: %"PRId64, l->frame_count_out); | 293 | snprintf(buffer, sizeof(buffer)-1, " | out: %"PRId64, l->frame_count_out); |
| 273 | drawtext(out, xpos, ypos, buffer, s->white); | 294 | drawtext(out, xpos, ypos, buffer, s->white); |
| 274 | xpos += strlen(buffer) * 8; | 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 | snprintf(buffer, sizeof(buffer)-1, " | delta: %"PRId64, l->frame_count_in - l->frame_count_out); | 298 | snprintf(buffer, sizeof(buffer)-1, " | delta: %"PRId64, l->frame_count_in - l->frame_count_out); |
| 278 | drawtext(out, xpos, ypos, buffer, s->white); | 299 | drawtext(out, xpos, ypos, buffer, s->white); |
| 279 | xpos += strlen(buffer) * 8; | 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 | snprintf(buffer, sizeof(buffer)-1, " | sin: %"PRId64, l->sample_count_in); | 303 | snprintf(buffer, sizeof(buffer)-1, " | sin: %"PRId64, l->sample_count_in); |
| 283 | drawtext(out, xpos, ypos, buffer, s->white); | 304 | drawtext(out, xpos, ypos, buffer, s->white); |
| 284 | xpos += strlen(buffer) * 8; | 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 | snprintf(buffer, sizeof(buffer)-1, " | sout: %"PRId64, l->sample_count_out); | 308 | snprintf(buffer, sizeof(buffer)-1, " | sout: %"PRId64, l->sample_count_out); |
| 288 | drawtext(out, xpos, ypos, buffer, s->white); | 309 | drawtext(out, xpos, ypos, buffer, s->white); |
| 289 | xpos += strlen(buffer) * 8; | 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 | snprintf(buffer, sizeof(buffer)-1, " | sdelta: %"PRId64, l->sample_count_in - l->sample_count_out); | 313 | snprintf(buffer, sizeof(buffer)-1, " | sdelta: %"PRId64, l->sample_count_in - l->sample_count_out); |
| 293 | drawtext(out, xpos, ypos, buffer, s->white); | 314 | drawtext(out, xpos, ypos, buffer, s->white); |
| 294 | xpos += strlen(buffer) * 8; | 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 | snprintf(buffer, sizeof(buffer)-1, " | pts: %s", av_ts2str(current_pts_us)); | 318 | snprintf(buffer, sizeof(buffer)-1, " | pts: %s", av_ts2str(current_pts_us)); |
| 298 | drawtext(out, xpos, ypos, buffer, s->white); | 319 | drawtext(out, xpos, ypos, buffer, s->white); |
| 299 | xpos += strlen(buffer) * 8; | 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 | snprintf(buffer, sizeof(buffer)-1, " | pts_delta: %s", av_ts2str(current_pts_us - previous_pts_us)); | 323 | snprintf(buffer, sizeof(buffer)-1, " | pts_delta: %s", av_ts2str(current_pts_us - previous_pts_us)); |
| 303 | drawtext(out, xpos, ypos, buffer, s->white); | 324 | drawtext(out, xpos, ypos, buffer, s->white); |
| 304 | xpos += strlen(buffer) * 8; | 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 | snprintf(buffer, sizeof(buffer)-1, " | time: %s", av_ts2timestr(current_pts_us, &AV_TIME_BASE_Q)); | 328 | snprintf(buffer, sizeof(buffer)-1, " | time: %s", av_ts2timestr(current_pts_us, &AV_TIME_BASE_Q)); |
| 308 | drawtext(out, xpos, ypos, buffer, s->white); | 329 | drawtext(out, xpos, ypos, buffer, s->white); |
| 309 | xpos += strlen(buffer) * 8; | 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 | snprintf(buffer, sizeof(buffer)-1, " | time_delta: %s", av_ts2timestr(current_pts_us - previous_pts_us, &AV_TIME_BASE_Q)); | 333 | snprintf(buffer, sizeof(buffer)-1, " | time_delta: %s", av_ts2timestr(current_pts_us - previous_pts_us, &AV_TIME_BASE_Q)); |
| 313 | drawtext(out, xpos, ypos, buffer, s->white); | 334 | drawtext(out, xpos, ypos, buffer, s->white); |
| 314 | xpos += strlen(buffer) * 8; | 335 | xpos += strlen(buffer) * 8; |
| @@ -355,6 +376,9 @@ static int create_frame(AVFilterContext *ctx, int64_t pts) · 40 unmodified lines | |||
| 355 | if (s->mode == MODE_COMPACT && !filter_have_queued(filter)) | 376 | if (s->mode == MODE_COMPACT && !filter_have_queued(filter)) |
| 356 | continue; | 377 | continue; |
| 357 | 378 | ||
| 379 | if (s->mode == MODE_NOZEROEOF && filter_have_eof(filter)) | ||
| 380 | continue; | ||
| 381 | |||
| 358 | xpos = 0; | 382 | xpos = 0; |
| 359 | drawtext(out, xpos, ypos, filter->name, s->white); | 383 | drawtext(out, xpos, ypos, filter->name, s->white); |
| 360 | xpos += strlen(filter->name) * 8 + 10; | 384 | xpos += strlen(filter->name) * 8 + 10; |
| @@ -367,6 +391,9 @@ static int create_frame(AVFilterContext *ctx, int64_t pts) · 6 unmodified lines | |||
| 367 | if (s->mode == MODE_COMPACT && !frames) | 391 | if (s->mode == MODE_COMPACT && !frames) |
| 368 | continue; | 392 | continue; |
| 369 | 393 | ||
| 394 | if (s->mode == MODE_NOZEROEOF && ff_outlink_get_status(l)) | ||
| 395 | continue; | ||
| 396 | |||
| 370 | xpos = 10; | 397 | xpos = 10; |
| 371 | snprintf(buffer, sizeof(buffer)-1, "in%d: ", j); | 398 | snprintf(buffer, sizeof(buffer)-1, "in%d: ", j); |
| 372 | drawtext(out, xpos, ypos, buffer, s->white); | 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 | if (s->mode == MODE_COMPACT && !frames) | 414 | if (s->mode == MODE_COMPACT && !frames) |
| 388 | continue; | 415 | continue; |
| 389 | 416 | ||
| 417 | if (s->mode == MODE_NOZEROEOF && ff_outlink_get_status(l)) | ||
| 418 | continue; | ||
| 419 | |||
| 390 | xpos = 10; | 420 | xpos = 10; |
| 391 | snprintf(buffer, sizeof(buffer)-1, "out%d: ", j); | 421 | snprintf(buffer, sizeof(buffer)-1, "out%d: ", j); |
| 392 | drawtext(out, xpos, ypos, buffer, s->white); | 422 | drawtext(out, xpos, ypos, buffer, s->white); |