]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_hwmap.c
avfilter: Constify all AVFilters
[ffmpeg] / libavfilter / vf_hwmap.c
index d5fc3c46e626396db23296dbf4f2f38398840f01..d829b47b4482a2503d73a6afc6642cc45bda93c5 100644 (file)
@@ -42,9 +42,9 @@ static int hwmap_query_formats(AVFilterContext *avctx)
     int ret;
 
     if ((ret = ff_formats_ref(ff_all_formats(AVMEDIA_TYPE_VIDEO),
-                              &avctx->inputs[0]->out_formats)) < 0 ||
+                              &avctx->inputs[0]->outcfg.formats)) < 0 ||
         (ret = ff_formats_ref(ff_all_formats(AVMEDIA_TYPE_VIDEO),
-                              &avctx->outputs[0]->in_formats)) < 0)
+                              &avctx->outputs[0]->incfg.formats)) < 0)
         return ret;
 
     return 0;
@@ -143,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) {
@@ -223,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 "
@@ -414,7 +419,7 @@ static const AVFilterPad hwmap_outputs[] = {
     { NULL }
 };
 
-AVFilter ff_vf_hwmap = {
+const AVFilter ff_vf_hwmap = {
     .name           = "hwmap",
     .description    = NULL_IF_CONFIG_SMALL("Map hardware frames"),
     .uninit         = hwmap_uninit,