Showing the changes to libavfilter/f_graphmonitor.c (1 of 1 file). Show all
Unified · Split
| @@ -62,22 +62,22 @@ typedef struct GraphMonitorContext { · 61 unmodified lines | ||
| 62 | 62 | } GraphMonitorContext; |
| 63 | 63 | |
| 64 | 64 | enum { |
| 65 | − MODE_QUEUE = 1 << 0, | |
| 66 | − MODE_FCIN = 1 << 1, | |
| 67 | − MODE_FCOUT = 1 << 2, | |
| 68 | − MODE_PTS = 1 << 3, | |
| 69 | − MODE_TIME = 1 << 4, | |
| 70 | − MODE_TB = 1 << 5, | |
| 71 | − MODE_FMT = 1 << 6, | |
| 72 | − MODE_SIZE = 1 << 7, | |
| 73 | − MODE_RATE = 1 << 8, | |
| 74 | − MODE_EOF = 1 << 9, | |
| 75 | − MODE_SCIN = 1 << 10, | |
| 76 | − MODE_SCOUT = 1 << 11, | |
| 77 | − MODE_PTS_DELTA = 1 << 12, | |
| 78 | − MODE_TIME_DELTA = 1 << 13, | |
| 79 | − MODE_FC_DELTA = 1 << 14, | |
| 80 | − MODE_SC_DELTA = 1 << 15, | |
| 65 | + FLAG_QUEUE = 1 << 0, | |
| 66 | + FLAG_FCIN = 1 << 1, | |
| 67 | + FLAG_FCOUT = 1 << 2, | |
| 68 | + FLAG_PTS = 1 << 3, | |
| 69 | + FLAG_TIME = 1 << 4, | |
| 70 | + FLAG_TB = 1 << 5, | |
| 71 | + FLAG_FMT = 1 << 6, | |
| 72 | + FLAG_SIZE = 1 << 7, | |
| 73 | + FLAG_RATE = 1 << 8, | |
| 74 | + FLAG_EOF = 1 << 9, | |
| 75 | + FLAG_SCIN = 1 << 10, | |
| 76 | + FLAG_SCOUT = 1 << 11, | |
| 77 | + FLAG_PTS_DELTA = 1 << 12, | |
| 78 | + FLAG_TIME_DELTA = 1 << 13, | |
| 79 | + FLAG_FC_DELTA = 1 << 14, | |
| 80 | + FLAG_SC_DELTA = 1 << 15, | |
| 81 | 81 | }; |
| 82 | 82 | |
| 83 | 83 | #define OFFSET(x) offsetof(GraphMonitorContext, x) |
| @@ -88,28 +88,29 @@ static const AVOption graphmonitor_options[] = { · 4 unmodified lines | ||
| 88 | 88 | { "s", "set monitor size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, 0, 0, VF }, |
| 89 | 89 | { "opacity", "set video opacity", OFFSET(opacity), AV_OPT_TYPE_FLOAT, {.dbl=.9}, 0, 1, VF }, |
| 90 | 90 | { "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, 1, VF, "mode" }, | |
| 92 | − { "m", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, VF, "mode" }, | |
| 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 | 93 | { "full", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, VF, "mode" }, |
| 94 | 94 | { "compact", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, VF, "mode" }, |
| 95 | − { "flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=MODE_QUEUE}, 0, INT_MAX, VF, "flags" }, | |
| 96 | − { "f", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=MODE_QUEUE}, 0, INT_MAX, VF, "flags" }, | |
| 97 | − { "queue", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_QUEUE}, 0, 0, VF, "flags" }, | |
| 98 | − { "frame_count_in", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_FCOUT}, 0, 0, VF, "flags" }, | |
| 99 | − { "frame_count_out", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_FCIN}, 0, 0, VF, "flags" }, | |
| 100 | − { "frame_count_delta",NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_FC_DELTA},0, 0, VF, "flags" }, | |
| 101 | − { "pts", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_PTS}, 0, 0, VF, "flags" }, | |
| 102 | − { "pts_delta", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_PTS_DELTA},0,0, VF, "flags" }, | |
| 103 | − { "time", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_TIME}, 0, 0, VF, "flags" }, | |
| 104 | − { "time_delta", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_TIME_DELTA},0,0,VF, "flags" }, | |
| 105 | − { "timebase", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_TB}, 0, 0, VF, "flags" }, | |
| 106 | − { "format", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_FMT}, 0, 0, VF, "flags" }, | |
| 107 | − { "size", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_SIZE}, 0, 0, VF, "flags" }, | |
| 108 | − { "rate", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_RATE}, 0, 0, VF, "flags" }, | |
| 109 | − { "eof", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_EOF}, 0, 0, VF, "flags" }, | |
| 110 | − { "sample_count_in", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_SCOUT}, 0, 0, VF, "flags" }, | |
| 111 | − { "sample_count_out", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_SCIN}, 0, 0, VF, "flags" }, | |
| 112 | − { "sample_count_delta",NULL,0, AV_OPT_TYPE_CONST, {.i64=MODE_SC_DELTA},0, 0, VF, "flags" }, | |
| 95 | + { "nozero", NULL, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, VF, "mode" }, | |
| 96 | + { "flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=FLAG_QUEUE}, 0, INT_MAX, VF, "flags" }, | |
| 97 | + { "f", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=FLAG_QUEUE}, 0, INT_MAX, VF, "flags" }, | |
| 98 | + { "queue", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_QUEUE}, 0, 0, VF, "flags" }, | |
| 99 | + { "frame_count_in", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_FCOUT}, 0, 0, VF, "flags" }, | |
| 100 | + { "frame_count_out", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_FCIN}, 0, 0, VF, "flags" }, | |
| 101 | + { "frame_count_delta",NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_FC_DELTA},0, 0, VF, "flags" }, | |
| 102 | + { "pts", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_PTS}, 0, 0, VF, "flags" }, | |
| 103 | + { "pts_delta", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_PTS_DELTA},0,0, VF, "flags" }, | |
| 104 | + { "time", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_TIME}, 0, 0, VF, "flags" }, | |
| 105 | + { "time_delta", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_TIME_DELTA},0,0,VF, "flags" }, | |
| 106 | + { "timebase", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_TB}, 0, 0, VF, "flags" }, | |
| 107 | + { "format", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_FMT}, 0, 0, VF, "flags" }, | |
| 108 | + { "size", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_SIZE}, 0, 0, VF, "flags" }, | |
| 109 | + { "rate", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_RATE}, 0, 0, VF, "flags" }, | |
| 110 | + { "eof", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_EOF}, 0, 0, VF, "flags" }, | |
| 111 | + { "sample_count_in", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_SCOUT}, 0, 0, VF, "flags" }, | |
| 112 | + { "sample_count_out", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FLAG_SCIN}, 0, 0, VF, "flags" }, | |
| 113 | + { "sample_count_delta",NULL,0, AV_OPT_TYPE_CONST, {.i64=FLAG_SC_DELTA},0, 0, VF, "flags" }, | |
| 113 | 114 | { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, VF }, |
| 114 | 115 | { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, VF }, |
| 115 | 116 | { NULL } |
| @@ -213,7 +214,7 @@ static int draw_items(AVFilterContext *ctx, AVFrame *out, · 97 unmodified lines | ||
| 213 | 214 | int64_t current_pts_us = l->current_pts_us; |
| 214 | 215 | char buffer[1024] = { 0 }; |
| 215 | 216 | |
| 216 | − if (s->flags & MODE_FMT) { | |
| 217 | + if (s->flags & FLAG_FMT) { | |
| 217 | 218 | if (l->type == AVMEDIA_TYPE_VIDEO) { |
| 218 | 219 | snprintf(buffer, sizeof(buffer)-1, " | format: %s", |
| 219 | 220 | av_get_pix_fmt_name(l->format)); |
| @@ -224,7 +225,7 @@ static int draw_items(AVFilterContext *ctx, AVFrame *out, · 4 unmodified lines | ||
| 224 | 225 | drawtext(out, xpos, ypos, buffer, s->white); |
| 225 | 226 | xpos += strlen(buffer) * 8; |
| 226 | 227 | } |
| 227 | − if (s->flags & MODE_SIZE) { | |
| 228 | + if (s->flags & FLAG_SIZE) { | |
| 228 | 229 | if (l->type == AVMEDIA_TYPE_VIDEO) { |
| 229 | 230 | snprintf(buffer, sizeof(buffer)-1, " | size: %dx%d", l->w, l->h); |
| 230 | 231 | } else if (l->type == AVMEDIA_TYPE_AUDIO) { |
| @@ -233,7 +234,7 @@ static int draw_items(AVFilterContext *ctx, AVFrame *out, · 2 unmodified lines | ||
| 233 | 234 | drawtext(out, xpos, ypos, buffer, s->white); |
| 234 | 235 | xpos += strlen(buffer) * 8; |
| 235 | 236 | } |
| 236 | − if (s->flags & MODE_RATE) { | |
| 237 | + if (s->flags & FLAG_RATE) { | |
| 237 | 238 | if (l->type == AVMEDIA_TYPE_VIDEO) { |
| 238 | 239 | snprintf(buffer, sizeof(buffer)-1, " | fps: %d/%d", l->frame_rate.num, l->frame_rate.den); |
| 239 | 240 | } else if (l->type == AVMEDIA_TYPE_AUDIO) { |
| @@ -242,12 +243,12 @@ static int draw_items(AVFilterContext *ctx, AVFrame *out, · 2 unmodified lines | ||
| 242 | 243 | drawtext(out, xpos, ypos, buffer, s->white); |
| 243 | 244 | xpos += strlen(buffer) * 8; |
| 244 | 245 | } |
| 245 | − if (s->flags & MODE_TB) { | |
| 246 | + if (s->flags & FLAG_TB) { | |
| 246 | 247 | snprintf(buffer, sizeof(buffer)-1, " | tb: %d/%d", l->time_base.num, l->time_base.den); |
| 247 | 248 | drawtext(out, xpos, ypos, buffer, s->white); |
| 248 | 249 | xpos += strlen(buffer) * 8; |
| 249 | 250 | } |
| 250 | − if (s->flags & MODE_QUEUE) { | |
| 251 | + if (s->flags & FLAG_QUEUE) { | |
| 251 | 252 | snprintf(buffer, sizeof(buffer)-1, " | queue: "); |
| 252 | 253 | drawtext(out, xpos, ypos, buffer, s->white); |
| 253 | 254 | xpos += strlen(buffer) * 8; |
| @@ -255,57 +256,57 @@ static int draw_items(AVFilterContext *ctx, AVFrame *out, · 1 unmodified line | ||
| 255 | 256 | drawtext(out, xpos, ypos, buffer, frames > 0 ? frames >= 10 ? frames >= 50 ? s->red : s->yellow : s->green : s->white); |
| 256 | 257 | xpos += strlen(buffer) * 8; |
| 257 | 258 | } |
| 258 | − if (s->flags & MODE_FCIN) { | |
| 259 | + if (s->flags & FLAG_FCIN) { | |
| 259 | 260 | snprintf(buffer, sizeof(buffer)-1, " | in: %"PRId64, l->frame_count_in); |
| 260 | 261 | drawtext(out, xpos, ypos, buffer, s->white); |
| 261 | 262 | xpos += strlen(buffer) * 8; |
| 262 | 263 | } |
| 263 | − if (s->flags & MODE_FCOUT) { | |
| 264 | + if (s->flags & FLAG_FCOUT) { | |
| 264 | 265 | snprintf(buffer, sizeof(buffer)-1, " | out: %"PRId64, l->frame_count_out); |
| 265 | 266 | drawtext(out, xpos, ypos, buffer, s->white); |
| 266 | 267 | xpos += strlen(buffer) * 8; |
| 267 | 268 | } |
| 268 | − if (s->flags & MODE_FC_DELTA) { | |
| 269 | + if (s->flags & FLAG_FC_DELTA) { | |
| 269 | 270 | snprintf(buffer, sizeof(buffer)-1, " | delta: %"PRId64, l->frame_count_in - l->frame_count_out); |
| 270 | 271 | drawtext(out, xpos, ypos, buffer, s->white); |
| 271 | 272 | xpos += strlen(buffer) * 8; |
| 272 | 273 | } |
| 273 | − if (s->flags & MODE_SCIN) { | |
| 274 | + if (s->flags & FLAG_SCIN) { | |
| 274 | 275 | snprintf(buffer, sizeof(buffer)-1, " | sin: %"PRId64, l->sample_count_in); |
| 275 | 276 | drawtext(out, xpos, ypos, buffer, s->white); |
| 276 | 277 | xpos += strlen(buffer) * 8; |
| 277 | 278 | } |
| 278 | − if (s->flags & MODE_SCOUT) { | |
| 279 | + if (s->flags & FLAG_SCOUT) { | |
| 279 | 280 | snprintf(buffer, sizeof(buffer)-1, " | sout: %"PRId64, l->sample_count_out); |
| 280 | 281 | drawtext(out, xpos, ypos, buffer, s->white); |
| 281 | 282 | xpos += strlen(buffer) * 8; |
| 282 | 283 | } |
| 283 | − if (s->flags & MODE_SC_DELTA) { | |
| 284 | + if (s->flags & FLAG_SC_DELTA) { | |
| 284 | 285 | snprintf(buffer, sizeof(buffer)-1, " | sdelta: %"PRId64, l->sample_count_in - l->sample_count_out); |
| 285 | 286 | drawtext(out, xpos, ypos, buffer, s->white); |
| 286 | 287 | xpos += strlen(buffer) * 8; |
| 287 | 288 | } |
| 288 | − if (s->flags & MODE_PTS) { | |
| 289 | + if (s->flags & FLAG_PTS) { | |
| 289 | 290 | snprintf(buffer, sizeof(buffer)-1, " | pts: %s", av_ts2str(current_pts_us)); |
| 290 | 291 | drawtext(out, xpos, ypos, buffer, s->white); |
| 291 | 292 | xpos += strlen(buffer) * 8; |
| 292 | 293 | } |
| 293 | − if (s->flags & MODE_PTS_DELTA) { | |
| 294 | + if (s->flags & FLAG_PTS_DELTA) { | |
| 294 | 295 | snprintf(buffer, sizeof(buffer)-1, " | pts_delta: %s", av_ts2str(current_pts_us - previous_pts_us)); |
| 295 | 296 | drawtext(out, xpos, ypos, buffer, s->white); |
| 296 | 297 | xpos += strlen(buffer) * 8; |
| 297 | 298 | } |
| 298 | − if (s->flags & MODE_TIME) { | |
| 299 | + if (s->flags & FLAG_TIME) { | |
| 299 | 300 | snprintf(buffer, sizeof(buffer)-1, " | time: %s", av_ts2timestr(current_pts_us, &AV_TIME_BASE_Q)); |
| 300 | 301 | drawtext(out, xpos, ypos, buffer, s->white); |
| 301 | 302 | xpos += strlen(buffer) * 8; |
| 302 | 303 | } |
| 303 | − if (s->flags & MODE_TIME_DELTA) { | |
| 304 | + if (s->flags & FLAG_TIME_DELTA) { | |
| 304 | 305 | snprintf(buffer, sizeof(buffer)-1, " | time_delta: %s", av_ts2timestr(current_pts_us - previous_pts_us, &AV_TIME_BASE_Q)); |
| 305 | 306 | drawtext(out, xpos, ypos, buffer, s->white); |
| 306 | 307 | xpos += strlen(buffer) * 8; |
| 307 | 308 | } |
| 308 | − if (s->flags & MODE_EOF && ff_outlink_get_status(l)) { | |
| 309 | + if (s->flags & FLAG_EOF && ff_outlink_get_status(l)) { | |
| 309 | 310 | snprintf(buffer, sizeof(buffer)-1, " | eof"); |
| 310 | 311 | drawtext(out, xpos, ypos, buffer, s->blue); |
| 311 | 312 | xpos += strlen(buffer) * 8; |