diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-02-10 16:44:31 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-02-18 16:38:09 +0100 |
commit | db98b0e04e04079be3ee51d14659b660c0f7f77a (patch) | |
tree | ca6c4d750026b2d9483bd476cf419e8bdc00945c /libavfilter/internal.h | |
parent | cc36a9f5b93557aeb391568641998b18961621e0 (diff) | |
download | ffmpeg-db98b0e04e04079be3ee51d14659b660c0f7f77a.tar.gz |
avfilter/avfilter: Avoid allocation for AVFilterInternal
To do this, allocate AVFilterInternal jointly with AVFilterContext
and rename it to FFFilterContext in the process (similarly to
AVStream/FFStream).
The AVFilterInternal* will be removed from AVFilterContext
on the next major bump.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavfilter/internal.h')
-rw-r--r-- | libavfilter/internal.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libavfilter/internal.h b/libavfilter/internal.h index a6cdf9994c..3d46923cad 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -133,18 +133,28 @@ struct AVFilterGraphInternal { FFFrameQueueGlobal frame_queues; }; -struct AVFilterInternal { +typedef struct FFFilterContext { + /** + * The public AVFilterContext. See avfilter.h for it. + */ + AVFilterContext p; + avfilter_execute_func *execute; // 1 when avfilter_init_*() was successfully called on this filter // 0 otherwise int initialized; -}; +} FFFilterContext; + +static inline FFFilterContext *fffilterctx(AVFilterContext *ctx) +{ + return (FFFilterContext*)ctx; +} static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs) { - return ctx->internal->execute(ctx, func, arg, ret, nb_jobs); + return fffilterctx(ctx)->execute(ctx, func, arg, ret, nb_jobs); } enum FilterFormatsState { |