* [FFmpeg-devel] [PATCH] avfilter: add more usage of ff_null_get_*_buffer()
@ 2023-05-15 21:20 Paul B Mahol
0 siblings, 0 replies; only message in thread
From: Paul B Mahol @ 2023-05-15 21:20 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1: Type: text/plain, Size: 10 bytes --]
Attached.
[-- Attachment #2: 0003-avfilter-add-more-usage-of-ff_null_get_-_buffer.patch --]
[-- Type: text/x-patch, Size: 5736 bytes --]
From 27c37fe14f6e631e581002ef8fa942095efe0338 Mon Sep 17 00:00:00 2001
From: Paul B Mahol <onemda@gmail.com>
Date: Mon, 15 May 2023 22:30:07 +0200
Subject: [PATCH 3/3] avfilter: add more usage of ff_null_get_*_buffer()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
libavfilter/af_aformat.c | 1 +
libavfilter/af_anull.c | 1 +
libavfilter/af_astats.c | 1 +
libavfilter/f_loop.c | 1 +
libavfilter/settb.c | 2 ++
libavfilter/trim.c | 1 +
libavfilter/vf_fps.c | 1 +
libavfilter/vf_null.c | 1 +
libavfilter/vf_scale.c | 10 ++++++++++
libavfilter/vf_tpad.c | 10 ++++++++++
10 files changed, 29 insertions(+)
diff --git a/libavfilter/af_aformat.c b/libavfilter/af_aformat.c
index a14e4c1240..ce061ffc56 100644
--- a/libavfilter/af_aformat.c
+++ b/libavfilter/af_aformat.c
@@ -180,6 +180,7 @@ static const AVFilterPad avfilter_af_aformat_inputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_AUDIO,
+ .get_buffer.audio = ff_null_get_audio_buffer,
},
};
diff --git a/libavfilter/af_anull.c b/libavfilter/af_anull.c
index 78c5faeb23..d0f32bac19 100644
--- a/libavfilter/af_anull.c
+++ b/libavfilter/af_anull.c
@@ -31,6 +31,7 @@ static const AVFilterPad avfilter_af_anull_inputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_AUDIO,
+ .get_buffer.audio = ff_null_get_audio_buffer,
},
};
diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c
index f3f2bd743b..0354a20a8b 100644
--- a/libavfilter/af_astats.c
+++ b/libavfilter/af_astats.c
@@ -833,6 +833,7 @@ static const AVFilterPad astats_inputs[] = {
.name = "default",
.type = AVMEDIA_TYPE_AUDIO,
.filter_frame = filter_frame,
+ .get_buffer.audio = ff_null_get_audio_buffer,
},
};
diff --git a/libavfilter/f_loop.c b/libavfilter/f_loop.c
index 33b66fa534..1ad9ef84be 100644
--- a/libavfilter/f_loop.c
+++ b/libavfilter/f_loop.c
@@ -481,6 +481,7 @@ static const AVFilterPad inputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
+ .get_buffer.video = ff_null_get_video_buffer,
},
};
diff --git a/libavfilter/settb.c b/libavfilter/settb.c
index 23cb02689b..7e5793b50c 100644
--- a/libavfilter/settb.c
+++ b/libavfilter/settb.c
@@ -169,6 +169,7 @@ static const AVFilterPad avfilter_vf_settb_inputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
+ .get_buffer.video = ff_null_get_video_buffer,
},
};
@@ -201,6 +202,7 @@ static const AVFilterPad avfilter_af_asettb_inputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_AUDIO,
+ .get_buffer.audio = ff_null_get_audio_buffer,
},
};
diff --git a/libavfilter/trim.c b/libavfilter/trim.c
index ee6e821cd2..d5181e2c49 100644
--- a/libavfilter/trim.c
+++ b/libavfilter/trim.c
@@ -195,6 +195,7 @@ static const AVFilterPad trim_inputs[] = {
.type = AVMEDIA_TYPE_VIDEO,
.filter_frame = trim_filter_frame,
.config_props = config_input,
+ .get_buffer.video = ff_null_get_video_buffer,
},
};
diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c
index 2bfb6d29e7..65a1eecb99 100644
--- a/libavfilter/vf_fps.c
+++ b/libavfilter/vf_fps.c
@@ -380,6 +380,7 @@ static const AVFilterPad avfilter_vf_fps_inputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
+ .get_buffer.video = ff_null_get_video_buffer,
},
};
diff --git a/libavfilter/vf_null.c b/libavfilter/vf_null.c
index fa80e2a102..7bc201595d 100644
--- a/libavfilter/vf_null.c
+++ b/libavfilter/vf_null.c
@@ -30,6 +30,7 @@ static const AVFilterPad avfilter_vf_null_inputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
+ .get_buffer.video = ff_null_get_video_buffer,
},
};
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index b0221e8538..6fb8d5ca94 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -988,6 +988,15 @@ static void *child_next(void *obj, void *prev)
return NULL;
}
+static AVFrame *get_video_buffer(AVFilterLink *inlink, int w, int h)
+{
+ ScaleContext *s = inlink->dst->priv;
+
+ return !s->sws ?
+ ff_null_get_video_buffer (inlink, w, h) :
+ ff_default_get_video_buffer(inlink, w, h);
+}
+
#define OFFSET(x) offsetof(ScaleContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
#define TFLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
@@ -1053,6 +1062,7 @@ static const AVFilterPad avfilter_vf_scale_inputs[] = {
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.filter_frame = filter_frame,
+ .get_buffer.video = get_video_buffer,
},
};
diff --git a/libavfilter/vf_tpad.c b/libavfilter/vf_tpad.c
index f0c065f0c3..420ff9aede 100644
--- a/libavfilter/vf_tpad.c
+++ b/libavfilter/vf_tpad.c
@@ -202,11 +202,21 @@ static av_cold void uninit(AVFilterContext *ctx)
av_frame_free(&s->cache_stop);
}
+static AVFrame *get_video_buffer(AVFilterLink *inlink, int w, int h)
+{
+ TPadContext *s = inlink->dst->priv;
+
+ return ((!s->eof && !s->pad_start) || ((s->pad_stop == 0 || s->stop_mode) && (s->pad_start == 0 || s->start_mode))) ?
+ ff_null_get_video_buffer (inlink, w, h) :
+ ff_default_get_video_buffer(inlink, w, h);
+}
+
static const AVFilterPad tpad_inputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.config_props = config_input,
+ .get_buffer.video = get_video_buffer,
},
};
--
2.39.1
[-- Attachment #3: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-15 21:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-15 21:20 [FFmpeg-devel] [PATCH] avfilter: add more usage of ff_null_get_*_buffer() Paul B Mahol
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git