avutil/opt: only skip evaluation for rational options
Fixes problems when non-rational options were set using rational expressions, causing rounding errors and the option range limits not to be enforced properly. ffmpeg -f lavfi -i "sine=r=96000/2" This caused an assertion failure with assert level 2. Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
parent
e7626e4e79
commit
6847affcb7
@ -229,13 +229,15 @@ static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **d
|
|||||||
static int set_string_number(void *obj, void *target_obj, const AVOption *o, const char *val, void *dst)
|
static int set_string_number(void *obj, void *target_obj, const AVOption *o, const char *val, void *dst)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int num, den;
|
|
||||||
char c;
|
|
||||||
|
|
||||||
if (sscanf(val, "%d%*1[:/]%d%c", &num, &den, &c) == 2) {
|
if (o->type == AV_OPT_TYPE_RATIONAL || o->type == AV_OPT_TYPE_VIDEO_RATE) {
|
||||||
if ((ret = write_number(obj, o, dst, 1, den, num)) >= 0)
|
int num, den;
|
||||||
return ret;
|
char c;
|
||||||
ret = 0;
|
if (sscanf(val, "%d%*1[:/]%d%c", &num, &den, &c) == 2) {
|
||||||
|
if ((ret = write_number(obj, o, dst, 1, den, num)) >= 0)
|
||||||
|
return ret;
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user