diff options
Diffstat (limited to 'libavutil/opt.c')
-rw-r--r-- | libavutil/opt.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c index fa1d1227a6..d169b63bc3 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -163,6 +163,9 @@ static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **d return 0; } +#define DEFAULT_NUMVAL(opt) ((opt->type == AV_OPT_TYPE_INT64) ? \ + opt->default_val.i64 : opt->default_val.dbl) + static int set_string_number(void *obj, const AVOption *o, const char *val, void *dst) { int ret = 0, notfirst = 0; @@ -183,8 +186,8 @@ static int set_string_number(void *obj, const AVOption *o, const char *val, void { const AVOption *o_named = av_opt_find(obj, buf, o->unit, 0, 0); if (o_named && o_named->type == AV_OPT_TYPE_CONST) - d = o_named->default_val.dbl; - else if (!strcmp(buf, "default")) d = o->default_val.dbl; + d = DEFAULT_NUMVAL(o_named); + else if (!strcmp(buf, "default")) d = DEFAULT_NUMVAL(o); else if (!strcmp(buf, "max" )) d = o->max; else if (!strcmp(buf, "min" )) d = o->min; else if (!strcmp(buf, "none" )) d = 0; @@ -688,9 +691,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags) } break; case AV_OPT_TYPE_INT64: - if ((double)(opt->default_val.dbl+0.6) == opt->default_val.dbl) - av_log(s, AV_LOG_DEBUG, "loss of precision in default of %s\n", opt->name); - av_opt_set_int(s, opt->name, opt->default_val.dbl, 0); + av_opt_set_int(s, opt->name, opt->default_val.i64, 0); break; case AV_OPT_TYPE_DOUBLE: case AV_OPT_TYPE_FLOAT: { |