lavu/opt: get rid of useless read_number() calls
The option type is known and fixed for all these, so reading the value directly is simpler and more clear.
This commit is contained in:
@@ -313,7 +313,7 @@ static int set_string_number(void *obj, void *target_obj, const AVOption *o, con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (o->type == AV_OPT_TYPE_FLAGS) {
|
if (o->type == AV_OPT_TYPE_FLAGS) {
|
||||||
read_number(o, dst, NULL, NULL, &intnum);
|
intnum = *(unsigned int*)dst;
|
||||||
if (cmd == '+')
|
if (cmd == '+')
|
||||||
d = intnum | (int64_t)d;
|
d = intnum | (int64_t)d;
|
||||||
else if (cmd == '-')
|
else if (cmd == '-')
|
||||||
@@ -2035,8 +2035,7 @@ void av_opt_freep_ranges(AVOptionRanges **rangesp)
|
|||||||
int av_opt_is_set_to_default(void *obj, const AVOption *o)
|
int av_opt_is_set_to_default(void *obj, const AVOption *o)
|
||||||
{
|
{
|
||||||
int64_t i64;
|
int64_t i64;
|
||||||
double d, d2;
|
double d;
|
||||||
float f;
|
|
||||||
AVRational q;
|
AVRational q;
|
||||||
int ret, w, h;
|
int ret, w, h;
|
||||||
char *str;
|
char *str;
|
||||||
@@ -2081,13 +2080,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
return 0;
|
return 0;
|
||||||
return !strcmp(str, o->default_val.str);
|
return !strcmp(str, o->default_val.str);
|
||||||
case AV_OPT_TYPE_DOUBLE:
|
case AV_OPT_TYPE_DOUBLE:
|
||||||
read_number(o, dst, &d, NULL, NULL);
|
d = *(double *)dst;
|
||||||
return o->default_val.dbl == d;
|
return o->default_val.dbl == d;
|
||||||
case AV_OPT_TYPE_FLOAT:
|
case AV_OPT_TYPE_FLOAT:
|
||||||
read_number(o, dst, &d, NULL, NULL);
|
d = *(float *)dst;
|
||||||
f = o->default_val.dbl;
|
return (float)o->default_val.dbl == d;
|
||||||
d2 = f;
|
|
||||||
return d2 == d;
|
|
||||||
case AV_OPT_TYPE_RATIONAL:
|
case AV_OPT_TYPE_RATIONAL:
|
||||||
q = av_d2q(o->default_val.dbl, INT_MAX);
|
q = av_d2q(o->default_val.dbl, INT_MAX);
|
||||||
return !av_cmp_q(*(AVRational*)dst, q);
|
return !av_cmp_q(*(AVRational*)dst, q);
|
||||||
|
Reference in New Issue
Block a user