Revision b6675279 libavutil/opt.c

View differences:

libavutil/opt.c
164 164
            {
165 165
                const AVOption *o_named= av_find_opt(obj, buf, o->unit, 0, 0);
166 166
                if (o_named && o_named->type == FF_OPT_TYPE_CONST)
167
                    d= o_named->default_val;
168
                else if (!strcmp(buf, "default")) d= o->default_val;
167
                    d= o_named->default_val.dbl;
168
                else if (!strcmp(buf, "default")) d= o->default_val.dbl;
169 169
                else if (!strcmp(buf, "max"    )) d= o->max;
170 170
                else if (!strcmp(buf, "min"    )) d= o->min;
171 171
                else if (!strcmp(buf, "none"   )) d= 0;
......
417 417
            case FF_OPT_TYPE_FLAGS:
418 418
            case FF_OPT_TYPE_INT: {
419 419
                int val;
420
                val = opt->default_val;
420
                val = opt->default_val.dbl;
421 421
                av_set_int(s, opt->name, val);
422 422
            }
423 423
            break;
424 424
            case FF_OPT_TYPE_INT64:
425
                if ((double)(opt->default_val+0.6) == opt->default_val)
425
                if ((double)(opt->default_val.dbl+0.6) == opt->default_val.dbl)
426 426
                    av_log(s, AV_LOG_DEBUG, "loss of precision in default of %s\n", opt->name);
427
                av_set_int(s, opt->name, opt->default_val);
427
                av_set_int(s, opt->name, opt->default_val.dbl);
428 428
            break;
429 429
            case FF_OPT_TYPE_DOUBLE:
430 430
            case FF_OPT_TYPE_FLOAT: {
431 431
                double val;
432
                val = opt->default_val;
432
                val = opt->default_val.dbl;
433 433
                av_set_double(s, opt->name, val);
434 434
            }
435 435
            break;
436 436
            case FF_OPT_TYPE_RATIONAL: {
437 437
                AVRational val;
438
                val = av_d2q(opt->default_val, INT_MAX);
438
                val = av_d2q(opt->default_val.dbl, INT_MAX);
439 439
                av_set_q(s, opt->name, val);
440 440
            }
441 441
            break;

Also available in: Unified diff