For fractions and doubles, returning 0.0/0.0 was intentional,
in order to return NaN - the division should be ok since
it's done in float. NaN is better than -1 for indicating a
value not found.
Keeping the return value check for av_get_int.
This partially reverts commit
8089b7fa8c5b5a48cc7101daa4be891d0ead5a5e,
"avoptions: Check the return value from av_get_number".
---
Sorry for the code churn - I realized that the original code
wasn't that bad for the cases other than av_get_int.
libavutil/opt.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 9e06b01..cf46e84 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -290,8 +290,7 @@ double av_get_double(void *obj, const char *name, const
AVOption **o_out)
double num=1;
int den=1;
- if (av_get_number(obj, name, o_out, &num, &den, &intnum) < 0)
- return -1;
+ av_get_number(obj, name, o_out, &num, &den, &intnum);
return num*intnum/den;
}
@@ -301,8 +300,7 @@ AVRational av_get_q(void *obj, const char *name, const
AVOption **o_out)
double num=1;
int den=1;
- if (av_get_number(obj, name, o_out, &num, &den, &intnum) < 0)
- return (AVRational){-1, 0};
+ av_get_number(obj, name, o_out, &num, &den, &intnum);
if (num == 1.0 && (int)intnum == intnum)
return (AVRational){intnum, den};
else
--
1.7.3.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel