+
+int ff_filter_init_hw_frames(AVFilterContext *avctx, AVFilterLink *link,
+ int default_pool_size)
+{
+ AVHWFramesContext *frames;
+
+ // Must already be set by caller.
+ av_assert0(link->hw_frames_ctx);
+
+ frames = (AVHWFramesContext*)link->hw_frames_ctx->data;
+
+ if (frames->initial_pool_size == 0) {
+ // Dynamic allocation is necessarily supported.
+ } else if (avctx->extra_hw_frames >= 0) {
+ frames->initial_pool_size += avctx->extra_hw_frames;
+ } else {
+ frames->initial_pool_size = default_pool_size;
+ }
+
+ return 0;
+}