mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2026-01-23 23:21:06 +01:00
avoptions: Check the return value from av_get_number
This avoids doing a division by zero if the option wasn't found, or wasn't an option of an appropriate type. Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
422b2362fc
commit
8089b7fa8c
1 changed files with 6 additions and 3 deletions
|
|
@ -290,7 +290,8 @@ double av_get_double(void *obj, const char *name, const AVOption **o_out)
|
|||
double num=1;
|
||||
int den=1;
|
||||
|
||||
av_get_number(obj, name, o_out, &num, &den, &intnum);
|
||||
if (av_get_number(obj, name, o_out, &num, &den, &intnum) < 0)
|
||||
return -1;
|
||||
return num*intnum/den;
|
||||
}
|
||||
|
||||
|
|
@ -300,7 +301,8 @@ AVRational av_get_q(void *obj, const char *name, const AVOption **o_out)
|
|||
double num=1;
|
||||
int den=1;
|
||||
|
||||
av_get_number(obj, name, o_out, &num, &den, &intnum);
|
||||
if (av_get_number(obj, name, o_out, &num, &den, &intnum) < 0)
|
||||
return (AVRational){-1, 0};
|
||||
if (num == 1.0 && (int)intnum == intnum)
|
||||
return (AVRational){intnum, den};
|
||||
else
|
||||
|
|
@ -313,7 +315,8 @@ int64_t av_get_int(void *obj, const char *name, const AVOption **o_out)
|
|||
double num=1;
|
||||
int den=1;
|
||||
|
||||
av_get_number(obj, name, o_out, &num, &den, &intnum);
|
||||
if (av_get_number(obj, name, o_out, &num, &den, &intnum) < 0)
|
||||
return -1;
|
||||
return num*intnum/den;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue