Showing the changes to libavfilter (1 of 2 files). Show all
Unified · Split
| @@ -61,6 +61,13 @@ typedef struct GraphMonitorContext { · 60 unmodified lines | ||
| 61 | 61 | unsigned int cache_index; |
| 62 | 62 | } GraphMonitorContext; |
| 63 | 63 | |
| 64 | +enum { | |
| 65 | + MODE_FULL, | |
| 66 | + MODE_COMPACT, | |
| 67 | + MODE_NOZERO, | |
| 68 | + NB_MODES | |
| 69 | +}; | |
| 70 | + | |
| 64 | 71 | enum { |
| 65 | 72 | FLAG_QUEUE = 1 << 0, |
| 66 | 73 | FLAG_FCIN = 1 << 1, |
| @@ -88,11 +95,11 @@ static const AVOption graphmonitor_options[] = { · 21 unmodified lines | ||
| 88 | 95 | { "s", "set monitor size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, 0, 0, VF }, |
| 89 | 96 | { "opacity", "set video opacity", OFFSET(opacity), AV_OPT_TYPE_FLOAT, {.dbl=.9}, 0, 1, VF }, |
| 90 | 97 | { "o", "set video opacity", OFFSET(opacity), AV_OPT_TYPE_FLOAT, {.dbl=.9}, 0, 1, VF }, |
| 91 | − { "mode", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, VF, "mode" }, | |
| 92 | − { "m", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, VF, "mode" }, | |
| 93 | − { "full", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, VF, "mode" }, | |
| 94 | − { "compact", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, VF, "mode" }, | |
| 95 | − { "nozero", NULL, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, VF, "mode" }, | |
| 98 | + { "mode", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_MODES-1, VF, "mode" }, | |
| 99 | + { "m", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_MODES-1, VF, "mode" }, | |
| 100 | + { "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 | + { "nozero", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_NOZERO}, 0, 0, VF, "mode" }, | |
| 96 | 103 | { "flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=FLAG_QUEUE}, 0, INT_MAX, VF, "flags" }, |
| 97 | 104 | { "f", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=FLAG_QUEUE}, 0, INT_MAX, VF, "flags" }, |
| 98 | 105 | { "queue", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_QUEUE}, 0, 0, VF, "flags" }, |
| @@ -248,7 +255,7 @@ static int draw_items(AVFilterContext *ctx, AVFrame *out, · 149 unmodified lines | ||
| 248 | 255 | drawtext(out, xpos, ypos, buffer, s->white); |
| 249 | 256 | xpos += strlen(buffer) * 8; |
| 250 | 257 | } |
| 251 | − if (s->flags & FLAG_QUEUE) { | |
| 258 | + if ((s->flags & FLAG_QUEUE) && (s->mode != MODE_NOZERO || frames)) { | |
| 252 | 259 | snprintf(buffer, sizeof(buffer)-1, " | queue: "); |
| 253 | 260 | drawtext(out, xpos, ypos, buffer, s->white); |
| 254 | 261 | xpos += strlen(buffer) * 8; |
| @@ -256,52 +263,52 @@ static int draw_items(AVFilterContext *ctx, AVFrame *out, · 1 unmodified line | ||
| 256 | 263 | drawtext(out, xpos, ypos, buffer, frames > 0 ? frames >= 10 ? frames >= 50 ? s->red : s->yellow : s->green : s->white); |
| 257 | 264 | xpos += strlen(buffer) * 8; |
| 258 | 265 | } |
| 259 | − if (s->flags & FLAG_FCIN) { | |
| 266 | + if ((s->flags & FLAG_FCIN) && (s->mode != MODE_NOZERO || l->frame_count_in)) { | |
| 260 | 267 | snprintf(buffer, sizeof(buffer)-1, " | in: %"PRId64, l->frame_count_in); |
| 261 | 268 | drawtext(out, xpos, ypos, buffer, s->white); |
| 262 | 269 | xpos += strlen(buffer) * 8; |
| 263 | 270 | } |
| 264 | − if (s->flags & FLAG_FCOUT) { | |
| 271 | + if ((s->flags & FLAG_FCOUT) && (s->mode != MODE_NOZERO || l->frame_count_out)) { | |
| 265 | 272 | snprintf(buffer, sizeof(buffer)-1, " | out: %"PRId64, l->frame_count_out); |
| 266 | 273 | drawtext(out, xpos, ypos, buffer, s->white); |
| 267 | 274 | xpos += strlen(buffer) * 8; |
| 268 | 275 | } |
| 269 | − if (s->flags & FLAG_FC_DELTA) { | |
| 276 | + if ((s->flags & FLAG_FC_DELTA) && (s->mode != MODE_NOZERO || (l->frame_count_in - l->frame_count_out))) { | |
| 270 | 277 | snprintf(buffer, sizeof(buffer)-1, " | delta: %"PRId64, l->frame_count_in - l->frame_count_out); |
| 271 | 278 | drawtext(out, xpos, ypos, buffer, s->white); |
| 272 | 279 | xpos += strlen(buffer) * 8; |
| 273 | 280 | } |
| 274 | − if (s->flags & FLAG_SCIN) { | |
| 281 | + if ((s->flags & FLAG_SCIN) && (s->mode != MODE_NOZERO || l->sample_count_in)) { | |
| 275 | 282 | snprintf(buffer, sizeof(buffer)-1, " | sin: %"PRId64, l->sample_count_in); |
| 276 | 283 | drawtext(out, xpos, ypos, buffer, s->white); |
| 277 | 284 | xpos += strlen(buffer) * 8; |
| 278 | 285 | } |
| 279 | − if (s->flags & FLAG_SCOUT) { | |
| 286 | + if ((s->flags & FLAG_SCOUT) && (s->mode != MODE_NOZERO || l->sample_count_out)) { | |
| 280 | 287 | snprintf(buffer, sizeof(buffer)-1, " | sout: %"PRId64, l->sample_count_out); |
| 281 | 288 | drawtext(out, xpos, ypos, buffer, s->white); |
| 282 | 289 | xpos += strlen(buffer) * 8; |
| 283 | 290 | } |
| 284 | − if (s->flags & FLAG_SC_DELTA) { | |
| 291 | + if ((s->flags & FLAG_SC_DELTA) && (s->mode != MODE_NOZERO || (l->sample_count_in - l->sample_count_out))) { | |
| 285 | 292 | snprintf(buffer, sizeof(buffer)-1, " | sdelta: %"PRId64, l->sample_count_in - l->sample_count_out); |
| 286 | 293 | drawtext(out, xpos, ypos, buffer, s->white); |
| 287 | 294 | xpos += strlen(buffer) * 8; |
| 288 | 295 | } |
| 289 | − if (s->flags & FLAG_PTS) { | |
| 296 | + if ((s->flags & FLAG_PTS) && (s->mode != MODE_NOZERO || current_pts_us)) { | |
| 290 | 297 | snprintf(buffer, sizeof(buffer)-1, " | pts: %s", av_ts2str(current_pts_us)); |
| 291 | 298 | drawtext(out, xpos, ypos, buffer, s->white); |
| 292 | 299 | xpos += strlen(buffer) * 8; |
| 293 | 300 | } |
| 294 | − if (s->flags & FLAG_PTS_DELTA) { | |
| 301 | + if ((s->flags & FLAG_PTS_DELTA) && (s->mode != MODE_NOZERO || (current_pts_us - previous_pts_us))) { | |
| 295 | 302 | snprintf(buffer, sizeof(buffer)-1, " | pts_delta: %s", av_ts2str(current_pts_us - previous_pts_us)); |
| 296 | 303 | drawtext(out, xpos, ypos, buffer, s->white); |
| 297 | 304 | xpos += strlen(buffer) * 8; |
| 298 | 305 | } |
| 299 | − if (s->flags & FLAG_TIME) { | |
| 306 | + if ((s->flags & FLAG_TIME) && (s->mode != MODE_NOZERO || current_pts_us)) { | |
| 300 | 307 | snprintf(buffer, sizeof(buffer)-1, " | time: %s", av_ts2timestr(current_pts_us, &AV_TIME_BASE_Q)); |
| 301 | 308 | drawtext(out, xpos, ypos, buffer, s->white); |
| 302 | 309 | xpos += strlen(buffer) * 8; |
| 303 | 310 | } |
| 304 | − if (s->flags & FLAG_TIME_DELTA) { | |
| 311 | + if ((s->flags & FLAG_TIME_DELTA) && (s->mode != MODE_NOZERO || (current_pts_us - previous_pts_us))) { | |
| 305 | 312 | snprintf(buffer, sizeof(buffer)-1, " | time_delta: %s", av_ts2timestr(current_pts_us - previous_pts_us, &AV_TIME_BASE_Q)); |
| 306 | 313 | drawtext(out, xpos, ypos, buffer, s->white); |
| 307 | 314 | xpos += strlen(buffer) * 8; |
| @@ -345,7 +352,7 @@ static int create_frame(AVFilterContext *ctx, int64_t pts) · 37 unmodified lines | ||
| 345 | 352 | AVFilterContext *filter = ctx->graph->filters[i]; |
| 346 | 353 | char buffer[1024] = { 0 }; |
| 347 | 354 | |
| 348 | − if (s->mode && !filter_have_queued(filter)) | |
| 355 | + if (s->mode == MODE_COMPACT && !filter_have_queued(filter)) | |
| 349 | 356 | continue; |
| 350 | 357 | |
| 351 | 358 | xpos = 0; |
| @@ -357,7 +364,7 @@ static int create_frame(AVFilterContext *ctx, int64_t pts) · 5 unmodified lines | ||
| 357 | 364 | AVFilterLink *l = filter->inputs[j]; |
| 358 | 365 | size_t frames = ff_inlink_queued_frames(l); |
| 359 | 366 | |
| 360 | − if (s->mode && !frames) | |
| 367 | + if (s->mode == MODE_COMPACT && !frames) | |
| 361 | 368 | continue; |
| 362 | 369 | |
| 363 | 370 | xpos = 10; |
| @@ -377,7 +384,7 @@ static int create_frame(AVFilterContext *ctx, int64_t pts) · 13 unmodified lines | ||
| 377 | 384 | AVFilterLink *l = filter->outputs[j]; |
| 378 | 385 | size_t frames = ff_inlink_queued_frames(l); |
| 379 | 386 | |
| 380 | − if (s->mode && !frames) | |
| 387 | + if (s->mode == MODE_COMPACT && !frames) | |
| 381 | 388 | continue; |
| 382 | 389 | |
| 383 | 390 | xpos = 10; |