]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_hwupload.c
avcodec: libdav1d AV1 decoder wrapper.
[ffmpeg] / libavfilter / vf_hwupload.c
index c438d5aac971aa603cc924d2fc14bf90cf9fe9dc..af4ff9b81fabf662f55cf4c8458f3cb9f30bdc52 100644 (file)
@@ -133,6 +133,9 @@ static int hwupload_config_output(AVFilterLink *outlink)
     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;
@@ -161,15 +164,10 @@ static int hwupload_filter_frame(AVFilterLink *link, AVFrame *input)
     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;
     }
 
@@ -238,4 +236,5 @@ AVFilter ff_vf_hwupload = {
     .priv_class    = &hwupload_class,
     .inputs        = hwupload_inputs,
     .outputs       = hwupload_outputs,
+    .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };