X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Fvf_bbox.c;h=33b96b5608c890008663ce22d8882ecabf813b29;hb=c3fa6add58288dda34c88a6c0c9e0cc79f29169b;hp=07ac5505bb17b8325cc994238042fc8cd9041300;hpb=9766d9c9851577d8162d5f006dffc721902a1409;p=ffmpeg diff --git a/libavfilter/vf_bbox.c b/libavfilter/vf_bbox.c index 07ac5505bb1..33b96b5608c 100644 --- a/libavfilter/vf_bbox.c +++ b/libavfilter/vf_bbox.c @@ -56,11 +56,10 @@ static int query_formats(AVFilterContext *ctx) return 0; } -static int end_frame(AVFilterLink *inlink) +static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) { AVFilterContext *ctx = inlink->dst; BBoxContext *bbox = ctx->priv; - AVFilterBufferRef *picref = inlink->cur_buf; FFBoundingBox box; int has_bbox, w, h; @@ -86,29 +85,34 @@ static int end_frame(AVFilterLink *inlink) av_log(ctx, AV_LOG_INFO, "\n"); bbox->frame++; - return ff_end_frame(inlink->dst->outputs[0]); + return ff_filter_frame(inlink->dst->outputs[0], picref); } +static const AVFilterPad bbox_inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .get_video_buffer = ff_null_get_video_buffer, + .filter_frame = filter_frame, + .min_perms = AV_PERM_READ, + }, + { NULL } +}; + +static const AVFilterPad bbox_outputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + }, + { NULL } +}; + AVFilter avfilter_vf_bbox = { .name = "bbox", .description = NULL_IF_CONFIG_SMALL("Compute bounding box for each frame."), .priv_size = sizeof(BBoxContext), .query_formats = query_formats, .init = init, - - .inputs = (const AVFilterPad[]) { - { .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = ff_null_get_video_buffer, - .start_frame = ff_null_start_frame, - .end_frame = end_frame, - .min_perms = AV_PERM_READ, }, - { .name = NULL } - }, - - .outputs = (const AVFilterPad[]) { - { .name = "default", - .type = AVMEDIA_TYPE_VIDEO }, - { .name = NULL } - }, + .inputs = bbox_inputs, + .outputs = bbox_outputs, };