aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2023-11-26 01:29:21 +0100
committerPaul B Mahol <onemda@gmail.com>2023-11-26 02:07:45 +0100
commite7111ba44a3b0ca8c3a22eb5b8adaf3d766bc76c (patch)
tree808eb43838b715364e38a0b848b50e389d584c2f
parentf1acb0d843e4e69f95cca598b69cec96b0451597 (diff)
downloadffmpeg-e7111ba44a3b0ca8c3a22eb5b8adaf3d766bc76c.tar.gz
avfilter/vsrc_gradients: allow zero speed
-rw-r--r--libavfilter/vsrc_gradients.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavfilter/vsrc_gradients.c b/libavfilter/vsrc_gradients.c
index c8fda25b6c..e879f0b158 100644
--- a/libavfilter/vsrc_gradients.c
+++ b/libavfilter/vsrc_gradients.c
@@ -75,7 +75,7 @@ static const AVOption gradients_options[] = {
{"seed", "set the seed", OFFSET(seed), AV_OPT_TYPE_INT64, {.i64=-1}, -1, UINT32_MAX, FLAGS },
{"duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=-1}, -1, INT64_MAX, FLAGS },
{"d", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=-1}, -1, INT64_MAX, FLAGS },
- {"speed", "set gradients rotation speed", OFFSET(speed), AV_OPT_TYPE_FLOAT,{.dbl=0.01}, 0.00001, 1, FLAGS },
+ {"speed", "set gradients rotation speed", OFFSET(speed), AV_OPT_TYPE_FLOAT,{.dbl=0.01}, 0, 1, FLAGS },
{"type", "set gradient type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, 0, 4, FLAGS, "type" },
{"t", "set gradient type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, 0, 4, FLAGS, "type" },
{ "linear", "set linear gradient", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "type" },
@@ -391,7 +391,7 @@ static int activate(AVFilterContext *ctx)
if (ff_outlink_frame_wanted(outlink)) {
AVFrame *frame = ff_get_video_buffer(outlink, s->w, s->h);
- float angle = fmodf(s->pts * s->speed, 2.f * M_PI);
+ float angle = (s->speed > 0.f) ? fmodf(s->pts * s->speed, 2.f * M_PI) : 1.f;
const float w2 = s->w / 2.f;
const float h2 = s->h / 2.f;