diff options
author | Panagiotis Issaris <takis.issaris@uhasselt.be> | 2006-09-10 20:21:40 +0000 |
---|---|---|
committer | Guillaume Poirier <gpoirier@mplayerhq.hu> | 2006-09-10 20:21:40 +0000 |
commit | 73a8ceaa17e364dd5bb800de1492a4f2368da644 (patch) | |
tree | ad7cef8b5abd12ed7578a623ac9fd1f2db2c6043 /libavcodec/opt.c | |
parent | b7cff9ce7c4beb181daa0284ad3ad8fd575e4c8d (diff) | |
download | ffmpeg-73a8ceaa17e364dd5bb800de1492a4f2368da644.tar.gz |
make AVOptions default value field work.
Patch by Panagiotis Issaris % takis P issaris A uhasselt P be %
Original thread:
Date: Sep 8, 2006 3:22 PM
Subject: [Ffmpeg-devel] [PATCH 1/2] Enable usage of AVOption default value
Originally committed as revision 6224 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/opt.c')
-rw-r--r-- | libavcodec/opt.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libavcodec/opt.c b/libavcodec/opt.c index 0bdef5c984..84ea19117d 100644 --- a/libavcodec/opt.c +++ b/libavcodec/opt.c @@ -299,3 +299,40 @@ int av_opt_show(void *obj, void *av_log_obj){ } return 0; } + +void av_opt_set_defaults(void *s) +{ + AVOption *opt = NULL; + while ((opt = av_next_option(s, opt)) != NULL) { + switch(opt->type) { + case FF_OPT_TYPE_CONST: + /* Nothing to be done here */ + break; + case FF_OPT_TYPE_FLAGS: + case FF_OPT_TYPE_INT: { + int val; + val = opt->default_val; + av_set_int(s, opt->name, val); + } + break; + case FF_OPT_TYPE_FLOAT: { + double val; + val = opt->default_val; + av_set_double(s, opt->name, val); + } + break; + case FF_OPT_TYPE_RATIONAL: { + AVRational val; + val = av_d2q(opt->default_val, INT_MAX); + av_set_q(s, opt->name, val); + } + break; + case FF_OPT_TYPE_STRING: + /* Cannot set default for string as default_val is of type * double */ + break; + default: + av_log(s, AV_LOG_DEBUG, "AVOption type %d of option %s not implemented yet\n", opt->type, opt->name); + } + } +} + |