diff options
author | Paul B Mahol <onemda@gmail.com> | 2023-05-14 22:33:37 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2023-05-14 23:35:50 +0200 |
commit | 2a74826b027cb031acdf1f85519ba61cca932509 (patch) | |
tree | d48570a9694ec2e26c109546ac3cb44b84d8f721 /libavfilter/vf_xfade.c | |
parent | 6759983bdce1f157a19f94e881a2bc751970a5bc (diff) | |
download | ffmpeg-2a74826b027cb031acdf1f85519ba61cca932509.tar.gz |
avfilter/*xfade: reduce memory consumption
There is no always need for new buffers.
Diffstat (limited to 'libavfilter/vf_xfade.c')
-rw-r--r-- | libavfilter/vf_xfade.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavfilter/vf_xfade.c b/libavfilter/vf_xfade.c index 9f66927365..5745a24173 100644 --- a/libavfilter/vf_xfade.c +++ b/libavfilter/vf_xfade.c @@ -2042,14 +2042,25 @@ static int xfade_activate(AVFilterContext *ctx) return FFERROR_NOT_READY; } +static AVFrame *get_video_buffer(AVFilterLink *inlink, int w, int h) +{ + XFadeContext *s = inlink->dst->priv; + + return s->xfade_is_over || !s->need_second ? + ff_null_get_video_buffer (inlink, w, h) : + ff_default_get_video_buffer(inlink, w, h); +} + static const AVFilterPad xfade_inputs[] = { { .name = "main", .type = AVMEDIA_TYPE_VIDEO, + .get_buffer.video = get_video_buffer, }, { .name = "xfade", .type = AVMEDIA_TYPE_VIDEO, + .get_buffer.video = get_video_buffer, }, }; |