diff options
author | Mark Thompson <sw@jkqxz.net> | 2018-02-13 01:28:12 +0300 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2018-02-13 01:28:12 +0300 |
commit | bcab11a1a23d8b156198db352bbdb932740a966c (patch) | |
tree | 827e9acc1a7547c1d5d719e2b7db00971d62f281 /libavfilter/avfilter.c | |
parent | 9471122a1b5dec34572c3d4c675737f0493d140e (diff) | |
parent | 6d86cef06ba36c0ed591e14a2382e9630059fc5d (diff) |
Merge commit '6d86cef06ba36c0ed591e14a2382e9630059fc5d'
* commit '6d86cef06ba36c0ed591e14a2382e9630059fc5d':
lavfi: Add support for increasing hardware frame pool sizes
Merged-by: Mark Thompson <sw@jkqxz.net>
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r-- | libavfilter/avfilter.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index ea75467a75..7553f7c36a 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -676,6 +676,8 @@ static const AVOption avfilter_options[] = { { "enable", "set enable expression", OFFSET(enable_str), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS }, { "threads", "Allowed number of threads", OFFSET(nb_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS }, + { "extra_hw_frames", "Number of extra hardware frames to allocate for the user", + OFFSET(extra_hw_frames), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS }, { NULL }, }; @@ -1663,3 +1665,24 @@ const AVClass *avfilter_get_class(void) { return &avfilter_class; } + +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; +} |