]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_hwmap.c
libavfilter/dnn_native: Add multiple padding methods in dnn native
[ffmpeg] / libavfilter / vf_hwmap.c
index 8277241dc4e1f146f5a0842a20a3bfb49e19386a..290559a06ab9fb06ef325c80b956e575c1cdb510 100644 (file)
@@ -114,7 +114,8 @@ static int hwmap_config_output(AVFilterLink *outlink)
             err = av_hwframe_ctx_create_derived(&ctx->hwframes_ref,
                                                 outlink->format,
                                                 device,
-                                                inlink->hw_frames_ctx, 0);
+                                                inlink->hw_frames_ctx,
+                                                ctx->mode);
             if (err < 0) {
                 av_log(avctx, AV_LOG_ERROR, "Failed to create derived "
                        "frames context: %d.\n", err);
@@ -142,7 +143,9 @@ static int hwmap_config_output(AVFilterLink *outlink)
             frames->sw_format = hwfc->sw_format;
             frames->width     = hwfc->width;
             frames->height    = hwfc->height;
-            frames->initial_pool_size = 64;
+
+            if (avctx->extra_hw_frames >= 0)
+                frames->initial_pool_size = 2 + avctx->extra_hw_frames;
 
             err = av_hwframe_ctx_init(ctx->hwframes_ref);
             if (err < 0) {
@@ -222,6 +225,9 @@ static int hwmap_config_output(AVFilterLink *outlink)
         hwfc->width     = inlink->w;
         hwfc->height    = inlink->h;
 
+        if (avctx->extra_hw_frames >= 0)
+            hwfc->initial_pool_size = 2 + avctx->extra_hw_frames;
+
         err = av_hwframe_ctx_init(ctx->hwframes_ref);
         if (err < 0) {
             av_log(avctx, AV_LOG_ERROR, "Failed to create frame "