Revision 85770f2a libavutil/opt.c

View differences:

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

Also available in: Unified diff