aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_tpad.c
diff options
context:
space:
mode:
authorMarvin Scholz <epirat07@gmail.com>2023-05-22 12:14:33 +0200
committerNiklas Haas <git@haasn.dev>2023-05-22 18:41:22 +0200
commit86b252ea9dee18006910e30646ad1067f2d1323f (patch)
treed221e343a01bd7b31e79280d027a4fa0b573822e /libavfilter/vf_tpad.c
parentfa7180b827490ce1327bf60aa85b10c3e6a7f814 (diff)
downloadffmpeg-86b252ea9dee18006910e30646ad1067f2d1323f.tar.gz
avfilter/vf_tpad: accept hardware frames in clone-only mode
When no drawing is to be performed, tpad can work fine with hardware frames, so advertise this in the query_formats callback and ensure the drawing context is never initialised when just cloning frames. Reviewed-by: Thilo Borgmann <thilo.borgmann@mail.de> Reviewed-by: Niklas Haas <git@haasn.dev>
Diffstat (limited to 'libavfilter/vf_tpad.c')
-rw-r--r--libavfilter/vf_tpad.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libavfilter/vf_tpad.c b/libavfilter/vf_tpad.c
index d0fa7df8be..c2e266cb1a 100644
--- a/libavfilter/vf_tpad.c
+++ b/libavfilter/vf_tpad.c
@@ -71,7 +71,12 @@ AVFILTER_DEFINE_CLASS(tpad);
static int query_formats(AVFilterContext *ctx)
{
- return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0));
+ TPadContext *s = ctx->priv;
+ if ((s->stop_mode == MODE_ADD && s->pad_stop != 0) ||
+ (s->start_mode == MODE_ADD && s->pad_start != 0))
+ return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0));
+
+ return ff_set_common_formats(ctx, ff_all_formats(AVMEDIA_TYPE_VIDEO));
}
static int activate(AVFilterContext *ctx)
@@ -190,8 +195,11 @@ static int config_input(AVFilterLink *inlink)
AVFilterContext *ctx = inlink->dst;
TPadContext *s = ctx->priv;
- ff_draw_init(&s->draw, inlink->format, 0);
- ff_draw_color(&s->draw, &s->color, s->rgba_color);
+ if ((s->stop_mode == MODE_ADD && s->pad_stop != 0) ||
+ (s->start_mode == MODE_ADD && s->pad_start != 0)) {
+ ff_draw_init(&s->draw, inlink->format, 0);
+ ff_draw_color(&s->draw, &s->color, s->rgba_color);
+ }
if (s->start_duration)
s->pad_start = av_rescale_q(s->start_duration, inlink->frame_rate, av_inv_q(AV_TIME_BASE_Q));