aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_xfade.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2023-05-14 22:33:37 +0200
committerPaul B Mahol <onemda@gmail.com>2023-05-14 23:35:50 +0200
commit2a74826b027cb031acdf1f85519ba61cca932509 (patch)
treed48570a9694ec2e26c109546ac3cb44b84d8f721 /libavfilter/vf_xfade.c
parent6759983bdce1f157a19f94e881a2bc751970a5bc (diff)
downloadffmpeg-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.c11
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,
},
};