X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Fvf_blackframe.c;h=8cbcc005a49bb3dab019b05ef8bfb587fcf52930;hb=58400ac133bcfb6bf8196b4e5208bc178307739b;hp=54e75bbb035f832341dd88774486096d6829935e;hpb=62dcdb028cc84845fd263bb09304c4c6500bda7a;p=ffmpeg diff --git a/libavfilter/vf_blackframe.c b/libavfilter/vf_blackframe.c index 54e75bbb035..8cbcc005a49 100644 --- a/libavfilter/vf_blackframe.c +++ b/libavfilter/vf_blackframe.c @@ -38,7 +38,7 @@ #include "internal.h" #include "video.h" -typedef struct { +typedef struct BlackFrameContext { const AVClass *class; int bamount; ///< black amount int bthresh; ///< black threshold @@ -61,25 +61,25 @@ static int query_formats(AVFilterContext *ctx) static int filter_frame(AVFilterLink *inlink, AVFrame *frame) { AVFilterContext *ctx = inlink->dst; - BlackFrameContext *blackframe = ctx->priv; + BlackFrameContext *s = ctx->priv; int x, i; int pblack = 0; uint8_t *p = frame->data[0]; for (i = 0; i < frame->height; i++) { for (x = 0; x < inlink->w; x++) - blackframe->nblack += p[x] < blackframe->bthresh; + s->nblack += p[x] < s->bthresh; p += frame->linesize[0]; } - pblack = blackframe->nblack * 100 / (inlink->w * inlink->h); - if (pblack >= blackframe->bamount) + pblack = s->nblack * 100 / (inlink->w * inlink->h); + if (pblack >= s->bamount) av_log(ctx, AV_LOG_INFO, "frame:%u pblack:%u pts:%"PRId64" t:%f\n", - blackframe->frame, pblack, frame->pts, + s->frame, pblack, frame->pts, frame->pts == AV_NOPTS_VALUE ? -1 : frame->pts * av_q2d(inlink->time_base)); - blackframe->frame++; - blackframe->nblack = 0; + s->frame++; + s->nblack = 0; return ff_filter_frame(inlink->dst->outputs[0], frame); } @@ -118,7 +118,7 @@ static const AVFilterPad avfilter_vf_blackframe_outputs[] = { { NULL } }; -AVFilter avfilter_vf_blackframe = { +AVFilter ff_vf_blackframe = { .name = "blackframe", .description = NULL_IF_CONFIG_SMALL("Detect frames that are (almost) black."),