[FFmpeg-devel] [PATCH 2/2] avutil/opt: round min/max in integer context
Michael Niedermayer
michael at niedermayer.cc
Sat May 31 16:32:14 EEST 2025
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavutil/opt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 7a84a18bb59..cc4832daeee 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -607,8 +607,8 @@ static int set_string_fmt(void *obj, const AVOption *o, const char *val, uint8_t
}
}
- min = FFMAX(o->min, -1);
- max = FFMIN(o->max, fmt_nb-1);
+ min = FFMAXI(lrint(o->min), -1);
+ max = FFMINI(lrint(o->max), fmt_nb-1);
// hack for compatibility with old ffmpeg
if(min == 0 && max == 0) {
@@ -958,8 +958,8 @@ static int set_format(void *obj, const char *name, int fmt, int search_flags,
if (ret < 0)
return ret;
- min = FFMAX(o->min, -1);
- max = FFMIN(o->max, nb_fmts-1);
+ min = FFMAXI(lrint(o->min), -1);
+ max = FFMINI(lrint(o->max), nb_fmts-1);
if (fmt < min || fmt > max) {
av_log(obj, AV_LOG_ERROR,
--
2.49.0
More information about the ffmpeg-devel
mailing list