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>
pull/374/head
Zhao Zhili 3 years ago committed by Michael Niedermayer
parent 44c65c6cc0
commit 9fd2b39428
  1. 5
      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;
}

Loading…
Cancel
Save