summaryrefslogtreecommitdiff
path: root/libavutil/opt.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2011-05-25 16:47:09 +0300
committerMartin Storsjö <martin@martin.st>2011-05-25 22:01:33 +0300
commit80068da3a0bafc7e24ce6b1f91cefec7d793b4d2 (patch)
tree0bdd2cd6504ab5ca3c3f5b81b530d8f16ab23029 /libavutil/opt.c
parent48b1fb1397281dd16df909b6f33c2c36e5626f0a (diff)
avoptions: Return explicitly NAN or {0,0} if the option isn't found
This actually matches what av_get_double did earlier, the 0.0/0.0 division was intentional, for producing NAN. Still keeping the check for the return value from av_get_number, for clarity. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavutil/opt.c')
-rw-r--r--libavutil/opt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 9e06b01c52..74c39fee5f 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -291,7 +291,7 @@ double av_get_double(void *obj, const char *name, const AVOption **o_out)
int den=1;
if (av_get_number(obj, name, o_out, &num, &den, &intnum) < 0)
- return -1;
+ return NAN;
return num*intnum/den;
}
@@ -302,7 +302,7 @@ AVRational av_get_q(void *obj, const char *name, const AVOption **o_out)
int den=1;
if (av_get_number(obj, name, o_out, &num, &den, &intnum) < 0)
- return (AVRational){-1, 0};
+ return (AVRational){0, 0};
if (num == 1.0 && (int)intnum == intnum)
return (AVRational){intnum, den};
else