X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Ff_graphmonitor.c;h=a9c4ba42f5c1d5f9c7b6fcdcf984a3bff5eee4a6;hb=80c4c336f95fb273e67326e53a4de9fd2d8c8afe;hp=7052c84d9b7c8e09e343ce1eef4a1a832ca53dc4;hpb=323c2cfd384a06ad1e5233306156eb931185193f;p=ffmpeg diff --git a/libavfilter/f_graphmonitor.c b/libavfilter/f_graphmonitor.c index 7052c84d9b7..a9c4ba42f5c 100644 --- a/libavfilter/f_graphmonitor.c +++ b/libavfilter/f_graphmonitor.c @@ -42,6 +42,7 @@ typedef struct GraphMonitorContext { AVRational frame_rate; int64_t pts; + int64_t next_pts; uint8_t white[4]; uint8_t yellow[4]; uint8_t red[4]; @@ -211,7 +212,7 @@ static void draw_items(AVFilterContext *ctx, AVFrame *out, snprintf(buffer, sizeof(buffer)-1, " | queue: "); drawtext(out, xpos, ypos, buffer, s->white); xpos += strlen(buffer) * 8; - snprintf(buffer, sizeof(buffer)-1, "%"PRId64, frames); + snprintf(buffer, sizeof(buffer)-1, "%"SIZE_SPECIFIER, frames); drawtext(out, xpos, ypos, buffer, frames > 0 ? frames >= 10 ? frames >= 50 ? s->red : s->yellow : s->green : s->white); xpos += strlen(buffer) * 8; } @@ -300,7 +301,7 @@ static int create_frame(AVFilterContext *ctx, int64_t pts) } out->pts = pts; - s->pts = pts; + s->pts = pts + 1; return ff_filter_frame(outlink, out); } @@ -328,10 +329,14 @@ static int activate(AVFilterContext *ctx) if (pts != AV_NOPTS_VALUE) { pts = av_rescale_q(pts, inlink->time_base, outlink->time_base); - if (s->pts < pts && ff_outlink_frame_wanted(outlink)) - return create_frame(ctx, pts); + if (s->pts == AV_NOPTS_VALUE) + s->pts = pts; + s->next_pts = pts; } + if (s->pts < s->next_pts && ff_outlink_frame_wanted(outlink)) + return create_frame(ctx, s->pts); + FF_FILTER_FORWARD_STATUS(inlink, outlink); FF_FILTER_FORWARD_WANTED(outlink, inlink); @@ -347,6 +352,8 @@ static int config_output(AVFilterLink *outlink) s->yellow[0] = s->yellow[1] = 255; s->red[0] = 255; s->green[1] = 255; + s->pts = AV_NOPTS_VALUE; + s->next_pts = AV_NOPTS_VALUE; outlink->w = s->w; outlink->h = s->h; outlink->sample_aspect_ratio = (AVRational){1,1};