summaryrefslogtreecommitdiff
path: root/libavutil/opt.c
diff options
context:
space:
mode:
authorZhao Zhili <quinkblack@foxmail.com>2021-11-10 23:36:15 +0800
committerMichael Niedermayer <michael@niedermayer.cc>2021-11-11 13:14:58 +0100
commit9fd2b39428165c2319106e82a3c1ca1bba11aa54 (patch)
tree74dc5a5a86860670c3ddbc5f2d8cadf8d54764bb /libavutil/opt.c
parent44c65c6cc0ba3a08834b7c4d83cb5f56321f914d (diff)
downloadffmpeg-9fd2b39428165c2319106e82a3c1ca1bba11aa54.tar.gz
avutil/opt: handle whole range of int64_t in av_opt_get_int
Make get_int/set_int symetric. The int64_t to double to int64_t conversion is unprecise for large value. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavutil/opt.c')
-rw-r--r--libavutil/opt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c
index c7001dbcd3..cfda31ea2f 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -920,7 +920,10 @@ int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_v
if ((ret = get_number(obj, name, NULL, &num, &den, &intnum, search_flags)) < 0)
return ret;
- *out_val = num * intnum / den;
+ if (num == den)
+ *out_val = intnum;
+ else
+ *out_val = num * intnum / den;
return 0;
}