ctx->hwframes->width = inlink->w;
ctx->hwframes->height = inlink->h;
+ if (avctx->extra_hw_frames >= 0)
+ ctx->hwframes->initial_pool_size = 2 + avctx->extra_hw_frames;
+
err = av_hwframe_ctx_init(ctx->hwframes_ref);
if (err < 0)
goto fail;
if (input->format == outlink->format)
return ff_filter_frame(outlink, input);
- output = av_frame_alloc();
+ output = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!output) {
- err = AVERROR(ENOMEM);
- goto fail;
- }
-
- err = av_hwframe_get_buffer(ctx->hwframes_ref, output, 0);
- if (err < 0) {
av_log(ctx, AV_LOG_ERROR, "Failed to allocate frame to upload to.\n");
+ err = AVERROR(ENOMEM);
goto fail;
}
.priv_class = &hwupload_class,
.inputs = hwupload_inputs,
.outputs = hwupload_outputs,
+ .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
};