return 0;
}
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
BlackFrameContext *blackframe = ctx->priv;
if (args)
sscanf(args, "%u:%u", &blackframe->bamount, &blackframe->bthresh);
- av_log(ctx, AV_LOG_INFO, "bamount:%u bthresh:%u\n",
+ av_log(ctx, AV_LOG_VERBOSE, "bamount:%u bthresh:%u\n",
blackframe->bamount, blackframe->bthresh);
if (blackframe->bamount > 100 || blackframe->bthresh > 255) {
return 0;
}
-static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
+static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
{
AVFilterContext *ctx = inlink->dst;
BlackFrameContext *blackframe = ctx->priv;
p += picref->linesize[0];
}
- ff_draw_slice(ctx->outputs[0], y, h, slice_dir);
+ return ff_draw_slice(ctx->outputs[0], y, h, slice_dir);
}
-static void end_frame(AVFilterLink *inlink)
+static int end_frame(AVFilterLink *inlink)
{
AVFilterContext *ctx = inlink->dst;
BlackFrameContext *blackframe = ctx->priv;
blackframe->frame++;
blackframe->nblack = 0;
- avfilter_unref_buffer(picref);
- ff_end_frame(inlink->dst->outputs[0]);
+ return ff_end_frame(inlink->dst->outputs[0]);
}
AVFilter avfilter_vf_blackframe = {
.query_formats = query_formats,
- .inputs = (const AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .draw_slice = draw_slice,
- .get_video_buffer = ff_null_get_video_buffer,
- .start_frame = ff_null_start_frame_keep_ref,
- .end_frame = end_frame, },
- { .name = NULL}},
+ .inputs = (const AVFilterPad[]) {{ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .draw_slice = draw_slice,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .start_frame = ff_null_start_frame,
+ .end_frame = end_frame, },
+ { .name = NULL}},
.outputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO },