mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avutil/opt: preserve fractions in set_string_number()
This avoids going over a double precission float, which may loose precission Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
3e70c7023e
commit
8f853159f6
@ -195,6 +195,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, notfirst = 0;
|
int ret = 0, notfirst = 0;
|
||||||
|
int num, den;
|
||||||
|
char c;
|
||||||
|
|
||||||
|
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 (;;) {
|
||||||
int i, den = 1;
|
int i, den = 1;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#tb 0: 15967/1119068
|
#tb 0: 1000000/70086303
|
||||||
0, 0, 0, 1, 192000, 0x5234b617
|
0, 0, 0, 1, 192000, 0x5234b617
|
||||||
0, 1, 1, 1, 192000, 0x5234b617
|
0, 1, 1, 1, 192000, 0x5234b617
|
||||||
0, 2, 2, 1, 192000, 0x5234b617
|
0, 2, 2, 1, 192000, 0x5234b617
|
||||||
|
Loading…
Reference in New Issue
Block a user